@interopio/otel 0.0.145 → 0.0.148

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