@interopio/otel 0.0.145 → 0.0.147
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 +11 -1
- package/dist/builder.js.map +1 -1
- package/dist/logger/logWrapper.d.ts +12 -0
- package/dist/logger/logWrapper.js +54 -0
- package/dist/logger/logWrapper.js.map +1 -0
- package/insights.d.ts +471 -197
- package/package.json +1 -1
package/dist/builder.js
CHANGED
|
@@ -13,6 +13,7 @@ const nullManager_1 = require("./logs/nullManager");
|
|
|
13
13
|
const manager_1 = require("./logs/manager");
|
|
14
14
|
const safe_stringify_1 = require("./utils/safe-stringify");
|
|
15
15
|
const constants_1 = require("./constants");
|
|
16
|
+
const logWrapper_1 = require("./logger/logWrapper");
|
|
16
17
|
class Builder {
|
|
17
18
|
constructor() {
|
|
18
19
|
this.logger = new null_1.NullLogger();
|
|
@@ -20,7 +21,16 @@ class Builder {
|
|
|
20
21
|
// these methods must be invoked...
|
|
21
22
|
withLogger(logger) {
|
|
22
23
|
var _a;
|
|
23
|
-
|
|
24
|
+
if (logger) {
|
|
25
|
+
logger = new logWrapper_1.LogWrapper(logger, (_, msg) => {
|
|
26
|
+
var _a;
|
|
27
|
+
if (((_a = this.settings) === null || _a === void 0 ? void 0 : _a.suppressDoubleInitializationWarnings) &&
|
|
28
|
+
~(msg + "").indexOf("@opentelemetry/api: Attempted duplicate registration of API")) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
24
34
|
if (this.logger.level) {
|
|
25
35
|
const level = (_a = this.logger.level) === null || _a === void 0 ? void 0 : _a.valueOf();
|
|
26
36
|
api_1.diag.setLogger(this.logger, level);
|
package/dist/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":";;;AAAA,4CAA0C;AAC1C,+CAA0D;AAC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2
|
+
export declare class LogWrapper implements IOInsights.Logger {
|
|
3
|
+
private logger;
|
|
4
|
+
private dropLog;
|
|
5
|
+
constructor(logger: IOInsights.Logger, dropLog: (level: IOInsights.LoggerLogLevel, ...args: unknown[]) => boolean);
|
|
6
|
+
get level(): IOInsights.LoggerLogLevel;
|
|
7
|
+
error(message: string, ...args: unknown[]): void;
|
|
8
|
+
warn(message: string, ...args: unknown[]): void;
|
|
9
|
+
info(message: string, ...args: unknown[]): void;
|
|
10
|
+
debug(message: string, ...args: unknown[]): void;
|
|
11
|
+
verbose(message: string, ...args: unknown[]): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogWrapper = void 0;
|
|
4
|
+
// wraps an OTEL library logger into an OTEL library logger
|
|
5
|
+
// allows filtering messages etc
|
|
6
|
+
class LogWrapper {
|
|
7
|
+
constructor(logger, dropLog) {
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
this.dropLog = dropLog;
|
|
10
|
+
}
|
|
11
|
+
get level() {
|
|
12
|
+
var _a;
|
|
13
|
+
return (_a = this.logger.level) !== null && _a !== void 0 ? _a : 0 /* IOInsights.LoggerLogLevel.NONE */;
|
|
14
|
+
}
|
|
15
|
+
error(message, ...args) {
|
|
16
|
+
var _a;
|
|
17
|
+
if ((_a = this.dropLog) === null || _a === void 0 ? void 0 : _a.call(this, 50 /* IOInsights.LoggerLogLevel.WARN */, args)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// we log errors as warn because some of our clients stopped the platform if an log error is observed (they consider it as broken state)
|
|
21
|
+
// we can do that since otel impl is not considered critical
|
|
22
|
+
this.logger.warn(message, ...args);
|
|
23
|
+
}
|
|
24
|
+
warn(message, ...args) {
|
|
25
|
+
var _a;
|
|
26
|
+
if ((_a = this.dropLog) === null || _a === void 0 ? void 0 : _a.call(this, 50 /* IOInsights.LoggerLogLevel.WARN */, args)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.logger.warn(message, ...args);
|
|
30
|
+
}
|
|
31
|
+
info(message, ...args) {
|
|
32
|
+
var _a;
|
|
33
|
+
if ((_a = this.dropLog) === null || _a === void 0 ? void 0 : _a.call(this, 60 /* IOInsights.LoggerLogLevel.INFO */, args)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.logger.info(message, ...args);
|
|
37
|
+
}
|
|
38
|
+
debug(message, ...args) {
|
|
39
|
+
var _a;
|
|
40
|
+
if ((_a = this.dropLog) === null || _a === void 0 ? void 0 : _a.call(this, 70 /* IOInsights.LoggerLogLevel.DEBUG */, args)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.logger.debug(message, ...args);
|
|
44
|
+
}
|
|
45
|
+
verbose(message, ...args) {
|
|
46
|
+
var _a;
|
|
47
|
+
if ((_a = this.dropLog) === null || _a === void 0 ? void 0 : _a.call(this, 80 /* IOInsights.LoggerLogLevel.VERBOSE */, args)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.logger.verbose(message, ...args);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.LogWrapper = LogWrapper;
|
|
54
|
+
//# sourceMappingURL=logWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logWrapper.js","sourceRoot":"","sources":["../../src/logger/logWrapper.ts"],"names":[],"mappings":";;;AAEA,2DAA2D;AAC3D,gCAAgC;AAChC,MAAa,UAAU;IAEnB,YACY,MAAyB,EACzB,OAA0E;QAD1E,WAAM,GAAN,MAAM,CAAmB;QACzB,YAAO,GAAP,OAAO,CAAmE;IACtF,CAAC;IAED,IAAW,KAAK;;QACZ,OAAO,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,yEAAkC,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;;QAC5C,IAAI,MAAA,IAAI,CAAC,OAAO,8FAAmC,IAAI,CAAC,EAAE;YACtD,OAAO;SACV;QACD,wIAAwI;QACxI,4DAA4D;QAC5D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;;QAC3C,IAAI,MAAA,IAAI,CAAC,OAAO,8FAAmC,IAAI,CAAC,EAAE;YACtD,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;;QAC3C,IAAI,MAAA,IAAI,CAAC,OAAO,8FAAmC,IAAI,CAAC,EAAE;YACtD,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;;QAC5C,IAAI,MAAA,IAAI,CAAC,OAAO,+FAAoC,IAAI,CAAC,EAAE;YACvD,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,OAAO,CAAC,OAAe,EAAE,GAAG,IAAe;;QAC9C,IAAI,MAAA,IAAI,CAAC,OAAO,iGAAsC,IAAI,CAAC,EAAE;YACzD,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ;AA/CD,gCA+CC"}
|
package/insights.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
|
+
import { Layout } from "log4js";
|
|
3
4
|
import {
|
|
4
5
|
Attributes,
|
|
5
6
|
Context,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
TracerProvider,
|
|
16
17
|
} from "@opentelemetry/api";
|
|
17
18
|
import { UserInteractionInstrumentationConfig as UserInteractionInstrumentationConfigBase } from "@opentelemetry/instrumentation-user-interaction";
|
|
18
|
-
import {
|
|
19
|
+
import { LogRecord } from "@opentelemetry/api-logs";
|
|
19
20
|
import {
|
|
20
21
|
CompressionAlgorithm,
|
|
21
22
|
OTLPExporterConfigBase,
|
|
@@ -70,173 +71,86 @@ export namespace IOInsights {
|
|
|
70
71
|
getFromSettings(settings: MetricSettings): Metric | undefined;
|
|
71
72
|
}
|
|
72
73
|
export interface MetricsManagerBuilder {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
build(): MetricsManager;
|
|
75
|
+
withLogger(logger: Logger): this;
|
|
76
|
+
withSettings(settings: Settings): this;
|
|
77
|
+
withMeterProvider(func: MetricsMeterProviderCreateFunc): this;
|
|
78
|
+
withDependencyContainer(container: MetricsDependencyContainer): this;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export type MetricsMeterProviderCreateFunc = () => {
|
|
81
|
-
|
|
81
|
+
export type MetricsMeterProviderCreateFunc = () => {
|
|
82
|
+
meterProvider: MetricsMeterProvider;
|
|
83
|
+
metricReader: MetricReader;
|
|
84
|
+
};
|
|
85
|
+
|
|
82
86
|
export interface MetricsMeterProvider extends MeterProvider {
|
|
83
|
-
|
|
87
|
+
forceFlush(): Promise<void>;
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @ignore
|
|
92
|
+
*/
|
|
86
93
|
export interface MetricsFactory {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
create<TData extends Attributes>(
|
|
95
|
+
settings: MetricSettings,
|
|
96
|
+
generalSettings: MetricsSettings,
|
|
97
|
+
observeCallback?: (result: ObservableResult<TData>) => Promise<void>,
|
|
98
|
+
subscribeCallback?: () => Promise<void>,
|
|
99
|
+
unsubscribeCallback?: () => Promise<void>
|
|
100
|
+
): Metric;
|
|
93
101
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @ignore
|
|
104
|
+
*/
|
|
105
|
+
export type CreateMetricFunc = (
|
|
106
|
+
settings: MetricSettings,
|
|
107
|
+
generalSettings: MetricsSettings
|
|
108
|
+
) => Metric;
|
|
101
109
|
|
|
110
|
+
export interface MetricsSettings {
|
|
102
111
|
/**
|
|
103
|
-
*
|
|
104
|
-
* and no further spans should be nested under the startup trace.
|
|
112
|
+
* Optional override for the dependency container providing platform-specific metric handlers.
|
|
105
113
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
setStartupTraceFinished(startupTraceFinished: () => void): void;
|
|
109
|
-
|
|
110
|
-
userJourneyMarker?: MarkerSpanCallback;
|
|
111
|
-
setUserJourneyMarker(userJourneyMarker: MarkerSpanCallback): void;
|
|
112
|
-
|
|
113
|
-
clickstreamMarker?: MarkerSpanCallback;
|
|
114
|
-
setClickstreamMarker(clickstreamMarker: MarkerSpanCallback): void;
|
|
115
|
-
|
|
116
|
-
setFilterConfig(filters: SpanFilter[]): void;
|
|
117
|
-
withSpan<T>(source: string, callback: WithSpanCallback<T>): T;
|
|
118
|
-
|
|
119
|
-
withSpan<T>(
|
|
120
|
-
source: string,
|
|
121
|
-
filteringContext: FilteringContext,
|
|
122
|
-
callback: WithSpanCallback<T>
|
|
123
|
-
): T;
|
|
124
|
-
|
|
125
|
-
withSpan<T>(
|
|
126
|
-
source: string,
|
|
127
|
-
filteringContext: FilteringContext,
|
|
128
|
-
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
129
|
-
callback: WithSpanCallback<T>
|
|
130
|
-
): T;
|
|
131
|
-
|
|
132
|
-
withSpan<T>(
|
|
133
|
-
source: string,
|
|
134
|
-
filteringContext: FilteringContext,
|
|
135
|
-
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
136
|
-
options: WithSpanOptions | null,
|
|
137
|
-
callback: WithSpanCallback<T>
|
|
138
|
-
): T;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface LogsManager extends Manager<LogsSettings> {
|
|
142
|
-
emit(logRecord: LogRecord): Promise<void> | null;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface Manager<TSettings> {
|
|
146
|
-
settings: TSettings;
|
|
147
|
-
started: boolean;
|
|
148
|
-
|
|
149
|
-
start(): Promise<void>;
|
|
150
|
-
stop(): Promise<void>;
|
|
151
|
-
waitForFinalExport(timeoutMs?: number): Promise<void>;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface Settings {
|
|
114
|
+
dependencyContainerOverride?: MetricsDependencyContainer;
|
|
155
115
|
/**
|
|
156
|
-
* Whether
|
|
116
|
+
* Whether metrics functionality is enabled.
|
|
157
117
|
* If disabled, API is still usable, but methods are no-ops.
|
|
118
|
+
*
|
|
119
|
+
* @default false
|
|
158
120
|
*/
|
|
159
121
|
enabled: boolean;
|
|
160
122
|
/**
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
finalExportTimeoutMs?: number;
|
|
164
|
-
/**
|
|
165
|
-
* Interval in milliseconds to wait for any remaining telemetry data to be published by any apps before proceeding with the platform shutdown.
|
|
166
|
-
*/
|
|
167
|
-
finalExportGracePeriodMs?: number;
|
|
168
|
-
|
|
169
|
-
errorlessMode?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* If the library should log the settings used to initialize it.
|
|
172
|
-
*
|
|
173
|
-
* @default true
|
|
174
|
-
*/
|
|
175
|
-
logSettingsOnStartup?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* If failure to initialize library will throw upstream error.
|
|
123
|
+
* Whether to enable automatic collection of platform-level metrics (CPU, memory, etc.).
|
|
178
124
|
*/
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* If provided, this value will be added to the metrics and span attributes
|
|
182
|
-
* and to the span filtering context (see 'filters' in TracesSettings).
|
|
183
|
-
*/
|
|
184
|
-
platformVersion?: string;
|
|
125
|
+
platformMetricsEnabled?: boolean;
|
|
185
126
|
/**
|
|
186
|
-
*
|
|
187
|
-
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
188
|
-
* a different setting.
|
|
127
|
+
* Array of individual metric configurations to collect.
|
|
189
128
|
*/
|
|
190
|
-
|
|
129
|
+
metrics?: MetricSettings[];
|
|
191
130
|
/**
|
|
192
|
-
*
|
|
193
|
-
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
194
|
-
* a different setting.
|
|
131
|
+
* The destination URL for exporting metrics via OTLP.
|
|
195
132
|
*/
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* If provided, this value will be added to the metrics and traces service.version attribute,
|
|
199
|
-
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
200
|
-
* a different setting.
|
|
201
|
-
* attribute.
|
|
202
|
-
*/
|
|
203
|
-
serviceVersion?: string;
|
|
133
|
+
url?: string;
|
|
204
134
|
/**
|
|
205
|
-
*
|
|
206
|
-
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
207
|
-
* a different setting.
|
|
135
|
+
* Interval in milliseconds between metric export batches.
|
|
208
136
|
*/
|
|
209
|
-
|
|
210
|
-
|
|
137
|
+
publishInterval?: number;
|
|
211
138
|
/**
|
|
212
|
-
*
|
|
139
|
+
* Compression algorithm to use when exporting metrics.
|
|
213
140
|
*/
|
|
214
|
-
|
|
141
|
+
compression?: CompressionAlgorithm;
|
|
215
142
|
/**
|
|
216
|
-
*
|
|
143
|
+
* Hostname to include in exported metrics.???????
|
|
217
144
|
*/
|
|
218
|
-
|
|
145
|
+
hostname?: string;
|
|
219
146
|
/**
|
|
220
|
-
*
|
|
147
|
+
* Whether to use HTTP keep-alive connections for metric exports.
|
|
221
148
|
*/
|
|
222
|
-
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
223
|
-
|
|
224
|
-
traces?: TracesSettings;
|
|
225
|
-
metrics?: MetricsSettings;
|
|
226
|
-
logs?: LogsSettings;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export interface MetricsSettings {
|
|
230
|
-
dependencyContainerOverride?: MetricsDependencyContainer;
|
|
231
|
-
enabled: boolean;
|
|
232
|
-
platformMetricsEnabled?: boolean;
|
|
233
|
-
metrics?: MetricSettings[];
|
|
234
|
-
url?: string;
|
|
235
|
-
publishInterval?: number;
|
|
236
|
-
compression?: CompressionAlgorithm;
|
|
237
|
-
hostname?: string;
|
|
238
149
|
keepAlive?: boolean;
|
|
239
150
|
// httpAgentOptions?: http.AgentOptions | https.AgentOptions;
|
|
151
|
+
/**
|
|
152
|
+
* Maximum number of concurrent metric export requests.
|
|
153
|
+
*/
|
|
240
154
|
concurrencyLimit?: number;
|
|
241
155
|
/** Maximum time the OTLP exporter will wait for each batch export.
|
|
242
156
|
* The default value is 10000ms. */
|
|
@@ -245,22 +159,33 @@ export namespace IOInsights {
|
|
|
245
159
|
* Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
|
|
246
160
|
*/
|
|
247
161
|
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
162
|
+
/**
|
|
163
|
+
* Whether to add resource attributes to metric data point attributes.
|
|
164
|
+
*/
|
|
248
165
|
addResourceAttributesToAttributes?: boolean;
|
|
249
166
|
/**
|
|
250
|
-
* Additional
|
|
167
|
+
* Additional metrics properties to publish as part of each metric, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
251
168
|
*/
|
|
252
169
|
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
253
170
|
/**
|
|
254
|
-
* Additional attributes to
|
|
171
|
+
* Additional attributes to publish as part of the OTEL resource definition, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
255
172
|
*/
|
|
256
173
|
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
257
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Partial MetricsSettings for meter configuration.
|
|
176
|
+
*/
|
|
258
177
|
meter?: Partial<MetricsSettings>;
|
|
259
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Custom metric exporter implementation for pushing metrics.
|
|
180
|
+
*/
|
|
260
181
|
metricExporter?: PushMetricExporter;
|
|
261
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Array of filter rules to determine which metrics should be collected and exported.
|
|
184
|
+
*/
|
|
262
185
|
filters?: MetricFilter[];
|
|
263
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Whether to apply predefined default filters for platform metrics.
|
|
188
|
+
*/
|
|
264
189
|
useDefaultFilters?: boolean;
|
|
265
190
|
}
|
|
266
191
|
export interface MetricSettings {
|
|
@@ -283,16 +208,26 @@ export namespace IOInsights {
|
|
|
283
208
|
start(): Promise<void>;
|
|
284
209
|
stop(): Promise<void>;
|
|
285
210
|
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @ignore
|
|
214
|
+
*/
|
|
286
215
|
export interface MetricData extends Attributes {
|
|
287
216
|
platformVersion?: string;
|
|
288
217
|
user?: string;
|
|
289
|
-
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* @ignore
|
|
221
|
+
*/
|
|
290
222
|
export interface ApplicationMetricData extends MetricData {
|
|
291
223
|
application: string;
|
|
292
224
|
}
|
|
293
225
|
|
|
226
|
+
/**
|
|
227
|
+
* @ignore
|
|
228
|
+
*/
|
|
294
229
|
export interface LayoutMetricData extends MetricData {
|
|
295
|
-
|
|
230
|
+
layout: string;
|
|
296
231
|
}
|
|
297
232
|
|
|
298
233
|
export type MetricType =
|
|
@@ -340,20 +275,25 @@ export namespace IOInsights {
|
|
|
340
275
|
/*rest: */
|
|
341
276
|
| "null";
|
|
342
277
|
|
|
343
|
-
export interface MetricDefaultFilter
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
278
|
+
export interface MetricDefaultFilter {
|
|
279
|
+
type?: MetricType;
|
|
280
|
+
enabled: boolean;
|
|
281
|
+
overrideDefaultFilters?: boolean;
|
|
282
|
+
attributes?: {
|
|
283
|
+
/**
|
|
284
|
+
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
285
|
+
* This attribute can be used to filter out metrics.
|
|
286
|
+
*/
|
|
287
|
+
complexLoad?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Indicates whether the metric includes the time to create and load the Workspace Frame App when the workspace is opened in a new frame.
|
|
290
|
+
*/
|
|
291
|
+
includesFrameCreation?: boolean;
|
|
292
|
+
};
|
|
352
293
|
}
|
|
353
|
-
export interface MetricFilter extends MetricDefaultFilter
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
type: MetricType;
|
|
294
|
+
export interface MetricFilter extends MetricDefaultFilter {
|
|
295
|
+
name: string;
|
|
296
|
+
type: MetricType;
|
|
357
297
|
}
|
|
358
298
|
export interface MetricsDependencyContainer {
|
|
359
299
|
performanceProvider: PerformanceProvider;
|
|
@@ -441,7 +381,14 @@ export namespace IOInsights {
|
|
|
441
381
|
export interface WorkspaceTimedActionHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
442
382
|
startTime: Date;
|
|
443
383
|
endTime: Date;
|
|
384
|
+
/**
|
|
385
|
+
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
386
|
+
* This attribute can be used to filter out metrics.
|
|
387
|
+
*/
|
|
444
388
|
complexLoad: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Indicates whether the metric includes the time to create and load the Workspace Frame App when the workspace is opened in a new frame.
|
|
391
|
+
*/
|
|
445
392
|
includesFrameCreation: boolean;
|
|
446
393
|
[x: string]: any;
|
|
447
394
|
}
|
|
@@ -449,16 +396,30 @@ export namespace IOInsights {
|
|
|
449
396
|
export interface WorkspaceRestoredHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
450
397
|
startTime: Date;
|
|
451
398
|
endTime: Date;
|
|
399
|
+
/**
|
|
400
|
+
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
401
|
+
* This attribute can be used to filter out metrics.
|
|
402
|
+
*/
|
|
452
403
|
complexLoad?: boolean;
|
|
404
|
+
/**
|
|
405
|
+
* Indicates whether the metric includes the time to create and load the Workspace Frame App when the workspace is opened in a new frame.
|
|
406
|
+
*/
|
|
453
407
|
includesFrameCreation?: boolean;
|
|
454
408
|
[x: string]: any;
|
|
455
409
|
}
|
|
456
410
|
|
|
457
411
|
export interface WorkspaceAppsStartedHandlerArgs extends WorkspaceTimedActionHandlerArgs {
|
|
412
|
+
/**
|
|
413
|
+
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
414
|
+
* This attribute can be used to filter out metrics.
|
|
415
|
+
*/
|
|
458
416
|
complexLoad: boolean;
|
|
459
417
|
}
|
|
460
418
|
|
|
461
419
|
export interface WorkspaceStartupHandlerArgs extends WorkspaceAppsStartedHandlerArgs {
|
|
420
|
+
/**
|
|
421
|
+
* Indicates whether the metric includes the time to create and load the Workspace Frame App when the workspace is opened in a new frame.
|
|
422
|
+
*/
|
|
462
423
|
includesFrameCreation: boolean;
|
|
463
424
|
}
|
|
464
425
|
|
|
@@ -475,9 +436,9 @@ export namespace IOInsights {
|
|
|
475
436
|
) => Unsubscribe;
|
|
476
437
|
|
|
477
438
|
export type WorkspaceActionHandler = WorkspaceGenericActionHandler<WorkspaceActionHandlerArgs>;
|
|
478
|
-
export type WorkspaceLoadedHandler =
|
|
479
|
-
|
|
480
|
-
|
|
439
|
+
export type WorkspaceLoadedHandler = WorkspaceGenericActionHandler<WorkspaceLoadedHandlerArgs>;
|
|
440
|
+
export type WorkspaceRestoredHandler =
|
|
441
|
+
WorkspaceGenericActionHandler<WorkspaceRestoredHandlerArgs>;
|
|
481
442
|
export type WorkspaceSavedHandler = WorkspaceGenericActionHandler<WorkspaceSavedHandlerArgs>;
|
|
482
443
|
|
|
483
444
|
export interface InstanceReadyHandlerArgs {
|
|
@@ -533,6 +494,77 @@ export namespace IOInsights {
|
|
|
533
494
|
systemFree: number;
|
|
534
495
|
}
|
|
535
496
|
|
|
497
|
+
/**
|
|
498
|
+
* Traces API.
|
|
499
|
+
*/
|
|
500
|
+
export interface TracesManager extends Manager<TracesSettings> {
|
|
501
|
+
currentTracingState: TracingState | null;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Called by the application to signify that its startup has completed
|
|
505
|
+
* and no further spans should be nested under the startup trace.
|
|
506
|
+
*/
|
|
507
|
+
startupTraceFinished?: () => void;
|
|
508
|
+
|
|
509
|
+
setStartupTraceFinished(startupTraceFinished: () => void): void;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Optional callback function to programmatically create marker spans in the User Journey trace.
|
|
513
|
+
* Allows applications to mark significant points in a user's journey through the application
|
|
514
|
+
* (e.g., navigation events, key user actions, milestone completions).
|
|
515
|
+
*
|
|
516
|
+
* The callback receives:
|
|
517
|
+
* - source: A descriptive name for the marker (e.g., "user-navigated-to-dashboard")
|
|
518
|
+
* - data: Optional span data organized by verbosity level for detailed context
|
|
519
|
+
*
|
|
520
|
+
* Returns either PropagationInfo to link the marker span to other traces, or void.
|
|
521
|
+
*
|
|
522
|
+
* Works in conjunction with the userJourney setting to track the user's entire session flow.
|
|
523
|
+
*/
|
|
524
|
+
userJourneyMarker?: MarkerSpanCallback;
|
|
525
|
+
setUserJourneyMarker(userJourneyMarker: MarkerSpanCallback): void;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Optional callback function to programmatically create marker spans in the Clickstream trace.
|
|
529
|
+
* Allows applications to mark specific user interaction events beyond automatic click tracking
|
|
530
|
+
* (e.g., custom UI interactions, gesture events, programmatic actions).
|
|
531
|
+
*
|
|
532
|
+
* The callback receives:
|
|
533
|
+
* - source: A descriptive name for the marker (e.g., "user-swiped-left", "custom-button-action")
|
|
534
|
+
* - data: Optional span data organized by verbosity level for detailed context
|
|
535
|
+
*
|
|
536
|
+
* Returns either PropagationInfo to link the marker span to other traces, or void.
|
|
537
|
+
*
|
|
538
|
+
* Works in conjunction with the clickstream setting to track detailed user interaction patterns.
|
|
539
|
+
*/
|
|
540
|
+
clickstreamMarker?: MarkerSpanCallback;
|
|
541
|
+
setClickstreamMarker(clickstreamMarker: MarkerSpanCallback): void;
|
|
542
|
+
|
|
543
|
+
setFilterConfig(filters: SpanFilter[]): void;
|
|
544
|
+
withSpan<T>(source: string, callback: WithSpanCallback<T>): T;
|
|
545
|
+
|
|
546
|
+
withSpan<T>(
|
|
547
|
+
source: string,
|
|
548
|
+
filteringContext: FilteringContext,
|
|
549
|
+
callback: WithSpanCallback<T>
|
|
550
|
+
): T;
|
|
551
|
+
|
|
552
|
+
withSpan<T>(
|
|
553
|
+
source: string,
|
|
554
|
+
filteringContext: FilteringContext,
|
|
555
|
+
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
556
|
+
callback: WithSpanCallback<T>
|
|
557
|
+
): T;
|
|
558
|
+
|
|
559
|
+
withSpan<T>(
|
|
560
|
+
source: string,
|
|
561
|
+
filteringContext: FilteringContext,
|
|
562
|
+
propagationInfo: PropagationInfo | PropagationInfoCarrier | null,
|
|
563
|
+
options: WithSpanOptions | null,
|
|
564
|
+
callback: WithSpanCallback<T>
|
|
565
|
+
): T;
|
|
566
|
+
}
|
|
567
|
+
|
|
536
568
|
interface TracingState {
|
|
537
569
|
end(): void;
|
|
538
570
|
/**
|
|
@@ -597,7 +629,7 @@ export namespace IOInsights {
|
|
|
597
629
|
* Whether tracing functionality is enabled.
|
|
598
630
|
* If disabled, API is still usable, but methods are no-ops.
|
|
599
631
|
*
|
|
600
|
-
*
|
|
632
|
+
* @default false
|
|
601
633
|
*/
|
|
602
634
|
enabled: boolean;
|
|
603
635
|
|
|
@@ -657,13 +689,17 @@ export namespace IOInsights {
|
|
|
657
689
|
url?: string;
|
|
658
690
|
/**
|
|
659
691
|
* Whether the clickstream trace will be enabled.
|
|
660
|
-
*
|
|
692
|
+
* false - clickstream trace is disabled.
|
|
693
|
+
* nested - clickstream trace is enabled and each subsequent span is a child span of the previous one.
|
|
694
|
+
* sibling - clickstream trace is enabled and each subsequent span is a child of the same initial span.
|
|
661
695
|
* @default false
|
|
662
696
|
*/
|
|
663
697
|
clickstream?: boolean | "nested" | "sibling" | ClickstreamTraceConfig;
|
|
664
698
|
/**
|
|
665
699
|
* Whether the user journey trace will be enabled.
|
|
666
|
-
*
|
|
700
|
+
* false - User Journey trace is disabled.
|
|
701
|
+
* nested - User Journey trace is enabled and each subsequent span is a child span of the previous one.
|
|
702
|
+
* sibling - User Journey trace is enabled and each subsequent span is a child of the same initial span.
|
|
667
703
|
* @default true
|
|
668
704
|
*/
|
|
669
705
|
userJourney?: boolean | "nested" | "sibling" | UserJourneyTraceConfig;
|
|
@@ -679,9 +715,33 @@ export namespace IOInsights {
|
|
|
679
715
|
startupTraceFinished?: () => void;
|
|
680
716
|
|
|
681
717
|
closeTrace?: boolean;
|
|
682
|
-
|
|
718
|
+
/**
|
|
719
|
+
* Optional callback function to programmatically create marker spans in the Clickstream trace.
|
|
720
|
+
* Allows applications to mark specific user interaction events beyond automatic click tracking
|
|
721
|
+
* (e.g., custom UI interactions, gesture events, programmatic actions).
|
|
722
|
+
*
|
|
723
|
+
* The callback receives:
|
|
724
|
+
* - source: A descriptive name for the marker (e.g., "user-swiped-left", "custom-button-action")
|
|
725
|
+
* - data: Optional span data organized by verbosity level for detailed context
|
|
726
|
+
*
|
|
727
|
+
* Returns either PropagationInfo to link the marker span to other traces, or void.
|
|
728
|
+
*
|
|
729
|
+
* Works in conjunction with the clickstream setting to track detailed user interaction patterns.
|
|
730
|
+
*/
|
|
683
731
|
clickstreamMarker?: MarkerSpanCallback;
|
|
684
|
-
|
|
732
|
+
/**
|
|
733
|
+
* Optional callback function to programmatically create marker spans in the User Journey trace.
|
|
734
|
+
* Allows applications to mark significant points in a user's journey through the application
|
|
735
|
+
* (e.g., navigation events, key user actions, milestone completions).
|
|
736
|
+
*
|
|
737
|
+
* The callback receives:
|
|
738
|
+
* - source: A descriptive name for the marker (e.g., "user-navigated-to-dashboard")
|
|
739
|
+
* - data: Optional span data organized by verbosity level for detailed context
|
|
740
|
+
*
|
|
741
|
+
* Returns either PropagationInfo to link the marker span to other traces, or void.
|
|
742
|
+
*
|
|
743
|
+
* Works in conjunction with the userJourney setting to track the user's entire session flow.
|
|
744
|
+
*/
|
|
685
745
|
userJourneyMarker?: MarkerSpanCallback;
|
|
686
746
|
|
|
687
747
|
/**
|
|
@@ -693,13 +753,24 @@ export namespace IOInsights {
|
|
|
693
753
|
* 'otlpExporterConfig' as additional * config.
|
|
694
754
|
*/
|
|
695
755
|
otlpExporterConfig?: OTLPExporterNodeConfigBase;
|
|
696
|
-
|
|
756
|
+
/**
|
|
757
|
+
* OTEL TracerConfig - provides an interface for configuring a Basic Tracer.
|
|
758
|
+
*/
|
|
697
759
|
tracerProviderConfig?: TracerConfig;
|
|
698
|
-
|
|
760
|
+
/**
|
|
761
|
+
* Configuration for the batch span processor buffer settings.
|
|
762
|
+
*/
|
|
699
763
|
batchSpanProcessorConfig?: BufferConfig;
|
|
700
764
|
|
|
765
|
+
/**
|
|
766
|
+
* Configuration for automatic instrumentation of common browser operations.
|
|
767
|
+
* Enables automatic tracing of document load, user interactions, fetch requests, and XHR calls.
|
|
768
|
+
*/
|
|
701
769
|
autoInstrumentations?: AutoInstrumentationOptions;
|
|
702
770
|
|
|
771
|
+
/**
|
|
772
|
+
* Maximum length for parent operation names in span hierarchies.
|
|
773
|
+
*/
|
|
703
774
|
parentNameLimit?: number;
|
|
704
775
|
/**
|
|
705
776
|
* If an OTEL TraceProvider isn't provided to the library,
|
|
@@ -716,11 +787,11 @@ export namespace IOInsights {
|
|
|
716
787
|
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
717
788
|
addResourceAttributesToAttributes?: boolean;
|
|
718
789
|
/**
|
|
719
|
-
* Additional attributes to
|
|
790
|
+
* Additional span attributes to publish as part of each span, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
720
791
|
*/
|
|
721
792
|
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
722
793
|
/**
|
|
723
|
-
* Additional attributes to
|
|
794
|
+
* Additional attributes to publish as part of the OTEL resource definition, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
724
795
|
*/
|
|
725
796
|
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
726
797
|
|
|
@@ -749,10 +820,13 @@ export namespace IOInsights {
|
|
|
749
820
|
export type WithSpanCallback<T> = (tracingState: TracingState) => T;
|
|
750
821
|
|
|
751
822
|
export interface WithSpanDecoratorOptions extends WithSpanOptions {
|
|
752
|
-
argMapping?:
|
|
823
|
+
argMapping?:
|
|
824
|
+
| { [x: string]: string }
|
|
825
|
+
| Array<string | null | undefined>
|
|
826
|
+
| ((...args: any[]) => any);
|
|
753
827
|
thisMapping?: { [x: string]: string } | ((that: any) => any);
|
|
754
828
|
}
|
|
755
|
-
|
|
829
|
+
|
|
756
830
|
export interface PropagationInfo {
|
|
757
831
|
traceparent?: string;
|
|
758
832
|
tracestate?: string;
|
|
@@ -934,6 +1008,10 @@ export namespace IOInsights {
|
|
|
934
1008
|
[key: string]: string | number | boolean;
|
|
935
1009
|
};
|
|
936
1010
|
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Configuration for automatic instrumentation of common browser operations.
|
|
1013
|
+
* Enables automatic tracing of document load, user interactions, fetch requests, and XHR calls.
|
|
1014
|
+
*/
|
|
937
1015
|
export interface AutoInstrumentationOptions {
|
|
938
1016
|
documentLoad?: boolean | DocumentLoadInstrumentationConfig;
|
|
939
1017
|
userInteraction?: boolean | UserInteractionInstrumentationConfig;
|
|
@@ -975,26 +1053,152 @@ export namespace IOInsights {
|
|
|
975
1053
|
sample: number | boolean;
|
|
976
1054
|
}
|
|
977
1055
|
|
|
1056
|
+
/**
|
|
1057
|
+
* Configuration for automatic instrumentation of user interactions.
|
|
1058
|
+
* Extends the base OpenTelemetry user interaction instrumentation with additional throttling options.
|
|
1059
|
+
*/
|
|
978
1060
|
export interface UserInteractionInstrumentationConfig
|
|
979
1061
|
extends UserInteractionInstrumentationConfigBase {
|
|
1062
|
+
/**
|
|
1063
|
+
* Minimum interval in milliseconds between capturing consecutive user interaction events.
|
|
1064
|
+
* Used to throttle high-frequency interactions and reduce span volume.
|
|
1065
|
+
*/
|
|
980
1066
|
throttleIntervalMs?: number;
|
|
981
1067
|
}
|
|
982
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* Configuration for clickstream trace behavior.
|
|
1071
|
+
* Controls how user interaction events are tracked and organized in traces.
|
|
1072
|
+
*/
|
|
1073
|
+
export interface ClickstreamTraceConfig {
|
|
1074
|
+
enabled: boolean;
|
|
1075
|
+
structure?: "sibling" | "nested";
|
|
1076
|
+
descriptiveName?: boolean;
|
|
1077
|
+
events?: string[];
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Configuration for user journey trace behavior.
|
|
1082
|
+
* Controls how significant user journey milestones are tracked throughout the application session.
|
|
1083
|
+
*/
|
|
1084
|
+
export interface UserJourneyTraceConfig {
|
|
1085
|
+
enabled: boolean;
|
|
1086
|
+
structure?: "sibling" | "nested";
|
|
1087
|
+
descriptiveName?: boolean;
|
|
1088
|
+
chainLength?: number;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Callback function type for creating marker spans in user journey or clickstream traces.
|
|
1093
|
+
*
|
|
1094
|
+
* @param source - Descriptive name for the marker span (e.g., "checkout-completed", "navigation-event")
|
|
1095
|
+
* @param data - Optional span data organized by verbosity level, allowing different detail levels for different environments
|
|
1096
|
+
* @returns Either PropagationInfo to link the marker span to other traces, or void
|
|
1097
|
+
*/
|
|
1098
|
+
export type MarkerSpanCallback = (
|
|
1099
|
+
source: string,
|
|
1100
|
+
data?: { [level in SpanVerbosity]: any }
|
|
1101
|
+
) => Promise<PropagationInfo> | void;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Array type for span/log attributes that can contain primitive values or null/undefined.
|
|
1105
|
+
* Used when attribute values need to be represented as arrays in OpenTelemetry context.
|
|
1106
|
+
*/
|
|
1107
|
+
export type AttributeArray = Array<null | undefined | string | number | boolean>;
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Interface for structured attribute data attached to spans, metrics, or log entries.
|
|
1111
|
+
* Supports nested objects and arrays to represent complex attribute hierarchies.
|
|
1112
|
+
*/
|
|
1113
|
+
export interface AttributeData {
|
|
1114
|
+
[key: string]: string | number | boolean | undefined | AttributeArray | unknown[] | object;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Logs API.
|
|
1119
|
+
*/
|
|
1120
|
+
export interface LogsManager extends Manager<LogsSettings> {
|
|
1121
|
+
emit(logRecord: LogRecord): Promise<void> | null;
|
|
1122
|
+
}
|
|
983
1123
|
export interface LogsSettings {
|
|
1124
|
+
/**
|
|
1125
|
+
* Whether logging functionality is enabled.
|
|
1126
|
+
* If disabled, API is still usable, but methods are no-ops.
|
|
1127
|
+
*
|
|
1128
|
+
* @default false
|
|
1129
|
+
*/
|
|
984
1130
|
enabled: boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* OTLP logs exporter endpoint URL.
|
|
1133
|
+
*/
|
|
985
1134
|
url?: string;
|
|
986
|
-
|
|
1135
|
+
/**
|
|
1136
|
+
* Whether to keep the connection alive when sending logs.
|
|
1137
|
+
*
|
|
1138
|
+
* @default true
|
|
1139
|
+
*/
|
|
987
1140
|
keepAlive?: boolean;
|
|
1141
|
+
/**
|
|
1142
|
+
* Settings for the OTLP exporter used to send logs.
|
|
1143
|
+
*/
|
|
988
1144
|
exporterSettings?: OTLPExporterConfigBase;
|
|
1145
|
+
/**
|
|
1146
|
+
* Settings for batching log records before export.
|
|
1147
|
+
*/
|
|
989
1148
|
batchSettings?: BufferConfig;
|
|
1149
|
+
/**
|
|
1150
|
+
* Configuration for the logger provider.
|
|
1151
|
+
*/
|
|
990
1152
|
providerSettings?: LoggerProviderConfig;
|
|
991
|
-
|
|
1153
|
+
/**
|
|
1154
|
+
* Logger provider instance.
|
|
1155
|
+
*/
|
|
992
1156
|
loggerProvider?: LoggerProvider;
|
|
1157
|
+
/**
|
|
1158
|
+
* Log record processors.
|
|
1159
|
+
*/
|
|
993
1160
|
logProcessors?: LogRecordProcessor[];
|
|
1161
|
+
/**
|
|
1162
|
+
* Log record exporters.
|
|
1163
|
+
*/
|
|
994
1164
|
logExporters?: LogRecordExporter[];
|
|
1165
|
+
/**
|
|
1166
|
+
* Name of log level counter metric, set to null to disable.
|
|
1167
|
+
*
|
|
1168
|
+
* Defaults to 'insights_log_level_count'.
|
|
1169
|
+
*/
|
|
1170
|
+
levelCountMetric?: string;
|
|
995
1171
|
|
|
1172
|
+
/**
|
|
1173
|
+
* How long after application startup will any log entries
|
|
1174
|
+
* automatically be associated with the application startup trace.
|
|
1175
|
+
*/
|
|
1176
|
+
startupTraceAssociationTimeoutMs?: number;
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* If true, use a predefined list of filters for well-known
|
|
1180
|
+
* platform logs.
|
|
1181
|
+
*
|
|
1182
|
+
* @default true
|
|
1183
|
+
*/
|
|
1184
|
+
useDefaultFilters?: boolean;
|
|
1185
|
+
/**
|
|
1186
|
+
* Maximum length for log attribute object nesting.
|
|
1187
|
+
*/
|
|
996
1188
|
maxAttributeDepth?: number;
|
|
1189
|
+
/**
|
|
1190
|
+
* Array of filter entries used to determine whether
|
|
1191
|
+
* a particular log entry will be emitted, and
|
|
1192
|
+
* which attributes will be included.
|
|
1193
|
+
*
|
|
1194
|
+
* If no matching filter entry is found,
|
|
1195
|
+
* the settings from 'defaults' are used.
|
|
1196
|
+
*/
|
|
997
1197
|
filters?: LogFilter[];
|
|
1198
|
+
/**
|
|
1199
|
+
* Default settings if appropriate entries aren't found
|
|
1200
|
+
* in 'filters' collection.
|
|
1201
|
+
*/
|
|
998
1202
|
defaults?: LogOptions;
|
|
999
1203
|
|
|
1000
1204
|
/**
|
|
@@ -1003,11 +1207,11 @@ export namespace IOInsights {
|
|
|
1003
1207
|
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
1004
1208
|
addResourceAttributesToAttributes?: boolean;
|
|
1005
1209
|
/**
|
|
1006
|
-
* Additional attributes to
|
|
1210
|
+
* Additional logs attributes to publish as part of each log entry, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
1007
1211
|
*/
|
|
1008
1212
|
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
1009
1213
|
/**
|
|
1010
|
-
* Additional attributes to
|
|
1214
|
+
* Additional attributes to publish as part of the OTEL resource definition, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
|
|
1011
1215
|
*/
|
|
1012
1216
|
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
1013
1217
|
}
|
|
@@ -1030,7 +1234,7 @@ export namespace IOInsights {
|
|
|
1030
1234
|
INFO = 60,
|
|
1031
1235
|
DEBUG = 70,
|
|
1032
1236
|
VERBOSE = 80,
|
|
1033
|
-
ALL = 9999
|
|
1237
|
+
ALL = 9999,
|
|
1034
1238
|
}
|
|
1035
1239
|
|
|
1036
1240
|
export interface Logger {
|
|
@@ -1042,30 +1246,100 @@ export namespace IOInsights {
|
|
|
1042
1246
|
verbose(message: string, ...args: unknown[]): void;
|
|
1043
1247
|
}
|
|
1044
1248
|
|
|
1045
|
-
export interface
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1249
|
+
export interface Log4JSToOTELAppenderConfig
|
|
1250
|
+
{
|
|
1251
|
+
layout?: Layout;
|
|
1252
|
+
maxRecordsBeforeOTELActive?: number;
|
|
1253
|
+
maxTimeBeforeOTELActiveMs?: number;
|
|
1254
|
+
logErrorsInConsole?: boolean;
|
|
1255
|
+
rawLayout?: boolean;
|
|
1050
1256
|
}
|
|
1051
1257
|
|
|
1052
|
-
export interface
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1258
|
+
export interface Manager<TSettings> {
|
|
1259
|
+
settings: TSettings;
|
|
1260
|
+
started: boolean;
|
|
1261
|
+
|
|
1262
|
+
start(): Promise<void>;
|
|
1263
|
+
stop(): Promise<void>;
|
|
1264
|
+
waitForFinalExport(timeoutMs?: number): Promise<void>;
|
|
1057
1265
|
}
|
|
1058
1266
|
|
|
1059
|
-
export
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1267
|
+
export interface Settings {
|
|
1268
|
+
/**
|
|
1269
|
+
* Whether library is enabled.
|
|
1270
|
+
* If disabled, API is still usable, but methods are no-ops.
|
|
1271
|
+
*/
|
|
1272
|
+
enabled: boolean;
|
|
1273
|
+
/**
|
|
1274
|
+
* Suppress double initialization warnings
|
|
1275
|
+
*/
|
|
1276
|
+
suppressDoubleInitializationWarnings?: boolean;
|
|
1277
|
+
/**
|
|
1278
|
+
* 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.
|
|
1279
|
+
*/
|
|
1280
|
+
finalExportTimeoutMs?: number;
|
|
1281
|
+
/**
|
|
1282
|
+
* Interval in milliseconds to wait for any remaining telemetry data to be published by any apps before proceeding with the platform shutdown.
|
|
1283
|
+
*/
|
|
1284
|
+
finalExportGracePeriodMs?: number;
|
|
1063
1285
|
|
|
1064
|
-
|
|
1286
|
+
errorlessMode?: boolean;
|
|
1287
|
+
/**
|
|
1288
|
+
* If the library should log the settings used to initialize it.
|
|
1289
|
+
*
|
|
1290
|
+
* @default true
|
|
1291
|
+
*/
|
|
1292
|
+
logSettingsOnStartup?: boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* If failure to initialize library will throw upstream error.
|
|
1295
|
+
*/
|
|
1296
|
+
failOnInitError?: boolean;
|
|
1297
|
+
/**
|
|
1298
|
+
* If provided, this value will be added to the metrics and span attributes
|
|
1299
|
+
* and to the span filtering context (see 'filters' in TracesSettings).
|
|
1300
|
+
*/
|
|
1301
|
+
platformVersion?: string;
|
|
1302
|
+
/**
|
|
1303
|
+
* If provided, this value will be added to the metrics and traces service.name attribute,
|
|
1304
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
1305
|
+
* a different setting.
|
|
1306
|
+
*/
|
|
1307
|
+
serviceName?: string;
|
|
1308
|
+
/**
|
|
1309
|
+
* If provided, this value will be added to the metrics and traces service.instance.id attribute,
|
|
1310
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
1311
|
+
* a different setting.
|
|
1312
|
+
*/
|
|
1313
|
+
serviceId?: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* If provided, this value will be added to the metrics and traces service.version attribute,
|
|
1316
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
1317
|
+
* a different setting.
|
|
1318
|
+
* attribute.
|
|
1319
|
+
*/
|
|
1320
|
+
serviceVersion?: string;
|
|
1321
|
+
/**
|
|
1322
|
+
* If provided, this value will be added to the metrics and traces user.id attribute,
|
|
1323
|
+
* unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
|
|
1324
|
+
* a different setting.
|
|
1325
|
+
*/
|
|
1326
|
+
userId?: string;
|
|
1065
1327
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1328
|
+
/**
|
|
1329
|
+
* Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
|
|
1330
|
+
*/
|
|
1331
|
+
headers?: { [x: string]: string } | (() => { [x: string]: string });
|
|
1332
|
+
/**
|
|
1333
|
+
* Additional properties to publish as part of each OpenTelemetry signal, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?DefaultValue%`).
|
|
1334
|
+
*/
|
|
1335
|
+
additionalAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
1336
|
+
/**
|
|
1337
|
+
* Additional properties to publish as part of the OpenTelemetry resource definition for all OpenTelemetry signals, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?DefaultValue%`).
|
|
1338
|
+
*/
|
|
1339
|
+
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
1340
|
+
|
|
1341
|
+
traces?: TracesSettings;
|
|
1342
|
+
metrics?: MetricsSettings;
|
|
1343
|
+
logs?: LogsSettings;
|
|
1068
1344
|
}
|
|
1069
|
-
|
|
1070
1345
|
}
|
|
1071
|
-
|