@interopio/otel 0.0.122 → 0.0.124
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/traces/ParentOpSpanProcessor.d.ts +10 -0
- package/dist/traces/ParentOpSpanProcessor.js +28 -0
- package/dist/traces/ParentOpSpanProcessor.js.map +1 -0
- package/dist/traces/utils/index.js +8 -5
- package/dist/traces/utils/index.js.map +1 -1
- package/insights.d.ts +727 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "@opentelemetry/api";
|
|
2
|
+
import { Span, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
3
|
+
export declare class ParentOpSpanProcessor implements SpanProcessor {
|
|
4
|
+
private _innerProcessor;
|
|
5
|
+
constructor(innerProcessor: SpanProcessor);
|
|
6
|
+
onStart(span: Span, parentContext: Context): void;
|
|
7
|
+
onEnd(span: Span): void;
|
|
8
|
+
forceFlush(): Promise<void>;
|
|
9
|
+
shutdown(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParentOpSpanProcessor = void 0;
|
|
4
|
+
const { context, trace } = require('@opentelemetry/api');
|
|
5
|
+
class ParentOpSpanProcessor {
|
|
6
|
+
constructor(innerProcessor) {
|
|
7
|
+
this._innerProcessor = innerProcessor;
|
|
8
|
+
}
|
|
9
|
+
// onStart(span, parentContext) in recent SDKs receives the active context
|
|
10
|
+
onStart(span, parentContext) {
|
|
11
|
+
try {
|
|
12
|
+
const parentSpan = trace.getSpan(parentContext !== null && parentContext !== void 0 ? parentContext : context.active());
|
|
13
|
+
if (parentSpan && parentSpan.spanContext && parentSpan.spanContext().isValid) {
|
|
14
|
+
// Write the parent operation name onto the CHILD span
|
|
15
|
+
span.setAttribute('parent.operation', parentSpan.name);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (_) { /* ignore */ }
|
|
19
|
+
this._innerProcessor.onStart(span, parentContext);
|
|
20
|
+
}
|
|
21
|
+
onEnd(span) {
|
|
22
|
+
this._innerProcessor.onEnd(span);
|
|
23
|
+
}
|
|
24
|
+
forceFlush() { return this._innerProcessor.forceFlush(); }
|
|
25
|
+
shutdown() { return this._innerProcessor.shutdown(); }
|
|
26
|
+
}
|
|
27
|
+
exports.ParentOpSpanProcessor = ParentOpSpanProcessor;
|
|
28
|
+
//# sourceMappingURL=ParentOpSpanProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParentOpSpanProcessor.js","sourceRoot":"","sources":["../../src/traces/ParentOpSpanProcessor.ts"],"names":[],"mappings":";;;AAEA,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEzD,MAAa,qBAAqB;IAE9B,YAAY,cAA6B;QACrC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAC1C,CAAC;IAED,0EAA0E;IAC1E,OAAO,CAAC,IAAU,EAAE,aAAsB;QACtC,IAAI;YACA,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YACpE,IAAI,UAAU,IAAI,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE;gBAC1E,sDAAsD;gBACtD,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;aAC1D;SACJ;QAAC,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE;QAC5B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,IAAU;QACZ,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,UAAU,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC1D,QAAQ,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;CACzD;AAvBD,sDAuBC"}
|
|
@@ -13,6 +13,7 @@ const otelUtils_1 = require("../../utils/otelUtils");
|
|
|
13
13
|
const core_1 = require("@opentelemetry/core");
|
|
14
14
|
const durationFilterProcessor_1 = require("../durationFilterProcessor");
|
|
15
15
|
const container_1 = require("../../container");
|
|
16
|
+
const ParentOpSpanProcessor_1 = require("../ParentOpSpanProcessor");
|
|
16
17
|
const isSpanEnabled = (match, options, defaultMatch) => {
|
|
17
18
|
var _a, _b;
|
|
18
19
|
let enabled;
|
|
@@ -135,21 +136,23 @@ const setTracerProvider = (contextManager, propagator, tracerProvider, sampler,
|
|
|
135
136
|
const spanProcessorsArray = [];
|
|
136
137
|
if (spanProcessors) {
|
|
137
138
|
for (const spanProcessor of spanProcessors) {
|
|
138
|
-
spanProcessorsArray.push(new durationFilterProcessor_1.DurationFilterProcessor(spanProcessor));
|
|
139
|
+
spanProcessorsArray.push(new ParentOpSpanProcessor_1.ParentOpSpanProcessor(new durationFilterProcessor_1.DurationFilterProcessor(spanProcessor)));
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
if (spanExporters) {
|
|
142
143
|
for (const spanExporter of spanExporters) {
|
|
143
|
-
spanProcessorsArray.push(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(spanExporter, settings === null || settings === void 0 ? void 0 : settings.batchSpanProcessorConfig)));
|
|
144
|
+
spanProcessorsArray.push(new ParentOpSpanProcessor_1.ParentOpSpanProcessor(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(spanExporter, settings === null || settings === void 0 ? void 0 : settings.batchSpanProcessorConfig))));
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
if (settings === null || settings === void 0 ? void 0 : settings.url) {
|
|
147
|
-
spanProcessorsArray.push(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(new exporter_trace_otlp_http_1.OTLPTraceExporter(Object.assign(Object.assign({}, settings.otlpExporterConfig), { url: settings.url, headers: Object.assign(Object.assign({}, container_1.Container.errorless(otelSettings === null || otelSettings === void 0 ? void 0 : otelSettings.headers)), container_1.Container.errorless(settings.headers)) })), settings === null || settings === void 0 ? void 0 : settings.batchSpanProcessorConfig)));
|
|
148
|
+
spanProcessorsArray.push(new ParentOpSpanProcessor_1.ParentOpSpanProcessor(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(new exporter_trace_otlp_http_1.OTLPTraceExporter(Object.assign(Object.assign({}, settings.otlpExporterConfig), { url: settings.url, headers: Object.assign(Object.assign({}, container_1.Container.errorless(otelSettings === null || otelSettings === void 0 ? void 0 : otelSettings.headers)), container_1.Container.errorless(settings.headers)) })), settings === null || settings === void 0 ? void 0 : settings.batchSpanProcessorConfig))));
|
|
148
149
|
}
|
|
149
150
|
if (settings === null || settings === void 0 ? void 0 : settings.console) {
|
|
150
|
-
spanProcessorsArray.push(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(new sdk_trace_base_1.ConsoleSpanExporter())));
|
|
151
|
+
spanProcessorsArray.push(new ParentOpSpanProcessor_1.ParentOpSpanProcessor(new durationFilterProcessor_1.DurationFilterProcessor(new sdk_trace_base_1.BatchSpanProcessor(new sdk_trace_base_1.ConsoleSpanExporter()))));
|
|
151
152
|
}
|
|
152
|
-
tracerProvider = new sdk_trace_base_1.BasicTracerProvider(Object.assign({ sampler: typeof sampler === "function" ?
|
|
153
|
+
tracerProvider = new sdk_trace_base_1.BasicTracerProvider(Object.assign({ sampler: typeof sampler === "function" ?
|
|
154
|
+
container_1.Container.errorless(() => sampler(defaultSampler), defaultSampler) :
|
|
155
|
+
defaultSampler, resource: (0, resources_1.resourceFromAttributes)((_a = container_1.Container.errorless(settings === null || settings === void 0 ? void 0 : settings.additionalResourceAttributes)) !== null && _a !== void 0 ? _a : {}), spanProcessors: spanProcessorsArray }, settings === null || settings === void 0 ? void 0 : settings.tracerProviderConfig));
|
|
153
156
|
}
|
|
154
157
|
api_1.trace.setGlobalTracerProvider(tracerProvider);
|
|
155
158
|
if (contextManager) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,kEAQuC;AACvC,4CAAoH;AACpH,wDAA4E;AAQ5E,2DAAuE;AACvE,yEAAqF;AACrF,4DAAyD;AAGzD,qDAAoD;AACpD,8CAAgE;AAChE,wEAAqE;AACrE,+CAA4C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sFAA4E;AAC5E,kEAQuC;AACvC,4CAAoH;AACpH,wDAA4E;AAQ5E,2DAAuE;AACvE,yEAAqF;AACrF,4DAAyD;AAGzD,qDAAoD;AACpD,8CAAgE;AAChE,wEAAqE;AACrE,+CAA4C;AAC5C,oEAAiE;AAE1D,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,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AAE;gBACtC,OAAO;aACR;YACD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAC3D,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;gBACzB,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAnCW,QAAA,+BAA+B,mCAmC1C;AACF,uEAAuE;AACvE,qDAAqD;AACrD,yEAAyE"}
|
package/insights.d.ts
ADDED
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable max-lines */
|
|
3
|
+
import {
|
|
4
|
+
Attributes,
|
|
5
|
+
Context,
|
|
6
|
+
ContextManager,
|
|
7
|
+
Sampler,
|
|
8
|
+
Span,
|
|
9
|
+
SpanOptions,
|
|
10
|
+
SpanStatus,
|
|
11
|
+
TextMapPropagator,
|
|
12
|
+
TimeInput,
|
|
13
|
+
TracerProvider,
|
|
14
|
+
} from "@opentelemetry/api";
|
|
15
|
+
import { UserInteractionInstrumentationConfig as UserInteractionInstrumentationConfigBase } from "@opentelemetry/instrumentation-user-interaction";
|
|
16
|
+
import { MetricsSettings } from "./src/metrics/settings/types";
|
|
17
|
+
|
|
18
|
+
import { LoggerProvider, LogRecord } from "@opentelemetry/api-logs";
|
|
19
|
+
import {
|
|
20
|
+
OTLPExporterConfigBase,
|
|
21
|
+
OTLPExporterNodeConfigBase,
|
|
22
|
+
} from "@opentelemetry/otlp-exporter-base";
|
|
23
|
+
import {
|
|
24
|
+
BufferConfig,
|
|
25
|
+
SpanExporter,
|
|
26
|
+
SpanProcessor,
|
|
27
|
+
TracerConfig,
|
|
28
|
+
} from "@opentelemetry/sdk-trace-base";
|
|
29
|
+
import { DocumentLoadInstrumentationConfig } from "@opentelemetry/instrumentation-document-load";
|
|
30
|
+
import { FetchInstrumentationConfig } from "@opentelemetry/instrumentation-fetch";
|
|
31
|
+
import { XMLHttpRequestInstrumentationConfig } from "@opentelemetry/instrumentation-xml-http-request";
|
|
32
|
+
import {
|
|
33
|
+
LoggerProviderConfig,
|
|
34
|
+
LogRecordExporter,
|
|
35
|
+
LogRecordProcessor,
|
|
36
|
+
} from "@opentelemetry/sdk-logs";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @docname Insights
|
|
40
|
+
*
|
|
41
|
+
* @intro
|
|
42
|
+
* io.Insights API.
|
|
43
|
+
*/
|
|
44
|
+
export namespace IOConnectInsights {
|
|
45
|
+
export interface API extends Manager<Settings> {
|
|
46
|
+
/**
|
|
47
|
+
* io.insights.metrics
|
|
48
|
+
*/
|
|
49
|
+
metrics: MetricsManager;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* io.insights.traces
|
|
53
|
+
*/
|
|
54
|
+
traces: TracesManager;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* io.insights.logs
|
|
58
|
+
*/
|
|
59
|
+
logs: LogsManager;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Metrics API.
|
|
64
|
+
*/
|
|
65
|
+
export interface MetricsManager extends Manager<MetricsSettings> {
|
|
66
|
+
get(type: MetricType): Metric | undefined;
|
|
67
|
+
getFromSettings(settings: MetricSettings): Metric | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// /**
|
|
71
|
+
// * Traces API.
|
|
72
|
+
// */
|
|
73
|
+
export interface TracesManager extends Manager<TracesSettings> {
|
|
74
|
+
currentTracingState: TracingState | null;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Called by the application to signify that its startup has completed
|
|
78
|
+
* and no further spans should be nested under the startup trace.
|
|
79
|
+
*/
|
|
80
|
+
startupTraceFinished?: () => void;
|
|
81
|
+
setStartupTraceFinished(startupTraceFinished: () => void): void;
|
|
82
|
+
|
|
83
|
+
withSpan<T>(source: string, callback: WithSpanCallback<T>): T;
|
|
84
|
+
|
|
85
|
+
withSpan<T>(
|
|
86
|
+
source: string,
|
|
87
|
+
filteringContext: FilteringContext,
|
|
88
|
+
callback: WithSpanCallback<T>
|
|
89
|
+
): T;
|
|
90
|
+
|
|
91
|
+
withSpan<T>(
|
|
92
|
+
source: string,
|
|
93
|
+
filteringContext: FilteringContext,
|
|
94
|
+
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
95
|
+
callback: WithSpanCallback<T>
|
|
96
|
+
): T;
|
|
97
|
+
|
|
98
|
+
withSpan<T>(
|
|
99
|
+
source: string,
|
|
100
|
+
filteringContext: FilteringContext,
|
|
101
|
+
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
102
|
+
options: WithSpanOptions | null,
|
|
103
|
+
callback: WithSpanCallback<T>
|
|
104
|
+
): T;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface LogsManager extends Manager<LogsSettings> {
|
|
108
|
+
emit(logRecord: LogRecord): Promise<void> | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface Manager<TSettings> {
|
|
112
|
+
settings: TSettings;
|
|
113
|
+
started: boolean;
|
|
114
|
+
|
|
115
|
+
start(): Promise<void>;
|
|
116
|
+
stop(): Promise<void>;
|
|
117
|
+
waitForFinalExport(timeoutMs?: number): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface Settings {
|
|
121
|
+
/**
|
|
122
|
+
* Whether library is enabled.
|
|
123
|
+
* If disabled, API is still usable, but methods are no-ops.
|
|
124
|
+
*/
|
|
125
|
+
enabled: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Interval in milliseconds to wait for any remaining telemetry data to be exported during shutdown of the platform. This is the maximum awaiting interval and the platform may shutdown before it expires if all telemetry data has already been published.
|
|
128
|
+
*/
|
|
129
|
+
finalExportTimeoutMs?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Interval in milliseconds to wait for any remaining telemetry data to be published by any apps before proceeding with the platform shutdown.
|
|
132
|
+
*/
|
|
133
|
+
finalExportGracePeriodMs?: number;
|
|
134
|
+
|
|
135
|
+
errorlessMode?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* If the library should log the settings used to initialize it.
|
|
138
|
+
*
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
logSettingsOnStartup?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* If failure to initialize library will throw upstream error.
|
|
144
|
+
*/
|
|
145
|
+
failOnInitError?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* If provided, this value will be added to the metrics and span attributes
|
|
148
|
+
* and to the span filtering context (see 'filters' in TracesSettings).
|
|
149
|
+
*/
|
|
150
|
+
platformVersion?: string;
|
|
151
|
+
/**
|
|
152
|
+
* If provided, this value will be added to the metrics and traces service.name attribute,
|
|
153
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
154
|
+
* a different setting.
|
|
155
|
+
*/
|
|
156
|
+
serviceName?: string;
|
|
157
|
+
/**
|
|
158
|
+
* If provided, this value will be added to the metrics and traces service.instance.id attribute,
|
|
159
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
160
|
+
* a different setting.
|
|
161
|
+
*/
|
|
162
|
+
serviceId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* If provided, this value will be added to the metrics and traces service.version attribute,
|
|
165
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
166
|
+
* a different setting.
|
|
167
|
+
* attribute.
|
|
168
|
+
*/
|
|
169
|
+
serviceVersion?: string;
|
|
170
|
+
/**
|
|
171
|
+
* If provided, this value will be added to the metrics and traces user.id attribute,
|
|
172
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
173
|
+
* a different setting.
|
|
174
|
+
*/
|
|
175
|
+
userId?: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
|
|
179
|
+
*/
|
|
180
|
+
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
181
|
+
/**
|
|
182
|
+
* Additional attributes to add to observability entities (metrics, spans, log entries) by default.
|
|
183
|
+
*/
|
|
184
|
+
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
185
|
+
/**
|
|
186
|
+
* Additional attributes to add to the observability resource definition.
|
|
187
|
+
*/
|
|
188
|
+
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
189
|
+
|
|
190
|
+
traces?: TracesSettings;
|
|
191
|
+
metrics?: MetricsSettings;
|
|
192
|
+
logs?: LogsSettings;
|
|
193
|
+
}
|
|
194
|
+
export interface MetricSettings {
|
|
195
|
+
enabled: boolean;
|
|
196
|
+
type: MetricType;
|
|
197
|
+
name: string;
|
|
198
|
+
description: string;
|
|
199
|
+
platformVersion?: string;
|
|
200
|
+
user?: string;
|
|
201
|
+
unit?: string;
|
|
202
|
+
buckets?: number[];
|
|
203
|
+
baseMetricType?: "histogram" | "gauge";
|
|
204
|
+
additionalAttributes?: { [key: string]: unknown } | (() => { [key: string]: unknown });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface Metric {
|
|
208
|
+
settings: MetricSettings;
|
|
209
|
+
started: boolean;
|
|
210
|
+
|
|
211
|
+
start(): Promise<void>;
|
|
212
|
+
stop(): Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export type MetricType =
|
|
216
|
+
/*app: */
|
|
217
|
+
| "app_count"
|
|
218
|
+
| "app_cpu"
|
|
219
|
+
| "app_crash"
|
|
220
|
+
| "app_duration"
|
|
221
|
+
| "app_duration_soft"
|
|
222
|
+
| "app_error"
|
|
223
|
+
| "app_memory"
|
|
224
|
+
| "app_started"
|
|
225
|
+
| "app_startup"
|
|
226
|
+
| "app_stopped"
|
|
227
|
+
/*layout: */
|
|
228
|
+
| "layout_startup"
|
|
229
|
+
/*workspace: */
|
|
230
|
+
| "workspace_count"
|
|
231
|
+
| "workspace_selected"
|
|
232
|
+
| "workspace_started"
|
|
233
|
+
| "workspace_stopped"
|
|
234
|
+
| "workspace_startup_legacy"
|
|
235
|
+
// G4E-9759
|
|
236
|
+
| "workspace_startup"
|
|
237
|
+
| "workspace_startup_frame"
|
|
238
|
+
| "workspace_startup_frame_init"
|
|
239
|
+
| "workspace_startup_frame_page_load"
|
|
240
|
+
| "workspace_startup_frame_workspace_render"
|
|
241
|
+
| "workspace_startup_component"
|
|
242
|
+
| "workspace_startup_apps"
|
|
243
|
+
/*platform: */
|
|
244
|
+
| "platform_error"
|
|
245
|
+
| "platform_startup"
|
|
246
|
+
/*system: */
|
|
247
|
+
| "system_cpu"
|
|
248
|
+
| "system_memory"
|
|
249
|
+
/*custom */
|
|
250
|
+
| "custom_gauge"
|
|
251
|
+
| "custom_observable_gauge"
|
|
252
|
+
| "custom_observable_counter"
|
|
253
|
+
| "custom_observable_up_down_counter"
|
|
254
|
+
| "custom_counter"
|
|
255
|
+
| "custom_histogram"
|
|
256
|
+
| "custom_up_down_counter"
|
|
257
|
+
/*rest: */
|
|
258
|
+
| "null";
|
|
259
|
+
|
|
260
|
+
interface TracingState {
|
|
261
|
+
end(): void;
|
|
262
|
+
/**
|
|
263
|
+
* If false, this is a placeholder object, and all its methods
|
|
264
|
+
* are no-ops, with the possible exception of getPropagationInfo()
|
|
265
|
+
* and injectPropagationInfo()
|
|
266
|
+
*/
|
|
267
|
+
enabled: boolean;
|
|
268
|
+
status?: SpanStatus;
|
|
269
|
+
level: keyof typeof SpanVerbosity;
|
|
270
|
+
addData(level: SpanVerbosity | keyof typeof SpanVerbosity, data: object): void;
|
|
271
|
+
source: string;
|
|
272
|
+
id?: string;
|
|
273
|
+
traceId?: string;
|
|
274
|
+
endSpan(): Promise<void>;
|
|
275
|
+
context?: Context;
|
|
276
|
+
span?: Span;
|
|
277
|
+
/**
|
|
278
|
+
* Gets the propagation info for the current span (see https://www.w3.org/TR/trace-context/#tracestate-field)
|
|
279
|
+
* @returns the propagation info, if a span is currently active
|
|
280
|
+
*/
|
|
281
|
+
getPropagationInfo: () => PropagationInfo | null;
|
|
282
|
+
/**
|
|
283
|
+
* Sets a hidden property in the object that can be used to restore propagation
|
|
284
|
+
* information after serialization and deserialization (see withSpan 'propagationInfo' argument
|
|
285
|
+
* and Traces.extractPropagationInfo() method).
|
|
286
|
+
* @param carrier the object to populate
|
|
287
|
+
*/
|
|
288
|
+
injectPropagationInfo: (carrier: PropagationInfoCarrier & object) => void;
|
|
289
|
+
addEvent: (
|
|
290
|
+
name: string,
|
|
291
|
+
attributesOrStartTime?: Attributes | TimeInput,
|
|
292
|
+
startTime?: TimeInput
|
|
293
|
+
) => this;
|
|
294
|
+
recordException: Span["recordException"];
|
|
295
|
+
isRecording: Span["isRecording"];
|
|
296
|
+
updateName: (name: string) => this;
|
|
297
|
+
spanContext: Span["spanContext"] | (() => undefined);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface TracesSettings {
|
|
301
|
+
/**
|
|
302
|
+
* Name of span hit counter metric, set to null to disable.
|
|
303
|
+
*
|
|
304
|
+
* Defaults to 'insights_trace_count'.
|
|
305
|
+
*/
|
|
306
|
+
countMetric?: string;
|
|
307
|
+
/**
|
|
308
|
+
* Name of span duration histogram metric, set to null to disable.
|
|
309
|
+
*
|
|
310
|
+
* Defaults to 'insights_trace_duration'.
|
|
311
|
+
*/
|
|
312
|
+
durationMetric?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Name of span result counter metric, set to null to disable.
|
|
315
|
+
*
|
|
316
|
+
* Defaults to 'insights_trace_result'.
|
|
317
|
+
*/
|
|
318
|
+
resultMetric?: string;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Whether tracing functionality is enabled.
|
|
322
|
+
* If disabled, API is still usable, but methods are no-ops.
|
|
323
|
+
*
|
|
324
|
+
* Defaults to 'false'.
|
|
325
|
+
*/
|
|
326
|
+
enabled: boolean;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Array of filter entries used to determine whether
|
|
330
|
+
* a particular operation will create a tracing span, and
|
|
331
|
+
* what verbosity level will apply to attributes added
|
|
332
|
+
* to that span.
|
|
333
|
+
*
|
|
334
|
+
* If no matching filter entry is found,
|
|
335
|
+
* the settings from 'default' are used.
|
|
336
|
+
*/
|
|
337
|
+
filters?: SpanFilter[];
|
|
338
|
+
/**
|
|
339
|
+
* If true, use a predefined list of filters for well-known
|
|
340
|
+
* platform traces.
|
|
341
|
+
*
|
|
342
|
+
* Defaults to true.
|
|
343
|
+
*/
|
|
344
|
+
useDefaultFilters?: boolean;
|
|
345
|
+
|
|
346
|
+
defaultFilters?: SpanFilter[];
|
|
347
|
+
/**
|
|
348
|
+
* Array of sampling setting entries used to determine
|
|
349
|
+
* whether a span will be sampled.
|
|
350
|
+
*
|
|
351
|
+
* If no matching sampling setting entry is found,
|
|
352
|
+
* the settings from 'defaults' are used.
|
|
353
|
+
*/
|
|
354
|
+
sampling?: SamplingSettings[];
|
|
355
|
+
/**
|
|
356
|
+
* Default settings if appropriate entries aren't found
|
|
357
|
+
* in 'filters' and 'sampling' collections.
|
|
358
|
+
*/
|
|
359
|
+
defaults?: SpanCreationOptions;
|
|
360
|
+
/**
|
|
361
|
+
* If 'true', the library will use the ContextManager provided
|
|
362
|
+
* by the active OTEL SDK to manage and derive propagation information
|
|
363
|
+
* to ensure spans created across asynchronous operations are properly
|
|
364
|
+
* nested.
|
|
365
|
+
*
|
|
366
|
+
* Otherwise, use 'Traces.currentTracingState' to set and retrieve propagation
|
|
367
|
+
* info across asynchronous operations manually.
|
|
368
|
+
*
|
|
369
|
+
* See https://opentelemetry.io/docs/languages/js/propagation/ and
|
|
370
|
+
* https://opentelemetry.io/docs/languages/js/context/#context-manager for
|
|
371
|
+
* more information.
|
|
372
|
+
*/
|
|
373
|
+
useOTELContextManager?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
376
|
+
* it will initialize its own.
|
|
377
|
+
*
|
|
378
|
+
* If 'url' is specified, TracerProvider will
|
|
379
|
+
* have an OTLPTraceExporter using this destination URL.
|
|
380
|
+
*/
|
|
381
|
+
url?: string;
|
|
382
|
+
/**
|
|
383
|
+
* Whether the clickstream trace will be enabled.
|
|
384
|
+
*
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
387
|
+
clickstream?: boolean | "nested" | "sibling";
|
|
388
|
+
/**
|
|
389
|
+
* Whether the user journey trace will be enabled.
|
|
390
|
+
*
|
|
391
|
+
* @default true
|
|
392
|
+
*/
|
|
393
|
+
userJourney?: boolean | "nested" | "sibling";
|
|
394
|
+
/**
|
|
395
|
+
* How long after application startup will any traced operations
|
|
396
|
+
* automatically be nested under the application startup trace.
|
|
397
|
+
*/
|
|
398
|
+
startupParentSpanTimeoutMs?: number;
|
|
399
|
+
/**
|
|
400
|
+
* Called by the application to signify that its startup has completed
|
|
401
|
+
* and no further spans should be nested under the startup trace.
|
|
402
|
+
*/
|
|
403
|
+
startupTraceFinished?: () => void;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
407
|
+
* it will initialize its own.
|
|
408
|
+
*
|
|
409
|
+
* If 'url' is specified, TracerProvider will
|
|
410
|
+
* have an OTLPTraceExporter with 'url' as detination URL and
|
|
411
|
+
* 'otlpExporterConfig' as additional * config.
|
|
412
|
+
*/
|
|
413
|
+
otlpExporterConfig?: OTLPExporterNodeConfigBase;
|
|
414
|
+
|
|
415
|
+
tracerProviderConfig?: TracerConfig;
|
|
416
|
+
|
|
417
|
+
batchSpanProcessorConfig?: BufferConfig;
|
|
418
|
+
|
|
419
|
+
autoInstrumentations?: AutoInstrumentationOptions;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* If an OTEL TraceProvider isn't provided to the library,
|
|
423
|
+
* it will initialize its own.
|
|
424
|
+
*
|
|
425
|
+
* If 'console' is 'true', TracerProvider will
|
|
426
|
+
* have a ConsoleTraceExporter.
|
|
427
|
+
*/
|
|
428
|
+
console?: boolean;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
|
|
432
|
+
*/
|
|
433
|
+
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
434
|
+
addResourceAttributesToAttributes?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Additional attributes to add to observability entities (metrics, spans, log entries) by default.
|
|
437
|
+
*/
|
|
438
|
+
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
439
|
+
/**
|
|
440
|
+
* Additional attributes to add to the observability resource definition.
|
|
441
|
+
*/
|
|
442
|
+
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
443
|
+
|
|
444
|
+
tracerProvider?: () => TracerProvider;
|
|
445
|
+
samplerGetter?: (defaultSampler: Sampler) => Sampler;
|
|
446
|
+
spanProcessors?: () => SpanProcessor[];
|
|
447
|
+
spanExporters?: () => SpanExporter[];
|
|
448
|
+
propagator?: () => TextMapPropagator;
|
|
449
|
+
contextManager?: () => ContextManager;
|
|
450
|
+
providerRegistrationSettings?: () => {
|
|
451
|
+
propagator?: TextMapPropagator;
|
|
452
|
+
contextManager?: ContextManager;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export type WithSpanCallback<T> = (tracingState: TracingState) => T;
|
|
457
|
+
|
|
458
|
+
export interface PropagationInfo {
|
|
459
|
+
traceparent?: string;
|
|
460
|
+
tracestate?: string;
|
|
461
|
+
forceTracing?: boolean;
|
|
462
|
+
}
|
|
463
|
+
export interface PropagationInfoCarrier {
|
|
464
|
+
__interopIOTracePropagationInfo?: PropagationInfo;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export type PropagationInfoCallback = (
|
|
468
|
+
source: string,
|
|
469
|
+
fullFilteringContext: FilteringContext
|
|
470
|
+
) => PropagationInfo | null;
|
|
471
|
+
|
|
472
|
+
export type FilteringContext = {
|
|
473
|
+
app?: string;
|
|
474
|
+
user?: string;
|
|
475
|
+
host?: string;
|
|
476
|
+
serviceName?: string;
|
|
477
|
+
serviceId?: string;
|
|
478
|
+
platformVersion?: string;
|
|
479
|
+
serviceVersion?: string;
|
|
480
|
+
userId?: string;
|
|
481
|
+
} & Record<string, any>;
|
|
482
|
+
|
|
483
|
+
export enum SpanVerbosity {
|
|
484
|
+
OFF,
|
|
485
|
+
LOWEST,
|
|
486
|
+
DIAGNOSTIC,
|
|
487
|
+
DEBUG,
|
|
488
|
+
INFO,
|
|
489
|
+
WARN,
|
|
490
|
+
HIGHEST,
|
|
491
|
+
}
|
|
492
|
+
export interface WithSpanOptions extends Omit<SpanCreationOptions, "sample"> {
|
|
493
|
+
defaultFilters?: SpanFilter[];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface SpanCreationOptions {
|
|
497
|
+
/**
|
|
498
|
+
* Whether the span will be created or will be a no-op. See 'Filter'.
|
|
499
|
+
*
|
|
500
|
+
* Defaults to 'true'.
|
|
501
|
+
*/
|
|
502
|
+
enabled?: boolean;
|
|
503
|
+
/**
|
|
504
|
+
* If a tracing span is disabled by filter, setting this to "true" will stop the propagation
|
|
505
|
+
* of trace nesting info across it.
|
|
506
|
+
*/
|
|
507
|
+
stopPropagationIfSpanIsDisabled?: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* Default span attribute verbosity level. See 'Filter'.
|
|
510
|
+
*
|
|
511
|
+
* Defaults to 'INFO'.
|
|
512
|
+
*/
|
|
513
|
+
level?: keyof typeof SpanVerbosity;
|
|
514
|
+
/**
|
|
515
|
+
* Whether the filtering context will be added as span attributes
|
|
516
|
+
* to the span. See 'Filter'.
|
|
517
|
+
*
|
|
518
|
+
* Defaults to 'true'.
|
|
519
|
+
*/
|
|
520
|
+
addContextToTrace?: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Whether the span's status will be set to OK on completion, if
|
|
523
|
+
* it's still UNSET. See 'Filter'.
|
|
524
|
+
*
|
|
525
|
+
* Defaults to 'false'.
|
|
526
|
+
*/
|
|
527
|
+
autoSetSuccessStatus?: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Default sampling setting/probability. See 'SamplingSettings'.
|
|
530
|
+
*
|
|
531
|
+
* Defaults to 'true'.
|
|
532
|
+
*/
|
|
533
|
+
sample?: number | boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Whether the span will not inject its propagation info into data
|
|
536
|
+
* transfer objects for span nesting across system boundaries.
|
|
537
|
+
*
|
|
538
|
+
* Defaults to 'false'.
|
|
539
|
+
*/
|
|
540
|
+
disablePropagation?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Forces the span to create a new trace.
|
|
543
|
+
*/
|
|
544
|
+
disableNesting?: boolean;
|
|
545
|
+
|
|
546
|
+
log?: boolean;
|
|
547
|
+
|
|
548
|
+
logOnDisabledSpans?: boolean;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Whether the span will be counted in the insights_trace_count metric. See TracesSettings.countMetric.
|
|
552
|
+
*
|
|
553
|
+
* Defaults to 'false'.
|
|
554
|
+
*/
|
|
555
|
+
countMetric?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Whether the span will be counted in the insights_trace_count metric if disabled. See TracesSettings.countMetric.
|
|
558
|
+
*/
|
|
559
|
+
countMetricOnDisabledSpans?: boolean;
|
|
560
|
+
/**
|
|
561
|
+
* Whether the span will be counted in the insights_trace_result metric. See TracesSettings.resultMetric.
|
|
562
|
+
*
|
|
563
|
+
* Defaults to 'false'.
|
|
564
|
+
*/
|
|
565
|
+
resultMetric?: boolean;
|
|
566
|
+
/**
|
|
567
|
+
* Whether the span will be counted in the insights_trace_result metric if disabled. See TracesSettings.resultMetric.
|
|
568
|
+
*/
|
|
569
|
+
resultMetricOnDisabledSpans?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Whether the span will be counted in the insights_trace_duration metric. See TracesSettings.durationtMetric.
|
|
572
|
+
*
|
|
573
|
+
* Defaults to 'false'.
|
|
574
|
+
*/
|
|
575
|
+
durationMetric?: boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Whether the span will be counted in the insights_trace_count metric if disabled. See TracesSettings.durationMetric.
|
|
578
|
+
*/
|
|
579
|
+
durationMetricOnDisabledSpans?: boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Whether the span will be able to start a new trace. If false, it will only
|
|
582
|
+
* be able to be added to an existing trace.
|
|
583
|
+
*
|
|
584
|
+
* Defaults to 'true'.
|
|
585
|
+
*/
|
|
586
|
+
canBeRoot?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* How deep addData method should recurse into objects when adding
|
|
589
|
+
* attributes to spans.
|
|
590
|
+
*
|
|
591
|
+
* Defaults to 3.
|
|
592
|
+
*/
|
|
593
|
+
maxAttributeDepth?: number;
|
|
594
|
+
/**
|
|
595
|
+
* If true, any child spans (including nested spans across sytem boundaries)
|
|
596
|
+
* will be forced to be traced, even if their span filter configuration
|
|
597
|
+
* is set to not enabled.
|
|
598
|
+
*
|
|
599
|
+
* Defaults to 'false'.
|
|
600
|
+
*/
|
|
601
|
+
forceChildTracing?: boolean;
|
|
602
|
+
/**
|
|
603
|
+
* If specified, spans whose duration is lower than this will not be sampled.
|
|
604
|
+
*/
|
|
605
|
+
minDurationMs?: number;
|
|
606
|
+
|
|
607
|
+
getPropagationInfo?: PropagationInfoCallback;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* OTEL span options
|
|
611
|
+
*/
|
|
612
|
+
otelSpanOptions?: SpanOptions;
|
|
613
|
+
|
|
614
|
+
overrideDefaultFilters?: boolean;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export interface SpanFilter extends Omit<SpanCreationOptions, "getPropagationInfo"> {
|
|
618
|
+
/**
|
|
619
|
+
* Specifies the source string used for matching spans.
|
|
620
|
+
* Spans match only if their source equals this value, or
|
|
621
|
+
* if their source starts with '<source>.' (e.g. my.api.foo
|
|
622
|
+
* starts with my.api).
|
|
623
|
+
*
|
|
624
|
+
* Start string with "#" for case-insensitive regex match.
|
|
625
|
+
*/
|
|
626
|
+
source?: string;
|
|
627
|
+
/**
|
|
628
|
+
* Specifies the filtering context values used for matching spans.
|
|
629
|
+
* Spans match only if all the values in this object match
|
|
630
|
+
* the context values returned by the context getter callback
|
|
631
|
+
* and the filteringContext config property.
|
|
632
|
+
*
|
|
633
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
634
|
+
*/
|
|
635
|
+
context?: {
|
|
636
|
+
[key: string]: string | number | boolean;
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
export interface AutoInstrumentationOptions {
|
|
640
|
+
documentLoad?: boolean | DocumentLoadInstrumentationConfig;
|
|
641
|
+
userInteraction?: boolean | UserInteractionInstrumentationConfig;
|
|
642
|
+
fetch?: boolean | FetchInstrumentationConfig;
|
|
643
|
+
xhr?: boolean | XMLHttpRequestInstrumentationConfig;
|
|
644
|
+
ignoreObservabilityUrls?: boolean;
|
|
645
|
+
}
|
|
646
|
+
export interface SamplingSettings {
|
|
647
|
+
/**
|
|
648
|
+
* Span name to determine if span will match this sampling setting entry.
|
|
649
|
+
* Start string with "#" for case-insensitive regex match
|
|
650
|
+
*/
|
|
651
|
+
name?: string;
|
|
652
|
+
/**
|
|
653
|
+
* Span attributes that determine if span will match this sampling setting entry.
|
|
654
|
+
* Useful e.g. for checking otel.library.name/otel.scope.name attribute to filter
|
|
655
|
+
* auto-instrumentated spans.
|
|
656
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
657
|
+
*/
|
|
658
|
+
attributes?: { [key: string]: string | number | boolean };
|
|
659
|
+
/**
|
|
660
|
+
* Context values that determine if span will match this sampling setting entry.
|
|
661
|
+
* 'Context' here refers to the object returned from the 'contextGetter' callback at the
|
|
662
|
+
* time of sampling, not the OTEL context concept.
|
|
663
|
+
* This is useful for sampling based on the current client environment - current user, application,
|
|
664
|
+
* server node, time of day, etc.
|
|
665
|
+
* Start strings with "#" for case-insensitive regex match.
|
|
666
|
+
*/
|
|
667
|
+
context?: { [key: string]: string | number | boolean };
|
|
668
|
+
/**
|
|
669
|
+
* Probability that span will be sampled, based on its traceId
|
|
670
|
+
* Spans from the same trace will always either all be sampled, or none will,
|
|
671
|
+
* provided they all have the same sampling probability.
|
|
672
|
+
* If true: will be sampled
|
|
673
|
+
* If false: will not be sampled
|
|
674
|
+
* If number between 0 and 1: has this probability of being sampled.
|
|
675
|
+
* Precision: 3 decimal digits
|
|
676
|
+
*/
|
|
677
|
+
sample: number | boolean;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export interface UserInteractionInstrumentationConfig
|
|
681
|
+
extends UserInteractionInstrumentationConfigBase {
|
|
682
|
+
throttleIntervalMs?: number;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export interface LogsSettings {
|
|
686
|
+
enabled: boolean;
|
|
687
|
+
url?: string;
|
|
688
|
+
|
|
689
|
+
keepAlive?: boolean;
|
|
690
|
+
exporterSettings?: OTLPExporterConfigBase;
|
|
691
|
+
batchSettings?: BufferConfig;
|
|
692
|
+
providerSettings?: LoggerProviderConfig;
|
|
693
|
+
|
|
694
|
+
loggerProvider?: LoggerProvider;
|
|
695
|
+
logProcessors?: LogRecordProcessor[];
|
|
696
|
+
logExporters?: LogRecordExporter[];
|
|
697
|
+
|
|
698
|
+
maxAttributeDepth?: number;
|
|
699
|
+
filters?: LogFilter[];
|
|
700
|
+
defaults?: LogOptions;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
|
|
704
|
+
*/
|
|
705
|
+
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
706
|
+
addResourceAttributesToAttributes?: boolean;
|
|
707
|
+
/**
|
|
708
|
+
* Additional attributes to add to observability entities (metrics, spans, log entries) by default.
|
|
709
|
+
*/
|
|
710
|
+
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
711
|
+
/**
|
|
712
|
+
* Additional attributes to add to the observability resource definition.
|
|
713
|
+
*/
|
|
714
|
+
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export interface LogFilter extends LogOptions {
|
|
718
|
+
categoryName?: string;
|
|
719
|
+
severity?: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL";
|
|
720
|
+
bodyRegex?: string;
|
|
721
|
+
}
|
|
722
|
+
export interface LogOptions {
|
|
723
|
+
allowedAttributes?: string[];
|
|
724
|
+
hideRegex?: string;
|
|
725
|
+
enabled?: boolean;
|
|
726
|
+
}
|
|
727
|
+
}
|