@interopio/otel 0.0.13 → 0.0.14
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.d.ts +1 -2
- package/dist/builder.js +4 -7
- package/dist/builder.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/factory/builder.d.ts +1 -0
- package/dist/metrics/factory/builder.js +10 -0
- package/dist/metrics/factory/builder.js.map +1 -1
- package/dist/metrics/metrics/application/duration.d.ts +23 -3
- package/dist/metrics/metrics/application/duration.js +83 -2
- package/dist/metrics/metrics/application/duration.js.map +1 -1
- package/dist/metrics/metrics/application/durationSoft.d.ts +4 -0
- package/dist/metrics/metrics/application/durationSoft.js +34 -0
- package/dist/metrics/metrics/application/durationSoft.js.map +1 -0
- package/dist/metrics/metrics/base/types.d.ts +1 -1
- package/dist/traces/builder.d.ts +11 -1
- package/dist/traces/builder.js +21 -1
- package/dist/traces/builder.js.map +1 -1
- package/dist/traces/ioInsightsSampler.d.ts +3 -2
- package/dist/traces/ioInsightsSampler.js +10 -5
- package/dist/traces/ioInsightsSampler.js.map +1 -1
- package/dist/traces/manager.d.ts +7 -5
- package/dist/traces/manager.js +83 -51
- package/dist/traces/manager.js.map +1 -1
- package/dist/traces/nullTracesManager.d.ts +3 -3
- package/dist/traces/nullTracesManager.js +35 -13
- package/dist/traces/nullTracesManager.js.map +1 -1
- package/dist/traces/nullTracingState.d.ts +23 -0
- package/dist/traces/nullTracingState.js +52 -0
- package/dist/traces/nullTracingState.js.map +1 -0
- package/dist/traces/tracingState.d.ts +7 -8
- package/dist/traces/tracingState.js +13 -29
- package/dist/traces/tracingState.js.map +1 -1
- package/dist/traces/types.d.ts +205 -25
- package/dist/traces/types.js.map +1 -1
- package/dist/traces/utils/index.d.ts +8 -8
- package/dist/traces/utils/index.js +76 -32
- package/dist/traces/utils/index.js.map +1 -1
- package/dist/validation/metrics/application/duration.d.ts +2 -2
- package/dist/validation/metrics/application/duration.js.map +1 -1
- package/dist/validation/traces/filter.js +5 -3
- package/dist/validation/traces/filter.js.map +1 -1
- package/dist/validation/traces/withSpan.d.ts +1 -1
- package/dist/validation/traces/withSpan.js.map +1 -1
- package/package.json +5 -4
- package/dist/metrics/metrics/application/durationBase.d.ts +0 -22
- package/dist/metrics/metrics/application/durationBase.js +0 -97
- package/dist/metrics/metrics/application/durationBase.js.map +0 -1
package/dist/traces/types.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
1
|
+
import { Attributes, Span, SpanStatus, SpanStatusCode, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
3
2
|
import { Logger } from "../logger/types";
|
|
4
3
|
import { Manager } from "../types";
|
|
4
|
+
import { OTLPExporterNodeConfigBase } from "@opentelemetry/otlp-exporter-base";
|
|
5
5
|
export interface TracesManager extends Manager<TracesSettings> {
|
|
6
|
-
extractTracingPropagationInfo(propagationInfoCarrier: PropagationInfo | PropagationInfoCarrier): PropagationInfo |
|
|
7
|
-
withSpan(source: string, callback: WithSpanCallback): Promise<
|
|
8
|
-
withSpan(source: string, tracingContext: TracingContext, callback: WithSpanCallback): Promise<
|
|
9
|
-
withSpan(source: string, tracingContext: TracingContext, propagationInfo: PropagationInfo | PropagationInfoCarrier, callback: WithSpanCallback): Promise<
|
|
6
|
+
extractTracingPropagationInfo(propagationInfoCarrier: PropagationInfo | PropagationInfoCarrier, deleteProperty?: boolean): PropagationInfo | null;
|
|
7
|
+
withSpan<T>(source: string, callback: WithSpanCallback<T>): Promise<T>;
|
|
8
|
+
withSpan<T>(source: string, tracingContext: TracingContext, callback: WithSpanCallback<T>): Promise<T>;
|
|
9
|
+
withSpan<T>(source: string, tracingContext: TracingContext, propagationInfo: PropagationInfo | PropagationInfoCarrier, callback: WithSpanCallback<T>): Promise<T>;
|
|
10
10
|
}
|
|
11
|
-
export type WithSpanCallback = (tracingState: TracingState) =>
|
|
11
|
+
export type WithSpanCallback<T> = (tracingState: TracingState) => T | Promise<T>;
|
|
12
12
|
export interface PropagationInfo {
|
|
13
13
|
traceparent?: string;
|
|
14
14
|
tracestate?: string;
|
|
@@ -18,21 +18,21 @@ export interface PropagationInfoCarrier {
|
|
|
18
18
|
}
|
|
19
19
|
export interface TracingState {
|
|
20
20
|
enabled: boolean;
|
|
21
|
+
SpanStatusCode?: typeof SpanStatusCode;
|
|
21
22
|
level: keyof typeof Verbosity;
|
|
22
23
|
addData(level: Verbosity | keyof typeof Verbosity, data: AttributeData): Promise<void>;
|
|
23
24
|
source: string;
|
|
24
25
|
id?: string;
|
|
25
|
-
timeoutId?: NodeJS.Timeout;
|
|
26
26
|
endSpan(): Promise<void>;
|
|
27
|
-
span
|
|
27
|
+
span?: Span;
|
|
28
28
|
getPropagationInfo: () => PropagationInfo | null;
|
|
29
29
|
injectPropagationInfo: (carrier: PropagationInfoCarrier & object) => void;
|
|
30
|
-
setStatus?:
|
|
31
|
-
addEvent?:
|
|
30
|
+
setStatus?: (status: SpanStatus) => this;
|
|
31
|
+
addEvent?: (name: string, attributesOrStartTime?: Attributes | TimeInput, startTime?: TimeInput) => this;
|
|
32
32
|
recordException?: Span["recordException"];
|
|
33
33
|
isRecording?: Span["isRecording"];
|
|
34
|
-
updateName?:
|
|
35
|
-
spanContext?: Span["spanContext"];
|
|
34
|
+
updateName?: (name: string) => this;
|
|
35
|
+
spanContext?: Span["spanContext"] | (() => undefined);
|
|
36
36
|
}
|
|
37
37
|
export type AttributeArray = Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
38
38
|
export interface AttributeData {
|
|
@@ -54,37 +54,217 @@ export declare enum Verbosity {
|
|
|
54
54
|
HIGHEST = 6
|
|
55
55
|
}
|
|
56
56
|
export interface Filter {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the source string used for matching spans.
|
|
59
|
+
* Spans match only if their source equals this value, or
|
|
60
|
+
* if their source starts with '<source>.' (e.g. my.api.foo
|
|
61
|
+
* starts with my.api).
|
|
62
|
+
*
|
|
63
|
+
* Start string with "#" for case-insensitive regex match.
|
|
64
|
+
*/
|
|
65
|
+
source?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies the context values used for matching spans.
|
|
68
|
+
* Spans match only if all the values in this object match
|
|
69
|
+
* the context values returned by the context getter callback
|
|
70
|
+
* and the filteringContext config property.
|
|
71
|
+
*
|
|
72
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
73
|
+
*/
|
|
74
|
+
context?: {
|
|
61
75
|
[key: string]: string | number | boolean;
|
|
62
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Whether the matched span will be created or will be a no-op.
|
|
79
|
+
*
|
|
80
|
+
* If not specified, see 'TracesDefaultsSettings'.
|
|
81
|
+
*/
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The attribute verbosity level of matched spans.
|
|
85
|
+
*
|
|
86
|
+
* If not specified, see 'TracesDefaultsSettings'.
|
|
87
|
+
*/
|
|
88
|
+
level?: keyof typeof Verbosity;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the filtering context will be added as span attributes
|
|
91
|
+
* to the matched span.
|
|
92
|
+
*
|
|
93
|
+
* If not specified, see 'TracesDefaultsSettings'.
|
|
94
|
+
*/
|
|
95
|
+
addContextToTrace?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the span's status will be set to OK on completion, if
|
|
98
|
+
* it's still UNSET.
|
|
99
|
+
*
|
|
100
|
+
* If not specified, see 'TracesDefaultsSettings'.
|
|
101
|
+
*/
|
|
102
|
+
autoSetSuccessStatus?: boolean;
|
|
63
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Used for spans that didn't match a Filter or SamplingSettings entry,
|
|
106
|
+
* or if particular property isn't provided in matched entry.
|
|
107
|
+
*/
|
|
64
108
|
export interface TracesDefaultsSettings {
|
|
109
|
+
/**
|
|
110
|
+
* Whether the span will be created or will be a no-op. See 'Filter'.
|
|
111
|
+
*
|
|
112
|
+
* Defaults to 'true'.
|
|
113
|
+
*/
|
|
65
114
|
enabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Default span attribute verbosity level. See 'Filter'.
|
|
117
|
+
*
|
|
118
|
+
* Defaults to 'INFO'.
|
|
119
|
+
*/
|
|
66
120
|
level?: keyof typeof Verbosity;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the filtering context will be added as span attributes
|
|
123
|
+
* to the span. See 'Filter'.
|
|
124
|
+
*
|
|
125
|
+
* Defaults to 'true'.
|
|
126
|
+
*/
|
|
127
|
+
addContextToTrace?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the span's status will be set to OK on completion, if
|
|
130
|
+
* it's still UNSET. See 'Filter'.
|
|
131
|
+
*
|
|
132
|
+
* Defaults to 'false'.
|
|
133
|
+
*/
|
|
134
|
+
autoSetSuccessStatus?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Default sampling setting/probability. See 'SamplingSettings'.
|
|
137
|
+
*
|
|
138
|
+
* Defaults to 'true'.
|
|
139
|
+
*/
|
|
67
140
|
sample?: number | boolean;
|
|
68
141
|
}
|
|
69
142
|
export interface TracesSettings {
|
|
143
|
+
/**
|
|
144
|
+
* Whether tracing functionality is enabled.
|
|
145
|
+
* If disabled, API is still usable, but methods are no-ops.
|
|
146
|
+
*/
|
|
70
147
|
enabled: boolean;
|
|
71
|
-
|
|
72
|
-
|
|
148
|
+
/**
|
|
149
|
+
* If provided, this value will be added to the span attributes
|
|
150
|
+
* and to the span filtering context (see 'filters').
|
|
151
|
+
*/
|
|
152
|
+
platformVersion?: string;
|
|
153
|
+
/**
|
|
154
|
+
* If provided, these values will be added to the span attributes
|
|
155
|
+
* and to the span filtering context (see 'filters').
|
|
156
|
+
*/
|
|
157
|
+
filteringContext?: {
|
|
158
|
+
[key: string]: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Array of filter entries used to determine whether
|
|
162
|
+
* a particular operation will create a tracing span, and
|
|
163
|
+
* what verbosity level will apply to attributes added
|
|
164
|
+
* to that span.
|
|
165
|
+
*
|
|
166
|
+
* If no matching filter entry is found,
|
|
167
|
+
* the settings from 'default' are used.
|
|
168
|
+
*/
|
|
73
169
|
filters?: Filter[];
|
|
74
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Array of sampling setting entries used to determine
|
|
172
|
+
* whether a span will be sampled.
|
|
173
|
+
*
|
|
174
|
+
* If no matching sampling setting entry is found,
|
|
175
|
+
* the settings from 'default' are used.
|
|
176
|
+
*/
|
|
177
|
+
sampling?: SamplingSettings[];
|
|
178
|
+
/**
|
|
179
|
+
* Default settings if appropriate entries aren't found
|
|
180
|
+
* in 'filters' and 'sampling' collections.
|
|
181
|
+
*/
|
|
75
182
|
default?: TracesDefaultsSettings;
|
|
76
|
-
|
|
183
|
+
/**
|
|
184
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
185
|
+
* it will initialize its own.
|
|
186
|
+
*
|
|
187
|
+
* If 'url' is specified, TracerProvider will
|
|
188
|
+
* have an OTLPTraceExporter using this destination URL.
|
|
189
|
+
*/
|
|
190
|
+
url?: string;
|
|
191
|
+
/**
|
|
192
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
193
|
+
* it will initialize its own.
|
|
194
|
+
*
|
|
195
|
+
* If 'url' is specified, TracerProvider will
|
|
196
|
+
* have an OTLPTraceExporter with 'url' as detination URL and
|
|
197
|
+
* 'otlpExporterConfig' as additional * config.
|
|
198
|
+
*/
|
|
199
|
+
otlpExporterConfig?: OTLPExporterNodeConfigBase;
|
|
200
|
+
/**
|
|
201
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
202
|
+
* it will initialize its own.
|
|
203
|
+
*
|
|
204
|
+
* If 'console' is 'true', TracerProvider will
|
|
205
|
+
* have a ConsoleTraceExporter.
|
|
206
|
+
*/
|
|
207
|
+
console?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
210
|
+
* it will initialize its own, with this provided service.name
|
|
211
|
+
* attribute.
|
|
212
|
+
*/
|
|
77
213
|
serviceName?: string;
|
|
78
|
-
|
|
79
|
-
|
|
214
|
+
/**
|
|
215
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
216
|
+
* it will initialize its own, with this provided service.instance.id
|
|
217
|
+
* attribute.
|
|
218
|
+
*/
|
|
219
|
+
serviceId?: string;
|
|
220
|
+
/**
|
|
221
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
222
|
+
* it will initialize its own, with this provided service.version
|
|
223
|
+
* attribute.
|
|
224
|
+
*/
|
|
225
|
+
serviceVersion?: string;
|
|
226
|
+
/**
|
|
227
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
228
|
+
* it will initialize its own, with this provided user.id
|
|
229
|
+
* attribute.
|
|
230
|
+
*/
|
|
231
|
+
userId?: string;
|
|
80
232
|
}
|
|
81
233
|
export interface SamplingSettings {
|
|
234
|
+
/**
|
|
235
|
+
* Span name to determine if span will match this sampling setting entry.
|
|
236
|
+
* Start string with "#" for case-insensitive regex match
|
|
237
|
+
*/
|
|
238
|
+
name?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Span attributes that determine if span will match this sampling setting entry.
|
|
241
|
+
* Useful e.g. for checking otel.library.name/otel.scope.name attribute to filter
|
|
242
|
+
* auto-instrumentated spans.
|
|
243
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
244
|
+
*/
|
|
82
245
|
attributes?: {
|
|
83
|
-
[key: string]: string | number;
|
|
246
|
+
[key: string]: string | number | boolean;
|
|
84
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Context values that determine if span will match this sampling setting entry.
|
|
250
|
+
* 'Context' here refers to the object returned from the 'contextGetter' callback at the
|
|
251
|
+
* time of sampling, not the OTEL context concept.
|
|
252
|
+
* This is useful for sampling based on the current client environment - current user, application,
|
|
253
|
+
* server node, time of day, etc.
|
|
254
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
255
|
+
*/
|
|
85
256
|
context?: {
|
|
86
|
-
[key: string]: string | number;
|
|
257
|
+
[key: string]: string | number | boolean;
|
|
87
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Probability that span will be sampled, based on its traceId
|
|
261
|
+
* Spans from the same trace will always either all be sampled, or none will,
|
|
262
|
+
* provided they all have the same sampling probability.
|
|
263
|
+
* If true: will be sampled
|
|
264
|
+
* If false: will not be sampled
|
|
265
|
+
* If number between 0 and 1: has this probability of being sampled.
|
|
266
|
+
* Precision: 3 decimal digits
|
|
267
|
+
*/
|
|
88
268
|
sample: number | boolean;
|
|
89
269
|
}
|
|
90
270
|
export interface TracesManagerBuilder {
|
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":";;;AAwEA,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;IACN,qDAAU,CAAA;IACV,2CAAK,CAAA;IACL,yCAAI,CAAA;IACJ,yCAAI,CAAA;IACJ,+CAAO,CAAA;AACT,CAAC,EARW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAQpB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Sampler, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
|
+
import { ContextManager, TracerProvider } from "@opentelemetry/api";
|
|
3
|
+
import { AttributeData, Filter, TracesDefaultsSettings, TracesSettings, TracingContext } from "../types";
|
|
3
4
|
import { Span } from "@opentelemetry/api";
|
|
4
|
-
|
|
5
|
+
import { Logger } from "../../logger/types";
|
|
6
|
+
export declare const isSpanEnabled: (match: Filter | undefined, defaultMatch: TracesDefaultsSettings | undefined) => boolean | undefined;
|
|
5
7
|
export declare const isFilterMatch: (filter: Filter, context: TracingContext, source: string) => boolean;
|
|
6
|
-
export declare const setTracerProvider: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
console?: boolean;
|
|
10
|
-
}) => void;
|
|
8
|
+
export declare const setTracerProvider: (tracerProvider?: TracerProvider, sampler?: ((defaultSampler: Sampler) => Sampler) | undefined, spanProcessors?: SpanProcessor[], spanExporters?: SpanExporter[], providerRegistrationSettings?: {
|
|
9
|
+
contextManager?: ContextManager;
|
|
10
|
+
}, contextGetter?: () => TracingContext, logger?: Logger, settings?: TracesSettings) => void;
|
|
11
11
|
export declare const saveDataInAttribute: (data: AttributeData, otelSpan: Span) => void;
|
|
12
12
|
export declare const replacePlaceHolders: (settings: any, context: any) => any;
|
|
13
13
|
export declare const isFunctionType: (variable: unknown) => boolean;
|
|
@@ -7,6 +7,7 @@ const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
|
7
7
|
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
|
+
const ioInsightsSampler_1 = require("../ioInsightsSampler");
|
|
10
11
|
const isSpanEnabled = (match, defaultMatch) => {
|
|
11
12
|
let enabled;
|
|
12
13
|
if (match) {
|
|
@@ -21,7 +22,7 @@ const isSpanEnabled = (match, defaultMatch) => {
|
|
|
21
22
|
enabled = defaultMatch.enabled;
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
enabled =
|
|
25
|
+
enabled = true;
|
|
25
26
|
}
|
|
26
27
|
return enabled;
|
|
27
28
|
};
|
|
@@ -32,7 +33,12 @@ const isFilterMatch = (filter, context, source) => {
|
|
|
32
33
|
const validator = new filter_1.TracesFilterValidator();
|
|
33
34
|
validator.validate(filter);
|
|
34
35
|
}
|
|
35
|
-
if (filter.source &&
|
|
36
|
+
if (filter.source && filter.source.startsWith("#")) {
|
|
37
|
+
if (!new RegExp(filter.source.substring(1), "i").test(source)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (filter.source && !source.startsWith(filter.source + ".") && source !== filter.source) {
|
|
36
42
|
return false;
|
|
37
43
|
}
|
|
38
44
|
if (!filter.context) {
|
|
@@ -47,31 +53,45 @@ const isFilterMatch = (filter, context, source) => {
|
|
|
47
53
|
return isMatch;
|
|
48
54
|
};
|
|
49
55
|
exports.isFilterMatch = isFilterMatch;
|
|
50
|
-
const setTracerProvider = (
|
|
51
|
-
if (!
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const setTracerProvider = (tracerProvider, sampler, spanProcessors, spanExporters, providerRegistrationSettings, contextGetter, logger, settings) => {
|
|
57
|
+
if (!tracerProvider && !settings) {
|
|
58
|
+
throw new Error("Required arguments not provided");
|
|
59
|
+
}
|
|
60
|
+
if (!tracerProvider) {
|
|
61
|
+
const defaultSampler = new sdk_trace_base_1.ParentBasedSampler({
|
|
62
|
+
root: new ioInsightsSampler_1.ioInsightsSampler((settings === null || settings === void 0 ? void 0 : settings.sampling) || [], settings === null || settings === void 0 ? void 0 : settings.default, contextGetter, logger)
|
|
63
|
+
});
|
|
64
|
+
const btProvider = (tracerProvider = new sdk_trace_base_1.BasicTracerProvider({
|
|
65
|
+
sampler: typeof sampler === "function" ? sampler(defaultSampler) : defaultSampler,
|
|
66
|
+
resource: resources_1.Resource.default().merge(new resources_1.Resource({
|
|
58
67
|
"service.name": `${settings === null || settings === void 0 ? void 0 : settings.serviceName}`,
|
|
59
|
-
|
|
68
|
+
"service.instance.id": `${settings === null || settings === void 0 ? void 0 : settings.serviceId}`,
|
|
69
|
+
"service.version": `${settings === null || settings === void 0 ? void 0 : settings.serviceVersion}`,
|
|
70
|
+
"user.id": `${settings === null || settings === void 0 ? void 0 : settings.userId}`
|
|
71
|
+
})),
|
|
60
72
|
}));
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
if (spanProcessors) {
|
|
74
|
+
for (const spanProcessor of spanProcessors) {
|
|
75
|
+
btProvider.addSpanProcessor(spanProcessor);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (spanExporters) {
|
|
79
|
+
for (const spanExporter of spanExporters) {
|
|
80
|
+
btProvider.addSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(spanExporter));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (settings === null || settings === void 0 ? void 0 : settings.url) {
|
|
84
|
+
btProvider.addSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(new exporter_trace_otlp_http_1.OTLPTraceExporter(Object.assign(Object.assign({}, settings.otlpExporterConfig), {
|
|
67
85
|
// url: "https://jaeger-otlp-http.interop.io/v1/traces",
|
|
68
86
|
// url: "http://localhost:4318/v1/traces",
|
|
69
|
-
url: settings
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
url: settings.url }))));
|
|
88
|
+
}
|
|
89
|
+
if (console) {
|
|
90
|
+
btProvider.addSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(new sdk_trace_base_1.ConsoleSpanExporter()));
|
|
91
|
+
}
|
|
72
92
|
}
|
|
73
|
-
if (
|
|
74
|
-
|
|
93
|
+
if (tracerProvider.register && providerRegistrationSettings) {
|
|
94
|
+
tracerProvider.register(providerRegistrationSettings);
|
|
75
95
|
}
|
|
76
96
|
};
|
|
77
97
|
exports.setTracerProvider = setTracerProvider;
|
|
@@ -85,26 +105,50 @@ const isAttributeArray = (value) => {
|
|
|
85
105
|
typeof item === "number" ||
|
|
86
106
|
typeof item === "boolean");
|
|
87
107
|
};
|
|
108
|
+
// TODO vnikolov: test this
|
|
88
109
|
const saveDataInAttribute = (data, otelSpan) => {
|
|
89
110
|
const validator = new attributeData_1.TracesAttributeDataValidator();
|
|
90
111
|
validator.validate(data);
|
|
91
112
|
for (const [key, value] of Object.entries(data)) {
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
otelSpan.setAttribute(key, value);
|
|
113
|
+
const otelValues = getOTELData(key, value);
|
|
114
|
+
for (const [otelKey, otelValue] of otelValues) {
|
|
115
|
+
otelSpan.setAttribute(otelKey, otelValue);
|
|
96
116
|
}
|
|
97
|
-
else if (isObject) {
|
|
98
|
-
otelSpan.setAttribute(key, JSON.stringify(value));
|
|
99
|
-
}
|
|
100
|
-
// vnikolov todo: what about symbol, bigint?
|
|
101
117
|
}
|
|
102
118
|
};
|
|
103
119
|
exports.saveDataInAttribute = saveDataInAttribute;
|
|
120
|
+
const getOTELData = (key, value) => {
|
|
121
|
+
const isObject = Boolean(value && typeof value === "object");
|
|
122
|
+
const isValidPrimitiveValue = typeof value === "number" || typeof value === "string" || typeof value === "boolean";
|
|
123
|
+
if (isValidPrimitiveValue) {
|
|
124
|
+
return [[key, value]];
|
|
125
|
+
}
|
|
126
|
+
if (isAttributeArray(value)) {
|
|
127
|
+
return [[key, value]].concat(flatten(key, value));
|
|
128
|
+
}
|
|
129
|
+
else if (isObject) {
|
|
130
|
+
return flatten(key, value);
|
|
131
|
+
}
|
|
132
|
+
else if (value) {
|
|
133
|
+
return [[key, value + ""]];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const flatten = (key, obj) => {
|
|
140
|
+
const toReturn = [];
|
|
141
|
+
for (const [key2, val2] of Object.entries(obj)) {
|
|
142
|
+
for (const [key3, val3] of getOTELData(key2, val2)) {
|
|
143
|
+
toReturn.push([key + "." + key3, val3]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return toReturn;
|
|
147
|
+
};
|
|
104
148
|
const replacePlaceHolders = (settings, context) => {
|
|
105
|
-
const regex = /
|
|
149
|
+
const regex = /[$][a-zA-Z0-9]+/g;
|
|
106
150
|
const toParse = JSON.stringify(settings).replace(regex, (m) => {
|
|
107
|
-
const key = m.replace(
|
|
151
|
+
const key = m.replace(/^[$]/, "");
|
|
108
152
|
const dollarVar = context[key];
|
|
109
153
|
if (dollarVar !== undefined) {
|
|
110
154
|
return JSON.stringify(dollarVar).replace(/^"/, "").replace(/"$/, "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,kEAQuC;AAEvC,wDAAoD;AAGpD,2DAAuE;AACvE,yEAAqF;AACrF,4DAAyD;AAGlD,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,YAAgD,EAAE,EAAE;IAC3G,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,IAAI,YAAY,EAAE;QACvB,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;KAChC;SAAM;QACL,OAAO,GAAG,IAAI,CAAC;KAChB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAdW,QAAA,aAAa,iBAcxB;AAEK,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,OAAuB,EAAE,MAAc,EAAE,EAAE;IACvF,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,MAAM,EAAE;QACV,MAAM,SAAS,GAAG,IAAI,8BAAqB,EAAE,CAAC;QAC9C,SA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CAAC,CAAA;AAEM,MAAM,mBAAmB,GAAG,CAAC,QAAa,EAAE,OAAY,EAAE,EAAE;IACjE,MAAM,KAAK,GAAG,kBAAkB,CAAC;IAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAE/B,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACtE;QAED,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B;AAEK,MAAM,cAAc,GAAG,CAAC,QAAiB,EAAE,EAAE,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC;AAAvE,QAAA,cAAc,kBAAyD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApplicationDurationMetric } from "../../../metrics/metrics/application/duration";
|
|
2
2
|
import { InstanceFocusedHandlerArgs } from "../../../metrics/dependencies/types";
|
|
3
3
|
export declare class ApplicationDurationMetricValidator {
|
|
4
|
-
validate(metric:
|
|
4
|
+
validate(metric: ApplicationDurationMetric): void;
|
|
5
5
|
validateFocusChanged(args: InstanceFocusedHandlerArgs): void;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../../src/validation/metrics/application/duration.ts"],"names":[],"mappings":";;;AAEA,+CAA4C;AAE5C,MAAa,kCAAkC;IACpC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../../src/validation/metrics/application/duration.ts"],"names":[],"mappings":";;;AAEA,+CAA4C;AAE5C,MAAa,kCAAkC;IACpC,QAAQ,CAAC,MAAiC;QAC7C,qBAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACnD,qBAAS,CAAC,sBAAsB,CAAC,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IAC1F,CAAC;IAEM,oBAAoB,CAAC,IAAgC;QACxD,qBAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,qBAAS,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QAClE,qBAAS,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;CACJ;AAXD,gFAWC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TracesFilterValidator = void 0;
|
|
4
|
-
const validator_1 = require("../validator");
|
|
5
4
|
class TracesFilterValidator {
|
|
6
5
|
validate(filter) {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (!filter.source && (!filter.context || !Object.keys(filter.context).length)) {
|
|
7
|
+
throw new Error("At least one of source / context need to be specified.");
|
|
8
|
+
}
|
|
9
|
+
// Validator.throwIfNullOrUndefined(filter.source, "source");
|
|
10
|
+
// Validator.throwIfNullOrUndefined(filter.level, "level");
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
exports.TracesFilterValidator = TracesFilterValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/validation/traces/filter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/validation/traces/filter.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACzB,QAAQ,CAAC,MAAc;QAC5B,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
1
|
import { PropagationInfo, PropagationInfoCarrier, TracingContext, WithSpanCallback } from "../../traces/types";
|
|
2
2
|
export declare class TracesWithSpanValidator {
|
|
3
|
-
validate(source: string, tracingContextOrCallback: TracingContext | WithSpanCallback
|
|
3
|
+
validate<T>(source: string, tracingContextOrCallback: TracingContext | WithSpanCallback<T>, propagationInfoOrCallback?: PropagationInfo | PropagationInfoCarrier | WithSpanCallback<T>, callback?: WithSpanCallback<T>): void;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSpan.js","sourceRoot":"","sources":["../../../src/validation/traces/withSpan.ts"],"names":[],"mappings":";;;AAMA,8CAAoD;AAEpD,MAAa,uBAAuB;IAC3B,QAAQ,CACb,MAAc,EACd,
|
|
1
|
+
{"version":3,"file":"withSpan.js","sourceRoot":"","sources":["../../../src/validation/traces/withSpan.ts"],"names":[],"mappings":";;;AAMA,8CAAoD;AAEpD,MAAa,uBAAuB;IAC3B,QAAQ,CACb,MAAc,EACd,wBAA8D,EAC9D,yBAA0F,EAC1F,QAA8B;QAE9B,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;SACzF;QACD,IACE,CAAC,QAAQ;YACT,CAAC,IAAA,sBAAc,EAAC,wBAAwB,CAAC;YACzC,CAAC,IAAA,sBAAc,EAAC,yBAAyB,CAAC,EAC1C;YACA,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;SAC7F;IACH,CAAC;CACF;AAlBD,0DAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/otel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "otel library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"@opentelemetry/api": "^1.7.0",
|
|
29
29
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.48.0",
|
|
30
30
|
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
|
|
31
|
-
"@opentelemetry/sdk-metrics": "^1.21.0"
|
|
31
|
+
"@opentelemetry/sdk-metrics": "^1.21.0",
|
|
32
|
+
"@opentelemetry/sdk-trace-base": "^1.26.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/chai": "^4.2.14",
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
"@typescript-eslint/parser": "^7.3.1",
|
|
39
40
|
"chai": "^4.3.0",
|
|
40
41
|
"eslint": "^8.57.0",
|
|
42
|
+
"log4js": "^6.9.1",
|
|
41
43
|
"mocha": "^10.2.0",
|
|
42
44
|
"rimraf": "^5.0.5",
|
|
43
|
-
"typescript": "^4.2.4"
|
|
44
|
-
"log4js": "^6.9.1"
|
|
45
|
+
"typescript": "^4.2.4"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Meter } from "@opentelemetry/api";
|
|
2
|
-
import { InternalMetricSettings, ApplicationMetricData } from "../base/types";
|
|
3
|
-
import { ObservableMetricBase } from "../base/observable";
|
|
4
|
-
import { Logger } from "../../../logger/types";
|
|
5
|
-
import { InstanceFocusedHandler } from "../../dependencies/types";
|
|
6
|
-
export declare abstract class ApplicationDurationMetricBase extends ObservableMetricBase<ApplicationMetricData> {
|
|
7
|
-
instanceFocusHandler: InstanceFocusedHandler;
|
|
8
|
-
private focusedTimes;
|
|
9
|
-
private currentFocusedApp?;
|
|
10
|
-
private unInstanceFocusHandler;
|
|
11
|
-
private validator;
|
|
12
|
-
constructor(settings: InternalMetricSettings, meter: Meter, logger: Logger, instanceFocusHandler: InstanceFocusedHandler);
|
|
13
|
-
protected subscribeCore(): Promise<void>;
|
|
14
|
-
protected observeCore(): Promise<void>;
|
|
15
|
-
protected unsubscribeCore(): Promise<void>;
|
|
16
|
-
protected abstract sendMetric(focusedPeriods: number[], data: ApplicationMetricData): void;
|
|
17
|
-
private handleFocusChanged;
|
|
18
|
-
private handleFocusChangedCore;
|
|
19
|
-
private handleGotFocus;
|
|
20
|
-
private handleLostFocus;
|
|
21
|
-
private addFocusLostEventCore;
|
|
22
|
-
}
|