@interopio/otel 0.0.37 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.js +5 -3
- package/dist/builder.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/dependencies/builder.d.ts +3 -1
- package/dist/metrics/dependencies/builder.js +6 -0
- package/dist/metrics/dependencies/builder.js.map +1 -1
- package/dist/metrics/dependencies/types.d.ts +7 -0
- package/dist/metrics/factory/factory.js +3 -3
- package/dist/metrics/manager.js +3 -1
- package/dist/metrics/manager.js.map +1 -1
- package/dist/metrics/metrics/base/base.js +1 -5
- package/dist/metrics/metrics/base/base.js.map +1 -1
- package/dist/metrics/metrics/base/types.d.ts +6 -3
- package/dist/metrics/settings/builder.d.ts +4 -0
- package/dist/metrics/settings/builder.js +15 -6
- package/dist/metrics/settings/builder.js.map +1 -1
- package/dist/metrics/settings/default.d.ts +3 -0
- package/dist/metrics/settings/default.js +3 -0
- package/dist/metrics/settings/default.js.map +1 -1
- package/dist/metrics/settings/types.d.ts +3 -0
- package/dist/metrics/types.d.ts +2 -1
- package/dist/metrics/utils/nullMetricsManager.d.ts +2 -1
- package/dist/metrics/utils/nullMetricsManager.js +3 -0
- package/dist/metrics/utils/nullMetricsManager.js.map +1 -1
- package/dist/traces/builder.d.ts +6 -2
- package/dist/traces/builder.js +16 -2
- package/dist/traces/builder.js.map +1 -1
- package/dist/traces/ioInsightsSampler.d.ts +2 -2
- package/dist/traces/ioInsightsSampler.js.map +1 -1
- package/dist/traces/manager.d.ts +9 -3
- package/dist/traces/manager.js +86 -39
- package/dist/traces/manager.js.map +1 -1
- package/dist/traces/nullTracesManager.d.ts +3 -2
- package/dist/traces/nullTracesManager.js +7 -2
- package/dist/traces/nullTracesManager.js.map +1 -1
- package/dist/traces/nullTracingState.d.ts +2 -2
- package/dist/traces/nullTracingState.js.map +1 -1
- package/dist/traces/traces.d.ts +3 -2
- package/dist/traces/traces.js +13 -10
- package/dist/traces/traces.js.map +1 -1
- package/dist/traces/tracingState.d.ts +6 -5
- package/dist/traces/tracingState.js +11 -7
- package/dist/traces/tracingState.js.map +1 -1
- package/dist/traces/types.d.ts +60 -66
- package/dist/traces/types.js +11 -11
- package/dist/traces/types.js.map +1 -1
- package/dist/traces/utils/index.d.ts +4 -11
- package/dist/traces/utils/index.js +43 -28
- package/dist/traces/utils/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/validation/traces/filter.d.ts +2 -2
- package/dist/validation/traces/filter.js.map +1 -1
- package/dist/validation/traces/withSpan.d.ts +2 -2
- package/dist/validation/traces/withSpan.js +3 -2
- package/dist/validation/traces/withSpan.js.map +1 -1
- package/package.json +1 -1
package/dist/traces/types.d.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { Manager } from "../types";
|
|
|
4
4
|
import { OTLPExporterNodeConfigBase } from "@opentelemetry/otlp-exporter-base";
|
|
5
5
|
import { Sampler, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
6
6
|
export interface TracesManager extends Manager<TracesSettings> {
|
|
7
|
+
resolveCurrentTracingState(): TracingState | null;
|
|
7
8
|
withSpan<T>(source: string, callback: WithSpanCallback<T>): T;
|
|
8
9
|
withSpan<T>(source: string, filteringContext: FilteringContext, callback: WithSpanCallback<T>): T;
|
|
9
10
|
withSpan<T>(source: string, filteringContext: FilteringContext, propagationInfo: PropagationInfo | PropagationInfoCarrier | null, callback: WithSpanCallback<T>): T;
|
|
11
|
+
withSpan<T>(source: string, filteringContext: FilteringContext, propagationInfo: PropagationInfo | PropagationInfoCarrier | null, options: WithSpanOptions | null, callback: WithSpanCallback<T>): T;
|
|
10
12
|
}
|
|
11
13
|
export type WithSpanCallback<T> = (tracingState: TracingState) => T;
|
|
12
14
|
export interface PropagationInfo {
|
|
13
15
|
traceparent?: string;
|
|
14
16
|
tracestate?: string;
|
|
17
|
+
forceTracing?: boolean;
|
|
15
18
|
}
|
|
16
19
|
export interface PropagationInfoCarrier {
|
|
17
20
|
__interopIOTracePropagationInfo?: PropagationInfo;
|
|
@@ -24,8 +27,8 @@ export interface TracingState {
|
|
|
24
27
|
*/
|
|
25
28
|
enabled: boolean;
|
|
26
29
|
status?: SpanStatus;
|
|
27
|
-
level: keyof typeof
|
|
28
|
-
addData(level:
|
|
30
|
+
level: keyof typeof SpanVerbosity;
|
|
31
|
+
addData(level: SpanVerbosity | keyof typeof SpanVerbosity, data: object): void;
|
|
29
32
|
source: string;
|
|
30
33
|
id?: string;
|
|
31
34
|
traceId?: string;
|
|
@@ -63,15 +66,19 @@ export type FilteringContext = {
|
|
|
63
66
|
serviceVersion?: string;
|
|
64
67
|
userId?: string;
|
|
65
68
|
} & Record<string, any>;
|
|
66
|
-
export interface WithSpanDecoratorOptions {
|
|
69
|
+
export interface WithSpanDecoratorOptions extends WithSpanOptions {
|
|
67
70
|
argMapping?: {
|
|
68
71
|
[x: string]: string;
|
|
69
|
-
} | Array<string | null | undefined
|
|
72
|
+
} | Array<string | null | undefined> | ((...args: any[]) => any);
|
|
70
73
|
thisMapping?: {
|
|
71
74
|
[x: string]: string;
|
|
72
|
-
};
|
|
75
|
+
} | ((that: any) => any);
|
|
76
|
+
}
|
|
77
|
+
export type PropagationInfoCallback = (source: string, fullFilteringContext: FilteringContext) => (PropagationInfo | null);
|
|
78
|
+
export interface WithSpanOptions extends Omit<SpanCreationOptions, "sample"> {
|
|
79
|
+
defaultFilters?: SpanFilter[];
|
|
73
80
|
}
|
|
74
|
-
export declare enum
|
|
81
|
+
export declare enum SpanVerbosity {
|
|
75
82
|
OFF = 0,
|
|
76
83
|
LOWEST = 1,
|
|
77
84
|
DIAGNOSTIC = 2,
|
|
@@ -80,7 +87,7 @@ export declare enum Verbosity {
|
|
|
80
87
|
WARN = 5,
|
|
81
88
|
HIGHEST = 6
|
|
82
89
|
}
|
|
83
|
-
export interface
|
|
90
|
+
export interface SpanFilter extends SpanCreationOptions {
|
|
84
91
|
/**
|
|
85
92
|
* Specifies the source string used for matching spans.
|
|
86
93
|
* Spans match only if their source equals this value, or
|
|
@@ -101,103 +108,95 @@ export interface Filter {
|
|
|
101
108
|
context?: {
|
|
102
109
|
[key: string]: string | number | boolean;
|
|
103
110
|
};
|
|
111
|
+
}
|
|
112
|
+
export interface SpanCreationOptions {
|
|
104
113
|
/**
|
|
105
|
-
* Whether the
|
|
114
|
+
* Whether the span will be created or will be a no-op. See 'Filter'.
|
|
106
115
|
*
|
|
107
|
-
*
|
|
116
|
+
* Defaults to 'true'.
|
|
108
117
|
*/
|
|
109
118
|
enabled?: boolean;
|
|
110
119
|
/**
|
|
111
120
|
* If a tracing span is disabled by filter, setting this to "true" will stop the propagation
|
|
112
121
|
* of trace nesting info across it.
|
|
113
|
-
*
|
|
114
|
-
* If not specified, see 'TracesDefaultsSettings'.
|
|
115
122
|
*/
|
|
116
123
|
stopPropagationIfSpanIsDisabled?: boolean;
|
|
117
124
|
/**
|
|
118
|
-
*
|
|
125
|
+
* Default span attribute verbosity level. See 'Filter'.
|
|
119
126
|
*
|
|
120
|
-
*
|
|
127
|
+
* Defaults to 'INFO'.
|
|
121
128
|
*/
|
|
122
|
-
level?: keyof typeof
|
|
129
|
+
level?: keyof typeof SpanVerbosity;
|
|
123
130
|
/**
|
|
124
131
|
* Whether the filtering context will be added as span attributes
|
|
125
|
-
* to the
|
|
132
|
+
* to the span. See 'Filter'.
|
|
126
133
|
*
|
|
127
|
-
*
|
|
134
|
+
* Defaults to 'true'.
|
|
128
135
|
*/
|
|
129
136
|
addContextToTrace?: boolean;
|
|
130
137
|
/**
|
|
131
138
|
* Whether the span's status will be set to OK on completion, if
|
|
132
|
-
* it's still UNSET.
|
|
139
|
+
* it's still UNSET. See 'Filter'.
|
|
133
140
|
*
|
|
134
|
-
*
|
|
141
|
+
* Defaults to 'false'.
|
|
135
142
|
*/
|
|
136
143
|
autoSetSuccessStatus?: boolean;
|
|
137
144
|
/**
|
|
138
|
-
*
|
|
139
|
-
* transfer objects for span nesting across system boundaries.
|
|
145
|
+
* Default sampling setting/probability. See 'SamplingSettings'.
|
|
140
146
|
*
|
|
141
|
-
*
|
|
147
|
+
* Defaults to 'true'.
|
|
142
148
|
*/
|
|
143
|
-
|
|
144
|
-
spanOptions?: SpanOptions;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Used for spans that didn't match a Filter or SamplingSettings entry,
|
|
148
|
-
* or if particular property isn't provided in matched entry.
|
|
149
|
-
*/
|
|
150
|
-
export interface TracesDefaultsSettings {
|
|
149
|
+
sample?: number | boolean;
|
|
151
150
|
/**
|
|
152
|
-
* Whether the span will
|
|
151
|
+
* Whether the span will not inject its propagation info into data
|
|
152
|
+
* transfer objects for span nesting across system boundaries.
|
|
153
153
|
*
|
|
154
|
-
* Defaults to '
|
|
154
|
+
* Defaults to 'false'.
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
disablePropagation?: boolean;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
* of trace nesting info across it.
|
|
158
|
+
* Forces the span to create a new trace.
|
|
160
159
|
*/
|
|
161
|
-
|
|
160
|
+
disableNesting?: boolean;
|
|
162
161
|
/**
|
|
163
|
-
*
|
|
162
|
+
* Whether the span will be counted in the insights_trace_hits metric.
|
|
164
163
|
*
|
|
165
|
-
* Defaults to '
|
|
164
|
+
* Defaults to 'false'.
|
|
166
165
|
*/
|
|
167
|
-
|
|
166
|
+
count?: boolean;
|
|
168
167
|
/**
|
|
169
|
-
* Whether the
|
|
170
|
-
* to
|
|
168
|
+
* Whether the span will be able to start a new trace. If false, it will only
|
|
169
|
+
* be able to be added to an existing trace.
|
|
171
170
|
*
|
|
172
171
|
* Defaults to 'true'.
|
|
173
172
|
*/
|
|
174
|
-
|
|
173
|
+
canBeRoot?: boolean;
|
|
175
174
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
175
|
+
* How deep addData method should recurse into objects when adding
|
|
176
|
+
* attributes to spans.
|
|
178
177
|
*
|
|
179
|
-
* Defaults to
|
|
178
|
+
* Defaults to 3.
|
|
180
179
|
*/
|
|
181
|
-
|
|
180
|
+
maxAttributeDepth?: number;
|
|
182
181
|
/**
|
|
183
|
-
*
|
|
182
|
+
* If true, any child spans (including nested spans across sytem boundaries)
|
|
183
|
+
* will be forced to be traced, even if their span filter configuration
|
|
184
|
+
* is set to not enabled.
|
|
184
185
|
*
|
|
185
|
-
* Defaults to '
|
|
186
|
+
* Defaults to 'false'.
|
|
186
187
|
*/
|
|
187
|
-
|
|
188
|
+
forceChildTracing?: boolean;
|
|
189
|
+
getPropagationInfo?: PropagationInfoCallback;
|
|
188
190
|
/**
|
|
189
|
-
*
|
|
190
|
-
* transfer objects for span nesting across system boundaries.
|
|
191
|
-
*
|
|
192
|
-
* Defaults to 'false'.
|
|
191
|
+
* OTEL span options
|
|
193
192
|
*/
|
|
194
|
-
|
|
195
|
-
spanOptions?: SpanOptions;
|
|
193
|
+
otelSpanOptions?: SpanOptions;
|
|
196
194
|
}
|
|
197
195
|
export interface TracesSettings {
|
|
198
196
|
/**
|
|
199
197
|
* Whether tracing functionality is enabled.
|
|
200
198
|
* If disabled, API is still usable, but methods are no-ops.
|
|
199
|
+
*
|
|
201
200
|
* Defaults to 'false'.
|
|
202
201
|
*/
|
|
203
202
|
enabled: boolean;
|
|
@@ -217,7 +216,7 @@ export interface TracesSettings {
|
|
|
217
216
|
* If no matching filter entry is found,
|
|
218
217
|
* the settings from 'default' are used.
|
|
219
218
|
*/
|
|
220
|
-
filters?:
|
|
219
|
+
filters?: SpanFilter[];
|
|
221
220
|
/**
|
|
222
221
|
* If true, use a predefined list of filters for well-known
|
|
223
222
|
* platform traces.
|
|
@@ -230,14 +229,14 @@ export interface TracesSettings {
|
|
|
230
229
|
* whether a span will be sampled.
|
|
231
230
|
*
|
|
232
231
|
* If no matching sampling setting entry is found,
|
|
233
|
-
* the settings from '
|
|
232
|
+
* the settings from 'defaults' are used.
|
|
234
233
|
*/
|
|
235
234
|
sampling?: SamplingSettings[];
|
|
236
235
|
/**
|
|
237
236
|
* Default settings if appropriate entries aren't found
|
|
238
237
|
* in 'filters' and 'sampling' collections.
|
|
239
238
|
*/
|
|
240
|
-
|
|
239
|
+
defaults?: SpanCreationOptions;
|
|
241
240
|
/**
|
|
242
241
|
* If 'true', the library will use the ContextManager provided
|
|
243
242
|
* by the active OTEL SDK to manage and derive propagation information
|
|
@@ -277,19 +276,14 @@ export interface TracesSettings {
|
|
|
277
276
|
* have a ConsoleTraceExporter.
|
|
278
277
|
*/
|
|
279
278
|
console?: boolean;
|
|
280
|
-
/**
|
|
281
|
-
* How deep addData method should recurse into objects when adding
|
|
282
|
-
* attributes to spans. Default value: 3
|
|
283
|
-
*/
|
|
284
|
-
maxAttributeDepth?: number;
|
|
285
279
|
/**
|
|
286
280
|
* Builder overrides
|
|
287
281
|
*/
|
|
288
|
-
filteringContextGetter?: (
|
|
289
|
-
tracerProvider?: TracerProvider;
|
|
282
|
+
filteringContextGetter?: () => FilteringContext;
|
|
283
|
+
tracerProvider?: () => TracerProvider;
|
|
290
284
|
samplerGetter?: (defaultSampler: Sampler) => Sampler;
|
|
291
|
-
spanProcessors?: SpanProcessor[];
|
|
292
|
-
spanExporters?: SpanExporter[];
|
|
285
|
+
spanProcessors?: () => SpanProcessor[];
|
|
286
|
+
spanExporters?: () => SpanExporter[];
|
|
293
287
|
providerRegistrationSettings?: any;
|
|
294
288
|
}
|
|
295
289
|
export interface SamplingSettings {
|
package/dist/traces/types.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})(
|
|
3
|
+
exports.SpanVerbosity = void 0;
|
|
4
|
+
var SpanVerbosity;
|
|
5
|
+
(function (SpanVerbosity) {
|
|
6
|
+
SpanVerbosity[SpanVerbosity["OFF"] = 0] = "OFF";
|
|
7
|
+
SpanVerbosity[SpanVerbosity["LOWEST"] = 1] = "LOWEST";
|
|
8
|
+
SpanVerbosity[SpanVerbosity["DIAGNOSTIC"] = 2] = "DIAGNOSTIC";
|
|
9
|
+
SpanVerbosity[SpanVerbosity["DEBUG"] = 3] = "DEBUG";
|
|
10
|
+
SpanVerbosity[SpanVerbosity["INFO"] = 4] = "INFO";
|
|
11
|
+
SpanVerbosity[SpanVerbosity["WARN"] = 5] = "WARN";
|
|
12
|
+
SpanVerbosity[SpanVerbosity["HIGHEST"] = 6] = "HIGHEST";
|
|
13
|
+
})(SpanVerbosity = exports.SpanVerbosity || (exports.SpanVerbosity = {}));
|
|
14
14
|
//# sourceMappingURL=types.js.map
|
package/dist/traces/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/traces/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/traces/types.ts"],"names":[],"mappings":";;;AA4HA,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,+CAAG,CAAA;IACH,qDAAM,CAAA;IACN,6DAAU,CAAA;IACV,mDAAK,CAAA;IACL,iDAAI,CAAA;IACJ,iDAAI,CAAA;IACJ,uDAAO,CAAA;AACT,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Sampler, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
2
|
import { ContextManager, TracerProvider } from "@opentelemetry/api";
|
|
3
|
-
import {
|
|
3
|
+
import { SpanFilter, FilteringContext, SpanCreationOptions, WithSpanOptions } from "../types";
|
|
4
4
|
import { Span } from "@opentelemetry/api";
|
|
5
5
|
import { Logger } from "../../logger/types";
|
|
6
6
|
import { Settings } from "../../types";
|
|
7
|
-
export declare const isSpanEnabled: (match:
|
|
8
|
-
export declare const isFilterMatch: (filter:
|
|
7
|
+
export declare const isSpanEnabled: (match: SpanFilter | undefined, options: WithSpanOptions, defaultMatch: SpanCreationOptions | undefined) => boolean;
|
|
8
|
+
export declare const isFilterMatch: (filter: SpanFilter, filteringContext: FilteringContext, source: string) => number;
|
|
9
9
|
export declare const setTracerProvider: (tracerProvider?: TracerProvider, sampler?: ((defaultSampler: Sampler) => Sampler) | undefined, spanProcessors?: SpanProcessor[], spanExporters?: SpanExporter[], providerRegistrationSettings?: {
|
|
10
10
|
contextManager?: ContextManager;
|
|
11
11
|
}, filteringContextGetter?: () => FilteringContext, logger?: Logger, otelSettings?: Settings) => void;
|
|
@@ -15,11 +15,4 @@ export declare const isFunctionType: (variable: unknown) => boolean;
|
|
|
15
15
|
export declare const deep_value: (obj: {
|
|
16
16
|
[x: string]: any;
|
|
17
17
|
}, path: any) => any;
|
|
18
|
-
export declare const extractFilteringContextFromArgs: (template:
|
|
19
|
-
argMapping?: {
|
|
20
|
-
[x: string]: string;
|
|
21
|
-
} | undefined;
|
|
22
|
-
thisMapping?: {
|
|
23
|
-
[x: string]: string;
|
|
24
|
-
} | undefined;
|
|
25
|
-
}, args: any[], that: any) => any;
|
|
18
|
+
export declare const extractFilteringContextFromArgs: (template: FilteringContext, args: any[], that: any) => any;
|
|
@@ -8,7 +8,8 @@ const resources_1 = require("@opentelemetry/resources");
|
|
|
8
8
|
const filter_1 = require("../../validation/traces/filter");
|
|
9
9
|
const attributeData_1 = require("../../validation/traces/attributeData");
|
|
10
10
|
const ioInsightsSampler_1 = require("../ioInsightsSampler");
|
|
11
|
-
const isSpanEnabled = (match, defaultMatch) => {
|
|
11
|
+
const isSpanEnabled = (match, options, defaultMatch) => {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
let enabled;
|
|
13
14
|
if (match) {
|
|
14
15
|
if (match.enabled === undefined) {
|
|
@@ -18,11 +19,8 @@ const isSpanEnabled = (match, defaultMatch) => {
|
|
|
18
19
|
enabled = match.enabled;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
else if (defaultMatch) {
|
|
22
|
-
enabled = defaultMatch.enabled;
|
|
23
|
-
}
|
|
24
22
|
else {
|
|
25
|
-
enabled = true;
|
|
23
|
+
enabled = (_b = (_a = options === null || options === void 0 ? void 0 : options.enabled) !== null && _a !== void 0 ? _a : defaultMatch === null || defaultMatch === void 0 ? void 0 : defaultMatch.enabled) !== null && _b !== void 0 ? _b : true;
|
|
26
24
|
}
|
|
27
25
|
return enabled;
|
|
28
26
|
};
|
|
@@ -35,14 +33,21 @@ const isFilterMatch = (filter, filteringContext, source) => {
|
|
|
35
33
|
}
|
|
36
34
|
if (filter.source && filter.source.startsWith("#")) {
|
|
37
35
|
if (!new RegExp(filter.source.substring(1), "i").test(source)) {
|
|
38
|
-
return
|
|
36
|
+
return 0;
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
else if (filter.source &&
|
|
42
|
-
|
|
39
|
+
else if (filter.source &&
|
|
40
|
+
// "io.api.foo" matches filter "io.api.foo"
|
|
41
|
+
source !== filter.source &&
|
|
42
|
+
// "io.api.foo" matches filter "io.api"
|
|
43
|
+
!source.startsWith(filter.source + ".") &&
|
|
44
|
+
// "io.api.foo" matches filter "io.api.foo."
|
|
45
|
+
// "io.api.foo.bar" doesn't match filter "io.api.foo."
|
|
46
|
+
source + "." !== filter.source) {
|
|
47
|
+
return 0;
|
|
43
48
|
}
|
|
44
49
|
if (!filter.context) {
|
|
45
|
-
return
|
|
50
|
+
return 1;
|
|
46
51
|
}
|
|
47
52
|
for (const key of Object.keys(filter.context)) {
|
|
48
53
|
const required = filter.context[key];
|
|
@@ -62,7 +67,7 @@ const isFilterMatch = (filter, filteringContext, source) => {
|
|
|
62
67
|
break;
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
|
-
return isMatch;
|
|
70
|
+
return isMatch ? 2 : 0;
|
|
66
71
|
};
|
|
67
72
|
exports.isFilterMatch = isFilterMatch;
|
|
68
73
|
const setTracerProvider = (tracerProvider, sampler, spanProcessors, spanExporters, providerRegistrationSettings, filteringContextGetter, logger, otelSettings) => {
|
|
@@ -72,7 +77,7 @@ const setTracerProvider = (tracerProvider, sampler, spanProcessors, spanExporter
|
|
|
72
77
|
const settings = otelSettings === null || otelSettings === void 0 ? void 0 : otelSettings.traces;
|
|
73
78
|
if (!tracerProvider) {
|
|
74
79
|
const defaultSampler = new sdk_trace_base_1.ParentBasedSampler({
|
|
75
|
-
root: new ioInsightsSampler_1.ioInsightsSampler((settings === null || settings === void 0 ? void 0 : settings.sampling) || [], settings === null || settings === void 0 ? void 0 : settings.
|
|
80
|
+
root: new ioInsightsSampler_1.ioInsightsSampler((settings === null || settings === void 0 ? void 0 : settings.sampling) || [], settings === null || settings === void 0 ? void 0 : settings.defaults, filteringContextGetter, logger),
|
|
76
81
|
});
|
|
77
82
|
const btProvider = (tracerProvider = new sdk_trace_base_1.BasicTracerProvider({
|
|
78
83
|
sampler: typeof sampler === "function" ? sampler(defaultSampler) : defaultSampler,
|
|
@@ -94,13 +99,13 @@ const setTracerProvider = (tracerProvider, sampler, spanProcessors, spanExporter
|
|
|
94
99
|
// url: "http://localhost:4318/v1/traces",
|
|
95
100
|
url: settings.url }))));
|
|
96
101
|
}
|
|
97
|
-
if (console) {
|
|
102
|
+
if (settings === null || settings === void 0 ? void 0 : settings.console) {
|
|
98
103
|
btProvider.addSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(new sdk_trace_base_1.ConsoleSpanExporter()));
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
106
|
// if client has already registered a TracerProvider, this is a no-op
|
|
102
107
|
if (typeof tracerProvider.register === "function") {
|
|
103
|
-
tracerProvider.register(providerRegistrationSettings);
|
|
108
|
+
tracerProvider.register(providerRegistrationSettings || {});
|
|
104
109
|
}
|
|
105
110
|
};
|
|
106
111
|
exports.setTracerProvider = setTracerProvider;
|
|
@@ -202,21 +207,31 @@ const deep_value = function (obj, path) {
|
|
|
202
207
|
exports.deep_value = deep_value;
|
|
203
208
|
// https://stackoverflow.com/a/8817473
|
|
204
209
|
const extractFilteringContextFromArgs = (template, args, that) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
let filteringContext = {};
|
|
211
|
+
if (typeof template.argMapping === "function") {
|
|
212
|
+
filteringContext = Object.assign(Object.assign({}, filteringContext), template.argMapping.apply(null, args));
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
Object.keys(template.argMapping || {}).forEach((keyOrPath) => {
|
|
216
|
+
if (!keyOrPath || !template.argMapping) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const filteringContextKey = template.argMapping[keyOrPath];
|
|
220
|
+
filteringContext[filteringContextKey] = (0, exports.deep_value)(args, keyOrPath);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (typeof template.thisMapping === "function") {
|
|
224
|
+
filteringContext = Object.assign(Object.assign({}, filteringContext), template.thisMapping.apply(null, that));
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
Object.keys(template.thisMapping || {}).forEach((keyOrPath) => {
|
|
228
|
+
if (!keyOrPath || !template.thisMapping) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const filteringContextKey = template.thisMapping[keyOrPath];
|
|
232
|
+
filteringContext[filteringContextKey] = (0, exports.deep_value)(that, keyOrPath);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
220
235
|
return filteringContext;
|
|
221
236
|
};
|
|
222
237
|
exports.extractFilteringContextFromArgs = extractFilteringContextFromArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,kEAQuC;AAEvC,wDAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,kEAQuC;AAEvC,wDAAoD;AAUpD,2DAAuE;AACvE,yEAAqF;AACrF,4DAAyD;AAIlD,MAAM,aAAa,GAAG,CAC3B,KAA6B,EAC7B,OAAwB,EACxB,YAA6C,EAC7C,EAAE;;IACF,IAAI,OAAO,CAAC;IACZ,IAAI,KAAK,EAAE;QACT,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;YAC/B,OAAO,GAAG,IAAI,CAAC;SAChB;aAAM;YACL,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;SACzB;KACF;SAAM;QACL,OAAO,GAAG,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,mCAAI,IAAI,CAAC;KAC7D;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB;AAEK,MAAM,aAAa,GAAG,CAAC,MAAkB,EAAE,gBAAkC,EAAE,MAAc,EAAU,EAAE;IAC9G,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,MAAM,EAAE;QACV,MAAM,SAAS,GAAG,IAAI,8BAAqB,EAAE,CAAC;QAC9C,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC5B;IAED,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAClD,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,E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AC;QACtE,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AA9BW,QAAA,+BAA+B,mCA8B1C;AACF,uEAAuE;AACvE,qDAAqD;AACrD,yEAAyE"}
|
package/dist/types.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface Settings {
|
|
|
35
35
|
*/
|
|
36
36
|
serviceName?: string;
|
|
37
37
|
/**
|
|
38
|
-
* If provided, this value will be added to the metrics and traces service.id attribute,
|
|
38
|
+
* If provided, this value will be added to the metrics and traces service.instance.id attribute,
|
|
39
39
|
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
40
40
|
* a different setting.
|
|
41
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/validation/traces/filter.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACzB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/validation/traces/filter.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACzB,QAAQ,CAAC,MAAkB;QAChC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE;YAC9E,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;SAC3E;QACD,6DAA6D;QAC7D,2DAA2D;IAC7D,CAAC;CACF;AARD,sDAQC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropagationInfo, PropagationInfoCarrier, FilteringContext, WithSpanCallback } from "../../traces/types";
|
|
1
|
+
import { PropagationInfo, PropagationInfoCarrier, FilteringContext, WithSpanCallback, WithSpanOptions } from "../../traces/types";
|
|
2
2
|
export declare class TracesWithSpanValidator {
|
|
3
|
-
validate<T>(source: string, filteringContextOrCallback: FilteringContext | WithSpanCallback<T> | null, propagationInfoOrCallback?: PropagationInfo | PropagationInfoCarrier | WithSpanCallback<T> | null, callback?: WithSpanCallback<T>): void;
|
|
3
|
+
validate<T>(source: string, filteringContextOrCallback: FilteringContext | WithSpanCallback<T> | null, propagationInfoOrCallback?: PropagationInfo | PropagationInfoCarrier | WithSpanCallback<T> | false | null, optionsOrCallback?: WithSpanOptions | WithSpanCallback<T> | null, callback?: WithSpanCallback<T>): void;
|
|
4
4
|
}
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TracesWithSpanValidator = void 0;
|
|
4
4
|
const utils_1 = require("../../traces/utils");
|
|
5
5
|
class TracesWithSpanValidator {
|
|
6
|
-
validate(source, filteringContextOrCallback, propagationInfoOrCallback, callback) {
|
|
6
|
+
validate(source, filteringContextOrCallback, propagationInfoOrCallback, optionsOrCallback, callback) {
|
|
7
7
|
if (!source) {
|
|
8
8
|
throw new Error("Missing required argument 'source' in withSpan(). Expected a string.");
|
|
9
9
|
}
|
|
10
10
|
if (!callback &&
|
|
11
11
|
!(0, utils_1.isFunctionType)(filteringContextOrCallback) &&
|
|
12
|
-
!(0, utils_1.isFunctionType)(propagationInfoOrCallback)
|
|
12
|
+
!(0, utils_1.isFunctionType)(propagationInfoOrCallback) &&
|
|
13
|
+
!(0, utils_1.isFunctionType)(optionsOrCallback)) {
|
|
13
14
|
throw new Error("Missing required argument 'callback' in withSpan(). Expected a function.");
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSpan.js","sourceRoot":"","sources":["../../../src/validation/traces/withSpan.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"withSpan.js","sourceRoot":"","sources":["../../../src/validation/traces/withSpan.ts"],"names":[],"mappings":";;;AAOA,8CAAoD;AAEpD,MAAa,uBAAuB;IAC3B,QAAQ,CACb,MAAc,EACd,0BAAyE,EACzE,yBAAyG,EACzG,iBAAgE,EAChE,QAA8B;QAE9B,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;SACzF;QACD,IACE,CAAC,QAAQ;YACT,CAAC,IAAA,sBAAc,EAAC,0BAA0B,CAAC;YAC3C,CAAC,IAAA,sBAAc,EAAC,yBAAyB,CAAC;YAC1C,CAAC,IAAA,sBAAc,EAAC,iBAAiB,CAAC,EAClC;YACA,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;SAC7F;IACH,CAAC;CACF;AApBD,0DAoBC"}
|