@grafana/faro-web-tracing
Advanced tools
Comparing version 1.8.0 to 1.8.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSamplingDecision = exports.TracingInstrumentation = exports.getDefaultOTELInstrumentations = exports.FaroSessionSpanProcessor = exports.FaroTraceExporter = void 0; | ||
exports.fetchCustomAttributeFunctionWithDefaults = exports.setSpanStatusOnFetchError = exports.getSamplingDecision = exports.TracingInstrumentation = exports.getDefaultOTELInstrumentations = exports.FaroSessionSpanProcessor = exports.FaroTraceExporter = void 0; | ||
var faroTraceExporter_1 = require("./faroTraceExporter"); | ||
@@ -14,2 +14,5 @@ Object.defineProperty(exports, "FaroTraceExporter", { enumerable: true, get: function () { return faroTraceExporter_1.FaroTraceExporter; } }); | ||
Object.defineProperty(exports, "getSamplingDecision", { enumerable: true, get: function () { return sampler_1.getSamplingDecision; } }); | ||
var instrumentationUtils_1 = require("./instrumentationUtils"); | ||
Object.defineProperty(exports, "setSpanStatusOnFetchError", { enumerable: true, get: function () { return instrumentationUtils_1.setSpanStatusOnFetchError; } }); | ||
Object.defineProperty(exports, "fetchCustomAttributeFunctionWithDefaults", { enumerable: true, get: function () { return instrumentationUtils_1.fetchCustomAttributeFunctionWithDefaults; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,2 @@ | ||
import type { InstrumentationOption, MatchUrlDefinitions } from './types'; | ||
type DefaultInstrumentationsOptions = { | ||
ignoreUrls?: MatchUrlDefinitions; | ||
propagateTraceHeaderCorsUrls?: MatchUrlDefinitions; | ||
}; | ||
import type { DefaultInstrumentationsOptions, InstrumentationOption } from './types'; | ||
export declare function getDefaultOTELInstrumentations(options?: DefaultInstrumentationsOptions): InstrumentationOption[]; | ||
export {}; |
@@ -7,1 +7,2 @@ export { FaroTraceExporter } from './faroTraceExporter'; | ||
export type { FaroTraceExporterConfig, TracingInstrumentationOptions } from './types'; | ||
export { setSpanStatusOnFetchError, fetchCustomAttributeFunctionWithDefaults } from './instrumentationUtils'; |
import type { ContextManager, TextMapPropagator } from '@opentelemetry/api'; | ||
import type { Instrumentation } from '@opentelemetry/instrumentation'; | ||
import type { FetchCustomAttributeFunction } from '@opentelemetry/instrumentation-fetch'; | ||
import type { XHRCustomAttributeFunction } from '@opentelemetry/instrumentation-xml-http-request'; | ||
import type { ResourceAttributes } from '@opentelemetry/resources'; | ||
@@ -17,6 +19,14 @@ import type { SpanProcessor } from '@opentelemetry/sdk-trace-web'; | ||
spanProcessor?: SpanProcessor; | ||
instrumentationOptions?: { | ||
propagateTraceHeaderCorsUrls: MatchUrlDefinitions; | ||
}; | ||
instrumentationOptions?: Omit<DefaultInstrumentationsOptions, 'ignoreUrls'>; | ||
} | ||
export type MatchUrlDefinitions = Patterns; | ||
export type DefaultInstrumentationsOptions = { | ||
ignoreUrls?: MatchUrlDefinitions; | ||
propagateTraceHeaderCorsUrls?: MatchUrlDefinitions; | ||
fetchInstrumentationOptions?: { | ||
applyCustomAttributesOnSpan?: FetchCustomAttributeFunction; | ||
}; | ||
xhrInstrumentationOptions?: { | ||
applyCustomAttributesOnSpan?: XHRCustomAttributeFunction; | ||
}; | ||
}; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,3 +28,3 @@ exports.getDefaultOTELInstrumentations = void 0; | ||
var instrumentation_xml_http_request_1 = require("@opentelemetry/instrumentation-xml-http-request"); | ||
var initialIntrumentationsOptions = { | ||
var initialInstrumentationsOptions = { | ||
ignoreUrls: [], | ||
@@ -12,6 +34,10 @@ propagateTraceHeaderCorsUrls: [], | ||
function getDefaultOTELInstrumentations(options) { | ||
if (options === void 0) { options = initialIntrumentationsOptions; } | ||
return [new instrumentation_fetch_1.FetchInstrumentation(options), new instrumentation_xml_http_request_1.XMLHttpRequestInstrumentation(options)]; | ||
if (options === void 0) { options = initialInstrumentationsOptions; } | ||
var fetchInstrumentationOptions = options.fetchInstrumentationOptions, xhrInstrumentationOptions = options.xhrInstrumentationOptions, sharedOptions = __rest(options, ["fetchInstrumentationOptions", "xhrInstrumentationOptions"]); | ||
return [ | ||
new instrumentation_fetch_1.FetchInstrumentation(__assign(__assign({}, sharedOptions), fetchInstrumentationOptions)), | ||
new instrumentation_xml_http_request_1.XMLHttpRequestInstrumentation(__assign(__assign({}, sharedOptions), xhrInstrumentationOptions)), | ||
]; | ||
} | ||
exports.getDefaultOTELInstrumentations = getDefaultOTELInstrumentations; | ||
//# sourceMappingURL=getDefaultOTELInstrumentations.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSamplingDecision = exports.TracingInstrumentation = exports.getDefaultOTELInstrumentations = exports.FaroSessionSpanProcessor = exports.FaroTraceExporter = void 0; | ||
exports.fetchCustomAttributeFunctionWithDefaults = exports.setSpanStatusOnFetchError = exports.getSamplingDecision = exports.TracingInstrumentation = exports.getDefaultOTELInstrumentations = exports.FaroSessionSpanProcessor = exports.FaroTraceExporter = void 0; | ||
var faroTraceExporter_1 = require("./faroTraceExporter"); | ||
@@ -14,2 +14,5 @@ Object.defineProperty(exports, "FaroTraceExporter", { enumerable: true, get: function () { return faroTraceExporter_1.FaroTraceExporter; } }); | ||
Object.defineProperty(exports, "getSamplingDecision", { enumerable: true, get: function () { return sampler_1.getSamplingDecision; } }); | ||
var instrumentationUtils_1 = require("./instrumentationUtils"); | ||
Object.defineProperty(exports, "setSpanStatusOnFetchError", { enumerable: true, get: function () { return instrumentationUtils_1.setSpanStatusOnFetchError; } }); | ||
Object.defineProperty(exports, "fetchCustomAttributeFunctionWithDefaults", { enumerable: true, get: function () { return instrumentationUtils_1.fetchCustomAttributeFunctionWithDefaults; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -17,2 +17,13 @@ "use strict"; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,2 +41,3 @@ exports.TracingInstrumentation = void 0; | ||
var getDefaultOTELInstrumentations_1 = require("./getDefaultOTELInstrumentations"); | ||
var instrumentationUtils_1 = require("./instrumentationUtils"); | ||
var sampler_1 = require("./sampler"); | ||
@@ -48,3 +60,3 @@ var sessionSpanProcessor_1 = require("./sessionSpanProcessor"); | ||
var _this = this; | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var options = this.options; | ||
@@ -88,2 +100,6 @@ var attributes = {}; | ||
propagateTraceHeaderCorsUrls: (_e = this.options.instrumentationOptions) === null || _e === void 0 ? void 0 : _e.propagateTraceHeaderCorsUrls, | ||
fetchInstrumentationOptions: { | ||
applyCustomAttributesOnSpan: (0, instrumentationUtils_1.fetchCustomAttributeFunctionWithDefaults)((_g = (_f = this.options.instrumentationOptions) === null || _f === void 0 ? void 0 : _f.fetchInstrumentationOptions) === null || _g === void 0 ? void 0 : _g.applyCustomAttributesOnSpan), | ||
}, | ||
xhrInstrumentationOptions: __assign({}, (_h = this.options.instrumentationOptions) === null || _h === void 0 ? void 0 : _h.xhrInstrumentationOptions), | ||
}), | ||
@@ -90,0 +106,0 @@ }); |
@@ -0,10 +1,25 @@ | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch'; | ||
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request'; | ||
const initialIntrumentationsOptions = { | ||
const initialInstrumentationsOptions = { | ||
ignoreUrls: [], | ||
propagateTraceHeaderCorsUrls: [], | ||
}; | ||
export function getDefaultOTELInstrumentations(options = initialIntrumentationsOptions) { | ||
return [new FetchInstrumentation(options), new XMLHttpRequestInstrumentation(options)]; | ||
export function getDefaultOTELInstrumentations(options = initialInstrumentationsOptions) { | ||
const { fetchInstrumentationOptions, xhrInstrumentationOptions } = options, sharedOptions = __rest(options, ["fetchInstrumentationOptions", "xhrInstrumentationOptions"]); | ||
return [ | ||
new FetchInstrumentation(Object.assign(Object.assign({}, sharedOptions), fetchInstrumentationOptions)), | ||
new XMLHttpRequestInstrumentation(Object.assign(Object.assign({}, sharedOptions), xhrInstrumentationOptions)), | ||
]; | ||
} | ||
//# sourceMappingURL=getDefaultOTELInstrumentations.js.map |
@@ -6,2 +6,3 @@ export { FaroTraceExporter } from './faroTraceExporter'; | ||
export { getSamplingDecision } from './sampler'; | ||
export { setSpanStatusOnFetchError, fetchCustomAttributeFunctionWithDefaults } from './instrumentationUtils'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,3 @@ import { context, trace } from '@opentelemetry/api'; | ||
import { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations'; | ||
import { fetchCustomAttributeFunctionWithDefaults } from './instrumentationUtils'; | ||
import { getSamplingDecision } from './sampler'; | ||
@@ -25,3 +26,3 @@ import { FaroSessionSpanProcessor } from './sessionSpanProcessor'; | ||
initialize() { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
const options = this.options; | ||
@@ -65,2 +66,6 @@ const attributes = {}; | ||
propagateTraceHeaderCorsUrls: (_e = this.options.instrumentationOptions) === null || _e === void 0 ? void 0 : _e.propagateTraceHeaderCorsUrls, | ||
fetchInstrumentationOptions: { | ||
applyCustomAttributesOnSpan: fetchCustomAttributeFunctionWithDefaults((_g = (_f = this.options.instrumentationOptions) === null || _f === void 0 ? void 0 : _f.fetchInstrumentationOptions) === null || _g === void 0 ? void 0 : _g.applyCustomAttributesOnSpan), | ||
}, | ||
xhrInstrumentationOptions: Object.assign({}, (_h = this.options.instrumentationOptions) === null || _h === void 0 ? void 0 : _h.xhrInstrumentationOptions), | ||
}), | ||
@@ -67,0 +72,0 @@ }); |
@@ -1,7 +0,2 @@ | ||
import type { InstrumentationOption, MatchUrlDefinitions } from './types'; | ||
type DefaultInstrumentationsOptions = { | ||
ignoreUrls?: MatchUrlDefinitions; | ||
propagateTraceHeaderCorsUrls?: MatchUrlDefinitions; | ||
}; | ||
import type { DefaultInstrumentationsOptions, InstrumentationOption } from './types'; | ||
export declare function getDefaultOTELInstrumentations(options?: DefaultInstrumentationsOptions): InstrumentationOption[]; | ||
export {}; |
@@ -7,1 +7,2 @@ export { FaroTraceExporter } from './faroTraceExporter'; | ||
export type { FaroTraceExporterConfig, TracingInstrumentationOptions } from './types'; | ||
export { setSpanStatusOnFetchError, fetchCustomAttributeFunctionWithDefaults } from './instrumentationUtils'; |
import type { ContextManager, TextMapPropagator } from '@opentelemetry/api'; | ||
import type { Instrumentation } from '@opentelemetry/instrumentation'; | ||
import type { FetchCustomAttributeFunction } from '@opentelemetry/instrumentation-fetch'; | ||
import type { XHRCustomAttributeFunction } from '@opentelemetry/instrumentation-xml-http-request'; | ||
import type { ResourceAttributes } from '@opentelemetry/resources'; | ||
@@ -17,6 +19,14 @@ import type { SpanProcessor } from '@opentelemetry/sdk-trace-web'; | ||
spanProcessor?: SpanProcessor; | ||
instrumentationOptions?: { | ||
propagateTraceHeaderCorsUrls: MatchUrlDefinitions; | ||
}; | ||
instrumentationOptions?: Omit<DefaultInstrumentationsOptions, 'ignoreUrls'>; | ||
} | ||
export type MatchUrlDefinitions = Patterns; | ||
export type DefaultInstrumentationsOptions = { | ||
ignoreUrls?: MatchUrlDefinitions; | ||
propagateTraceHeaderCorsUrls?: MatchUrlDefinitions; | ||
fetchInstrumentationOptions?: { | ||
applyCustomAttributesOnSpan?: FetchCustomAttributeFunction; | ||
}; | ||
xhrInstrumentationOptions?: { | ||
applyCustomAttributesOnSpan?: XHRCustomAttributeFunction; | ||
}; | ||
}; |
{ | ||
"name": "@grafana/faro-web-tracing", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "Faro web tracing implementation.", | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@grafana/faro-web-sdk": "^1.8.0", | ||
"@grafana/faro-web-sdk": "^1.8.1", | ||
"@opentelemetry/api": "^1.9.0", | ||
@@ -72,3 +72,3 @@ "@opentelemetry/context-zone": "1.21.0", | ||
}, | ||
"gitHead": "ec21b36031c20c859d64fbd75a77986397ebaf68" | ||
"gitHead": "08d0f63dba5ff82c9b29b2f91df9d790514ea8d5" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
228738
60
1317
Updated@grafana/faro-web-sdk@^1.8.1