@workleap/honeycomb
Advanced tools
Comparing version 1.0.0 to 1.0.1
# @workleap/honeycomb | ||
## 1.0.1 | ||
### Patch Changes | ||
- [#7](https://github.com/gsoft-inc/wl-honeycomb-web/pull/7) [`d2c7deb`](https://github.com/gsoft-inc/wl-honeycomb-web/commit/d2c7deb257b1cdb0cf43d8d791f87b5817024dbc) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added source code and source maps to the package. | ||
## 1.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -1,11 +0,6 @@ | ||
import { HoneycombSdkOptions } from './honeycombTypes.js'; | ||
import '@honeycombio/opentelemetry-web'; | ||
import '@opentelemetry/instrumentation'; | ||
interface HoneycombSdkOptionsTransformerContext { | ||
import type { HoneycombSdkOptions } from "./honeycombTypes.ts"; | ||
export interface HoneycombSdkOptionsTransformerContext { | ||
debug: boolean; | ||
} | ||
type HoneycombSdkOptionsTransformer = (options: HoneycombSdkOptions, context: HoneycombSdkOptionsTransformerContext) => HoneycombSdkOptions; | ||
declare function applyTransformers(options: HoneycombSdkOptions, transformers: HoneycombSdkOptionsTransformer[], context: HoneycombSdkOptionsTransformerContext): HoneycombSdkOptions; | ||
export { type HoneycombSdkOptionsTransformer, type HoneycombSdkOptionsTransformerContext, applyTransformers }; | ||
export type HoneycombSdkOptionsTransformer = (options: HoneycombSdkOptions, context: HoneycombSdkOptionsTransformerContext) => HoneycombSdkOptions; | ||
export declare function applyTransformers(options: HoneycombSdkOptions, transformers: HoneycombSdkOptionsTransformer[], context: HoneycombSdkOptionsTransformerContext): HoneycombSdkOptions; |
@@ -1,1 +0,10 @@ | ||
export { applyTransformers } from './chunk-7TWOZGVR.js'; | ||
;// CONCATENATED MODULE: ./src/applyTransformers.ts?__rslib_entry__ | ||
// Must specify the return type, otherwise we get a TS4058: Return type of exported function has or is using name X from external module "XYZ" but cannot be named. | ||
function applyTransformers(options, transformers, context) { | ||
return transformers.reduce((acc, transformer)=>transformer(acc, context), options); | ||
} | ||
export { applyTransformers }; | ||
//# sourceMappingURL=applyTransformers.js.map |
@@ -1,4 +0,3 @@ | ||
import { Span, AttributeValue, Attributes } from '@opentelemetry/api'; | ||
import { SpanProcessor } from '@opentelemetry/sdk-trace-web'; | ||
import type { Attributes, AttributeValue, Span } from "@opentelemetry/api"; | ||
import type { SpanProcessor } from "@opentelemetry/sdk-trace-web"; | ||
declare class GlobalAttributeSpanProcessor implements SpanProcessor { | ||
@@ -13,6 +12,5 @@ #private; | ||
} | ||
declare const globalAttributeSpanProcessor: GlobalAttributeSpanProcessor; | ||
declare function setGlobalSpanAttribute(key: string, value: AttributeValue): void; | ||
declare function setGlobalSpanAttributes(attributes: Attributes): void; | ||
export { globalAttributeSpanProcessor, setGlobalSpanAttribute, setGlobalSpanAttributes }; | ||
export declare const globalAttributeSpanProcessor: GlobalAttributeSpanProcessor; | ||
export declare function setGlobalSpanAttribute(key: string, value: AttributeValue): void; | ||
export declare function setGlobalSpanAttributes(attributes: Attributes): void; | ||
export {}; |
@@ -1,1 +0,37 @@ | ||
export { globalAttributeSpanProcessor, setGlobalSpanAttribute, setGlobalSpanAttributes } from './chunk-2ITH5NOF.js'; | ||
;// CONCATENATED MODULE: ./src/globalAttributes.ts?__rslib_entry__ | ||
class GlobalAttributeSpanProcessor { | ||
#attributes = {}; | ||
onStart(span) { | ||
if (Object.keys(this.#attributes).length > 0) { | ||
span.setAttributes(this.#attributes); | ||
} | ||
} | ||
onEnd() {} | ||
forceFlush() { | ||
return Promise.resolve(); | ||
} | ||
shutdown() { | ||
return Promise.resolve(); | ||
} | ||
setAttribute(key, value) { | ||
this.#attributes[key] = value; | ||
} | ||
setAttributes(attributes) { | ||
this.#attributes = { | ||
...this.#attributes, | ||
...attributes | ||
}; | ||
} | ||
} | ||
const globalAttributeSpanProcessor = new GlobalAttributeSpanProcessor(); | ||
function setGlobalSpanAttribute(key, value) { | ||
globalAttributeSpanProcessor.setAttribute(key, value); | ||
} | ||
function setGlobalSpanAttributes(attributes) { | ||
globalAttributeSpanProcessor.setAttributes(attributes); | ||
} | ||
export { globalAttributeSpanProcessor, setGlobalSpanAttribute, setGlobalSpanAttributes }; | ||
//# sourceMappingURL=globalAttributes.js.map |
@@ -1,7 +0,4 @@ | ||
import { HoneycombWebSDK } from '@honeycombio/opentelemetry-web'; | ||
import { Instrumentation } from '@opentelemetry/instrumentation'; | ||
type HoneycombSdkOptions = NonNullable<ConstructorParameters<typeof HoneycombWebSDK>[number]>; | ||
type HoneycombSdkInstrumentations = (Instrumentation | Instrumentation[])[]; | ||
export type { HoneycombSdkInstrumentations, HoneycombSdkOptions }; | ||
import type { HoneycombWebSDK } from "@honeycombio/opentelemetry-web"; | ||
import type { Instrumentation } from "@opentelemetry/instrumentation"; | ||
export type HoneycombSdkOptions = NonNullable<ConstructorParameters<typeof HoneycombWebSDK>[number]>; | ||
export type HoneycombSdkInstrumentations = (Instrumentation | Instrumentation[])[]; |
@@ -1,1 +0,6 @@ | ||
import './chunk-5XTWHQZW.js'; | ||
;// CONCATENATED MODULE: ./src/honeycombTypes.ts?__rslib_entry__ | ||
//# sourceMappingURL=honeycombTypes.js.map |
@@ -1,12 +0,4 @@ | ||
export { HoneycombSdkOptionsTransformer } from './applyTransformers.js'; | ||
export { setGlobalSpanAttribute, setGlobalSpanAttributes } from './globalAttributes.js'; | ||
export { HoneycombSdkInstrumentations, HoneycombSdkOptions } from './honeycombTypes.js'; | ||
export { DefineDocumentLoadInstrumentationOptionsFunction, DefineFetchInstrumentationOptionsFunction, DefineUserInteractionInstrumentationOptionsFunction, DefineXmlHttpRequestInstrumentationOptionsFunction, RegisterHoneycombInstrumentationOptions, registerHoneycombInstrumentation } from './registerHoneycombInstrumentation.js'; | ||
import '@opentelemetry/api'; | ||
import '@opentelemetry/sdk-trace-web'; | ||
import '@honeycombio/opentelemetry-web'; | ||
import '@opentelemetry/instrumentation'; | ||
import '@opentelemetry/instrumentation-document-load'; | ||
import '@opentelemetry/instrumentation-fetch'; | ||
import '@opentelemetry/instrumentation-user-interaction'; | ||
import '@opentelemetry/instrumentation-xml-http-request'; | ||
export type { HoneycombSdkOptionsTransformer } from "./applyTransformers.ts"; | ||
export { setGlobalSpanAttribute, setGlobalSpanAttributes } from "./globalAttributes.ts"; | ||
export * from "./honeycombTypes.ts"; | ||
export { registerHoneycombInstrumentation, type DefineDocumentLoadInstrumentationOptionsFunction, type DefineFetchInstrumentationOptionsFunction, type DefineUserInteractionInstrumentationOptionsFunction, type DefineXmlHttpRequestInstrumentationOptionsFunction, type RegisterHoneycombInstrumentationOptions } from "./registerHoneycombInstrumentation.ts"; |
@@ -1,4 +0,19 @@ | ||
import './chunk-5XTWHQZW.js'; | ||
export { registerHoneycombInstrumentation } from './chunk-KVIILPZX.js'; | ||
import './chunk-7TWOZGVR.js'; | ||
export { setGlobalSpanAttribute, setGlobalSpanAttributes } from './chunk-2ITH5NOF.js'; | ||
import * as __WEBPACK_EXTERNAL_MODULE__globalAttributes_js_5c59fa6a__ from "./globalAttributes.js"; | ||
import * as __WEBPACK_EXTERNAL_MODULE__registerHoneycombInstrumentation_js_6a631b9f__ from "./registerHoneycombInstrumentation.js"; | ||
export * from "./honeycombTypes.js"; | ||
;// CONCATENATED MODULE: external "./globalAttributes.js" | ||
;// CONCATENATED MODULE: external "./registerHoneycombInstrumentation.js" | ||
;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__ | ||
var __webpack_exports__registerHoneycombInstrumentation = __WEBPACK_EXTERNAL_MODULE__registerHoneycombInstrumentation_js_6a631b9f__.registerHoneycombInstrumentation; | ||
var __webpack_exports__setGlobalSpanAttribute = __WEBPACK_EXTERNAL_MODULE__globalAttributes_js_5c59fa6a__.setGlobalSpanAttribute; | ||
var __webpack_exports__setGlobalSpanAttributes = __WEBPACK_EXTERNAL_MODULE__globalAttributes_js_5c59fa6a__.setGlobalSpanAttributes; | ||
export { __webpack_exports__registerHoneycombInstrumentation as registerHoneycombInstrumentation, __webpack_exports__setGlobalSpanAttribute as setGlobalSpanAttribute, __webpack_exports__setGlobalSpanAttributes as setGlobalSpanAttributes }; | ||
//# sourceMappingURL=index.js.map |
@@ -1,16 +0,13 @@ | ||
import { DocumentLoadInstrumentationConfig } from '@opentelemetry/instrumentation-document-load'; | ||
import { FetchInstrumentationConfig } from '@opentelemetry/instrumentation-fetch'; | ||
import { UserInteractionInstrumentationConfig } from '@opentelemetry/instrumentation-user-interaction'; | ||
import { XMLHttpRequestInstrumentationConfig } from '@opentelemetry/instrumentation-xml-http-request'; | ||
import { PropagateTraceHeaderCorsUrls, SpanProcessor } from '@opentelemetry/sdk-trace-web'; | ||
import { HoneycombSdkOptionsTransformer } from './applyTransformers.js'; | ||
import { HoneycombSdkOptions, HoneycombSdkInstrumentations } from './honeycombTypes.js'; | ||
import '@honeycombio/opentelemetry-web'; | ||
import '@opentelemetry/instrumentation'; | ||
type DefineFetchInstrumentationOptionsFunction = (defaultOptions: FetchInstrumentationConfig) => FetchInstrumentationConfig; | ||
type DefineXmlHttpRequestInstrumentationOptionsFunction = (defaultOptions: XMLHttpRequestInstrumentationConfig) => XMLHttpRequestInstrumentationConfig; | ||
type DefineDocumentLoadInstrumentationOptionsFunction = (defaultOptions: DocumentLoadInstrumentationConfig) => DocumentLoadInstrumentationConfig; | ||
type DefineUserInteractionInstrumentationOptionsFunction = (defaultOptions: UserInteractionInstrumentationConfig) => UserInteractionInstrumentationConfig; | ||
interface RegisterHoneycombInstrumentationOptions { | ||
import type { DocumentLoadInstrumentationConfig } from "@opentelemetry/instrumentation-document-load"; | ||
import type { FetchInstrumentationConfig } from "@opentelemetry/instrumentation-fetch"; | ||
import type { UserInteractionInstrumentationConfig } from "@opentelemetry/instrumentation-user-interaction"; | ||
import type { XMLHttpRequestInstrumentationConfig } from "@opentelemetry/instrumentation-xml-http-request"; | ||
import type { PropagateTraceHeaderCorsUrls, SpanProcessor } from "@opentelemetry/sdk-trace-web"; | ||
import { type HoneycombSdkOptionsTransformer } from "./applyTransformers.ts"; | ||
import type { HoneycombSdkInstrumentations, HoneycombSdkOptions } from "./honeycombTypes.ts"; | ||
export type DefineFetchInstrumentationOptionsFunction = (defaultOptions: FetchInstrumentationConfig) => FetchInstrumentationConfig; | ||
export type DefineXmlHttpRequestInstrumentationOptionsFunction = (defaultOptions: XMLHttpRequestInstrumentationConfig) => XMLHttpRequestInstrumentationConfig; | ||
export type DefineDocumentLoadInstrumentationOptionsFunction = (defaultOptions: DocumentLoadInstrumentationConfig) => DocumentLoadInstrumentationConfig; | ||
export type DefineUserInteractionInstrumentationOptionsFunction = (defaultOptions: UserInteractionInstrumentationConfig) => UserInteractionInstrumentationConfig; | ||
export interface RegisterHoneycombInstrumentationOptions { | ||
endpoint?: HoneycombSdkOptions["endpoint"]; | ||
@@ -27,5 +24,3 @@ apiKey?: HoneycombSdkOptions["apiKey"]; | ||
} | ||
declare function getHoneycombSdkOptions(serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions): HoneycombSdkOptions; | ||
declare function registerHoneycombInstrumentation(serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions): void; | ||
export { type DefineDocumentLoadInstrumentationOptionsFunction, type DefineFetchInstrumentationOptionsFunction, type DefineUserInteractionInstrumentationOptionsFunction, type DefineXmlHttpRequestInstrumentationOptionsFunction, type RegisterHoneycombInstrumentationOptions, getHoneycombSdkOptions, registerHoneycombInstrumentation }; | ||
export declare function getHoneycombSdkOptions(serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions): HoneycombSdkOptions; | ||
export declare function registerHoneycombInstrumentation(serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions): void; |
@@ -1,3 +0,93 @@ | ||
export { getHoneycombSdkOptions, registerHoneycombInstrumentation } from './chunk-KVIILPZX.js'; | ||
import './chunk-7TWOZGVR.js'; | ||
import './chunk-2ITH5NOF.js'; | ||
import * as __WEBPACK_EXTERNAL_MODULE__honeycombio_opentelemetry_web_7c854ce2__ from "@honeycombio/opentelemetry-web"; | ||
import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_auto_instrumentations_web_714e304b__ from "@opentelemetry/auto-instrumentations-web"; | ||
import * as __WEBPACK_EXTERNAL_MODULE__applyTransformers_js_2d4fcf6d__ from "./applyTransformers.js"; | ||
import * as __WEBPACK_EXTERNAL_MODULE__globalAttributes_js_5c59fa6a__ from "./globalAttributes.js"; | ||
;// CONCATENATED MODULE: external "@honeycombio/opentelemetry-web" | ||
;// CONCATENATED MODULE: external "@opentelemetry/auto-instrumentations-web" | ||
;// CONCATENATED MODULE: external "./applyTransformers.js" | ||
;// CONCATENATED MODULE: external "./globalAttributes.js" | ||
;// CONCATENATED MODULE: ./src/registerHoneycombInstrumentation.ts?__rslib_entry__ | ||
const defaultDefineFetchInstrumentationOptions = (defaultOptions)=>{ | ||
return defaultOptions; | ||
}; | ||
const defaultDefineDocumentLoadInstrumentationOptions = (defaultOptions)=>{ | ||
return defaultOptions; | ||
}; | ||
// Must specify the return type, otherwise we get a TS4058: Return type of exported function has or is using name X from external module "XYZ" but cannot be named. | ||
function getHoneycombSdkOptions(serviceName, apiServiceUrls, options = {}) { | ||
const { endpoint, apiKey, debug, instrumentations = [], spanProcessors = [], fetchInstrumentation = defaultDefineFetchInstrumentationOptions, xmlHttpRequestInstrumentation = false, documentLoadInstrumentation = defaultDefineDocumentLoadInstrumentationOptions, userInteractionInstrumentation = false, transformers = [] } = options; | ||
if (!endpoint && !apiKey) { | ||
throw new Error("[honeycomb] Instrumentation must be initialized with either an \"endpoint\" or \"apiKey\" option."); | ||
} | ||
const instrumentationOptions = { | ||
ignoreNetworkEvents: true, | ||
propagateTraceHeaderCorsUrls: apiServiceUrls | ||
}; | ||
const autoInstrumentations = {}; | ||
if (fetchInstrumentation) { | ||
autoInstrumentations["@opentelemetry/instrumentation-fetch"] = fetchInstrumentation(instrumentationOptions); | ||
} else { | ||
autoInstrumentations["@opentelemetry/instrumentation-fetch"] = { | ||
enabled: false | ||
}; | ||
} | ||
if (xmlHttpRequestInstrumentation) { | ||
autoInstrumentations["@opentelemetry/instrumentation-xml-http-request"] = xmlHttpRequestInstrumentation({}); | ||
} else { | ||
autoInstrumentations["@opentelemetry/instrumentation-xml-http-request"] = { | ||
enabled: false | ||
}; | ||
} | ||
if (documentLoadInstrumentation) { | ||
autoInstrumentations["@opentelemetry/instrumentation-document-load"] = documentLoadInstrumentation(instrumentationOptions); | ||
} else { | ||
autoInstrumentations["@opentelemetry/instrumentation-document-load"] = { | ||
enabled: false | ||
}; | ||
} | ||
if (userInteractionInstrumentation) { | ||
autoInstrumentations["@opentelemetry/instrumentation-user-interaction"] = userInteractionInstrumentation({}); | ||
} else { | ||
autoInstrumentations["@opentelemetry/instrumentation-user-interaction"] = { | ||
enabled: false | ||
}; | ||
} | ||
const sdkOptions = { | ||
endpoint: endpoint, | ||
apiKey, | ||
debug, | ||
localVisualizations: debug, | ||
serviceName, | ||
// Watch out, getWebAutoInstrumentations enables by default all the supported instrumentations. | ||
// It's important to disabled those that we don't want. | ||
instrumentations: [ | ||
...(0,__WEBPACK_EXTERNAL_MODULE__opentelemetry_auto_instrumentations_web_714e304b__.getWebAutoInstrumentations)(autoInstrumentations), | ||
...instrumentations | ||
], | ||
spanProcessors: [ | ||
__WEBPACK_EXTERNAL_MODULE__globalAttributes_js_5c59fa6a__.globalAttributeSpanProcessor, | ||
...spanProcessors | ||
] | ||
}; | ||
return (0,__WEBPACK_EXTERNAL_MODULE__applyTransformers_js_2d4fcf6d__.applyTransformers)(sdkOptions, transformers, { | ||
debug: !!debug | ||
}); | ||
} | ||
function registerHoneycombInstrumentation(serviceName, apiServiceUrls, options) { | ||
const sdkOptions = getHoneycombSdkOptions(serviceName, apiServiceUrls, options); | ||
const instance = new __WEBPACK_EXTERNAL_MODULE__honeycombio_opentelemetry_web_7c854ce2__.HoneycombWebSDK(sdkOptions); | ||
instance.start(); | ||
} | ||
export { getHoneycombSdkOptions, registerHoneycombInstrumentation }; | ||
//# sourceMappingURL=registerHoneycombInstrumentation.js.map |
{ | ||
"name": "@workleap/honeycomb", | ||
"author": "Workleap", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Shared Honeycomb configuration for web application at Workleap.", | ||
@@ -12,2 +12,3 @@ "license": "Apache-2.0", | ||
}, | ||
"type": "module", | ||
"publishConfig": { | ||
@@ -17,3 +18,2 @@ "access": "public", | ||
}, | ||
"type": "module", | ||
"exports": { | ||
@@ -27,3 +27,4 @@ ".": { | ||
"files": [ | ||
"/dist", | ||
"src", | ||
"dist", | ||
"CHANGELOG.md", | ||
@@ -35,18 +36,25 @@ "README.md" | ||
"@opentelemetry/api": "*", | ||
"@opentelemetry/auto-instrumentations-web": "*" | ||
"@opentelemetry/auto-instrumentations-web": "*", | ||
"@opentelemetry/instrumentation-document-load": "*", | ||
"@opentelemetry/instrumentation-fetch": "*", | ||
"@opentelemetry/instrumentation-user-interaction": "*", | ||
"@opentelemetry/instrumentation-xml-http-request": "*", | ||
"@opentelemetry/sdk-trace-web": "*" | ||
}, | ||
"devDependencies": { | ||
"@opentelemetry/instrumentation": "0.54.2", | ||
"@opentelemetry/instrumentation-document-load": "0.41.0", | ||
"@opentelemetry/instrumentation-fetch": "0.54.2", | ||
"@opentelemetry/instrumentation-user-interaction": "0.41.0", | ||
"@opentelemetry/instrumentation-xml-http-request": "0.54.2", | ||
"@opentelemetry/sdk-trace-web": "1.27.0", | ||
"@swc/core": "1.9.2", | ||
"@opentelemetry/instrumentation": "0.57.1", | ||
"@opentelemetry/instrumentation-document-load": "0.44.0", | ||
"@opentelemetry/instrumentation-fetch": "0.57.1", | ||
"@opentelemetry/instrumentation-user-interaction": "0.44.0", | ||
"@opentelemetry/instrumentation-xml-http-request": "0.57.1", | ||
"@opentelemetry/sdk-trace-web": "1.30.1", | ||
"@rsbuild/core": "1.1.13", | ||
"@rslib/core": "0.3.2", | ||
"@swc/core": "1.10.8", | ||
"@swc/jest": "0.2.37", | ||
"@types/jest": "29.5.14", | ||
"@typescript-eslint/parser": "8.14.0", | ||
"@workleap/eslint-plugin": "3.2.3", | ||
"@workleap/swc-configs": "2.2.3", | ||
"@workleap/tsup-configs": "3.0.6", | ||
"@typescript-eslint/parser": "8.20.0", | ||
"@workleap/eslint-plugin": "3.2.6", | ||
"@workleap/rslib-configs": "1.0.2", | ||
"@workleap/swc-configs": "2.2.4", | ||
"@workleap/typescript-configs": "3.0.2", | ||
@@ -56,3 +64,3 @@ "eslint": "8.57.0", | ||
"jest-environment-jsdom": "29.7.0", | ||
"tsup": "8.3.5", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.5.4" | ||
@@ -65,5 +73,7 @@ }, | ||
"scripts": { | ||
"dev": "tsup --config ./tsup.dev.ts", | ||
"build": "tsup --config ./tsup.build.ts" | ||
"build": "rslib build --config ./rslib.build.ts", | ||
"eslint": "eslint . --max-warnings=-0 --cache --cache-location node_modules/.cache/eslint", | ||
"typecheck": "tsc", | ||
"test": "jest" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47876
24
349
8
21
1