@interopio/otel 0.1.18 → 0.1.20

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/insights.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable max-lines */
3
3
  import { type Layout } from "log4js";
4
4
  import {
5
+ MeterProvider,
5
6
  type Attributes,
6
7
  type Context,
7
8
  type ContextManager,
@@ -34,7 +35,6 @@ import {
34
35
  type LogRecordProcessor,
35
36
  } from "@opentelemetry/sdk-logs";
36
37
  import {
37
- type MeterProvider,
38
38
  type MeterProviderOptions,
39
39
  type MetricReader,
40
40
  type PeriodicExportingMetricReaderOptions,
@@ -363,6 +363,12 @@ export namespace IOInsights {
363
363
  */
364
364
  headers?: { [x: string]: string } | (() => { [x: string]: string });
365
365
 
366
+ /**
367
+ * Overrides the properties of the top-level `ssoAuth` for the metrics export requests; the ones
368
+ * that aren't specified here are taken from it.
369
+ */
370
+ ssoAuth?: SSOAuthSettings;
371
+
366
372
  /**
367
373
  * Whether to add resource attributes to metric data point attributes.
368
374
  *
@@ -431,8 +437,8 @@ export namespace IOInsights {
431
437
  */
432
438
  export interface MetricSettings {
433
439
  enabled?: boolean;
434
- type: MetricType;
435
- name?: string;
440
+ type?: MetricType;
441
+ name: string;
436
442
  description?: string;
437
443
  platformVersion?: string;
438
444
  user?: string;
@@ -459,6 +465,28 @@ export namespace IOInsights {
459
465
  attributeSettings?: {
460
466
  [x: string]: MetricAttributeSettings;
461
467
  }
468
+ /**
469
+ * Attribute allow list: if specified, only the attributes it names are published with the
470
+ * values of the metric - everything else is dropped. Every distinct combination of attribute
471
+ * values is a time series of its own, so this is the way to keep a metric to the dimensions
472
+ * that are actually needed.
473
+ *
474
+ * An entry names an attribute by its flattened (dot-separated) name, or everything nested
475
+ * under it: `"bounds"` covers `"bounds.left"`. An empty list publishes no attributes at all.
476
+ *
477
+ * Can be specified for a single metric (`publishingSettings`), for all metrics
478
+ * (`defaultPublishingSettings`) and in a metric filter. The list of the most specific level
479
+ * that has one applies - a matching filter, then the metric, then the defaults; lists are
480
+ * not merged. Applies to the attributes of the metric values, not to the resource attributes.
481
+ */
482
+ allowAttributes?: string[];
483
+ /**
484
+ * Attribute drop list: the attributes it names are never published with the values of the
485
+ * metric. Entries are matched like the ones of `allowAttributes`. The drop lists of all the
486
+ * levels add up (the defaults, the metric and a matching filter), and an attribute that is
487
+ * dropped stays dropped even if an allow list names it.
488
+ */
489
+ dropAttributes?: string[];
462
490
  }
463
491
 
464
492
  /**
@@ -700,6 +728,12 @@ export namespace IOInsights {
700
728
  export interface InstanceErrorHandlerArgs {
701
729
  application: string;
702
730
  stack?: ApplicationStack;
731
+ /**
732
+ * The type (name) of the error, e.g. "TypeError". Published as the `error.type` attribute of
733
+ * the app_error metric - the same key the error spans use - so keep the set of values small:
734
+ * every distinct value is a metric series of its own.
735
+ */
736
+ errorType?: string;
703
737
  }
704
738
  /**
705
739
  * @ignore
@@ -1057,6 +1091,17 @@ export namespace IOInsights {
1057
1091
  */
1058
1092
  clickstreamMarker?: MarkerSpanCallback;
1059
1093
 
1094
+ /**
1095
+ * Ends every span that is still open, so that it gets exported: a span is only exported once
1096
+ * it has ended, and whatever is still open when the process goes away is lost. The spans are
1097
+ * ended as they stand and marked with an `endedByShutdown` attribute (and
1098
+ * `endedByShutdownReason`, when a reason is given). Called by waitForFinalExport(); call it
1099
+ * directly ahead of any other last flush.
1100
+ *
1101
+ * @returns the number of spans that were ended
1102
+ */
1103
+ endOpenSpans?: (reason?: string) => number;
1104
+
1060
1105
  /**
1061
1106
  * Allows updating the configured filters.
1062
1107
  */
@@ -1315,23 +1360,32 @@ export namespace IOInsights {
1315
1360
  rootPropagationInfo?: PropagationInfo;
1316
1361
 
1317
1362
  /**
1318
- * Name of span hit counter metric, set to null to disable.
1363
+ * If `true` or a string, span hits are published as a counter metric. If a string value
1364
+ * is specified, this will be the name of the metric. Otherwise, the default
1365
+ * "insights_trace_count" is used. Set to `false` or `null` to disable the metric. Spans opt in
1366
+ * through the `countMetric` span creation option (see 'filters' and 'defaults').
1319
1367
  *
1320
- * @default insights_trace_count
1368
+ * @default true
1321
1369
  */
1322
- countMetric?: string;
1370
+ countMetric?: boolean | string | null;
1323
1371
  /**
1324
- * Name of span duration histogram metric, set to null to disable.
1372
+ * If `true` or a string, span durations are published as a histogram metric. If a string
1373
+ * value is specified, this will be the name of the metric. Otherwise, the default
1374
+ * "insights_trace_duration" is used. Set to `false` or `null` to disable the metric. Spans opt in
1375
+ * through the `durationMetric` span creation option (see 'filters' and 'defaults').
1325
1376
  *
1326
- * @default insights_trace_duration
1377
+ * @default true
1327
1378
  */
1328
- durationMetric?: string;
1379
+ durationMetric?: boolean | string | null;
1329
1380
  /**
1330
- * Name of span result counter metric, set to null to disable.
1381
+ * If `true` or a string, span results (status codes) are published as a counter metric.
1382
+ * If a string value is specified, this will be the name of the metric. Otherwise, the
1383
+ * default "insights_trace_result" is used. Set to `false` or `null` to disable the metric. Spans opt
1384
+ * in through the `resultMetric` span creation option (see 'filters' and 'defaults').
1331
1385
  *
1332
- * @default insights_trace_result
1386
+ * @default true
1333
1387
  */
1334
- resultMetric?: string;
1388
+ resultMetric?: boolean | string | null;
1335
1389
 
1336
1390
  /**
1337
1391
  * If `true` (or a configuration object with `enabled: true`), io.Insights
@@ -1677,6 +1731,12 @@ export namespace IOInsights {
1677
1731
  * Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
1678
1732
  */
1679
1733
  headers?: { [x: string]: string } | (() => { [x: string]: string });
1734
+
1735
+ /**
1736
+ * Overrides the properties of the top-level `ssoAuth` for the traces export requests; the ones
1737
+ * that aren't specified here are taken from it.
1738
+ */
1739
+ ssoAuth?: SSOAuthSettings;
1680
1740
  /**
1681
1741
  * Whether to add resource attributes to span attributes.
1682
1742
  *
@@ -1802,6 +1862,9 @@ export namespace IOInsights {
1802
1862
  */
1803
1863
  export interface WithSpanOptions extends Omit<SpanCreationOptions, "sample"> {
1804
1864
  defaultFilters?: SpanFilter[];
1865
+ /**
1866
+ * Used to determine the structure of sequence spans.
1867
+ */
1805
1868
  structure?: "sibling" | "nested";
1806
1869
  /**
1807
1870
  * Overrides the name of the exported OTEL span. The `source` remains the identity
@@ -1864,20 +1927,18 @@ export namespace IOInsights {
1864
1927
  disableNesting?: boolean;
1865
1928
 
1866
1929
  /**
1867
- * If true, enabled spans will also be published as log entries using the `traceLogger` passed to the
1868
- * builder instance when building the Traces module.
1869
- *
1870
- * @default false
1871
- */
1872
- log?: boolean;
1873
-
1874
- /**
1875
- * If true, disabled spans will also be published as log entries using the `traceLogger` passed to the
1876
- * builder instance when building the Traces module.
1877
- *
1930
+ * "Traces as logs": whether the span is also published as a log entry, using the `traceLogger`
1931
+ * passed to the builder instance when building the Traces module. `true` logs the span when it
1932
+ * is enabled; `false` turns the logging off altogether; a `TracesAsLogsOptions` object says
1933
+ * what is logged in more detail.
1934
+ *
1935
+ * The places the option can be set in - a matching filter, the span's own options, the
1936
+ * `defaults` - are combined option by option: `defaults: { log: { includeResourceAttributes: true } }`
1937
+ * with `log: true` in a filter logs that filter's spans with their resource attributes.
1938
+ *
1878
1939
  * @default false
1879
1940
  */
1880
- logOnDisabledSpans?: boolean;
1941
+ log?: boolean | TracesAsLogsOptions;
1881
1942
 
1882
1943
  /**
1883
1944
  * Whether the span will be counted in the insights_trace_count metric. See TracesSettings.countMetric.
@@ -2247,7 +2308,7 @@ export namespace IOInsights {
2247
2308
  *
2248
2309
  * @default false
2249
2310
  */
2250
- requestFirstByteDurationMetric?: boolean | string;
2311
+ requestFirstByteDurationMetric?: boolean | string | null;
2251
2312
 
2252
2313
  /**
2253
2314
  * If `true` or a string, the end-to-end request time (request issued until the response
@@ -2269,7 +2330,7 @@ export namespace IOInsights {
2269
2330
  *
2270
2331
  * @default false
2271
2332
  */
2272
- requestTotalDurationMetric?: boolean | string;
2333
+ requestTotalDurationMetric?: boolean | string | null;
2273
2334
 
2274
2335
  /**
2275
2336
  * If `true` or a string, the download phase (response headers received until the response
@@ -2284,7 +2345,7 @@ export namespace IOInsights {
2284
2345
  *
2285
2346
  * @default false
2286
2347
  */
2287
- requestBodyDownloadDurationMetric?: boolean | string;
2348
+ requestBodyDownloadDurationMetric?: boolean | string | null;
2288
2349
 
2289
2350
  /**
2290
2351
  * Explicit histogram bucket boundaries for requestFirstByteDurationMetric, in seconds, ascending.
@@ -2328,7 +2389,7 @@ export namespace IOInsights {
2328
2389
  *
2329
2390
  * @default false
2330
2391
  */
2331
- requestBodyDownloadThroughputMetric?: boolean | string;
2392
+ requestBodyDownloadThroughputMetric?: boolean | string | null;
2332
2393
 
2333
2394
  /**
2334
2395
  * Explicit histogram bucket boundaries for requestBodyDownloadThroughputMetric, in
@@ -2345,7 +2406,7 @@ export namespace IOInsights {
2345
2406
  *
2346
2407
  * @default false
2347
2408
  */
2348
- requestBytesMetric?: boolean | string;
2409
+ requestBytesMetric?: boolean | string | null;
2349
2410
 
2350
2411
  /**
2351
2412
  * If `true` or a string, the request size in bytes will be published as a histogram metric.
@@ -2354,7 +2415,7 @@ export namespace IOInsights {
2354
2415
  *
2355
2416
  * @default false
2356
2417
  */
2357
- responseBytesMetric?: boolean | string;
2418
+ responseBytesMetric?: boolean | string | null;
2358
2419
 
2359
2420
  /**
2360
2421
  * Controls only the naming of the fetch/XHR request spans.
@@ -2441,7 +2502,7 @@ export namespace IOInsights {
2441
2502
  *
2442
2503
  * @default false
2443
2504
  */
2444
- inputDelayMetric?: boolean | string;
2505
+ inputDelayMetric?: boolean | string | null;
2445
2506
 
2446
2507
  /**
2447
2508
  * Explicit histogram bucket boundaries for inputDelayMetric, in seconds, ascending.
@@ -2491,7 +2552,7 @@ export namespace IOInsights {
2491
2552
  *
2492
2553
  * @default false
2493
2554
  */
2494
- eventLoopBlockingMetric?: boolean | string;
2555
+ eventLoopBlockingMetric?: boolean | string | null;
2495
2556
 
2496
2557
  /**
2497
2558
  * Explicit histogram bucket boundaries for eventLoopBlockingMetric, in seconds,
@@ -2544,7 +2605,7 @@ export namespace IOInsights {
2544
2605
  *
2545
2606
  * @default false
2546
2607
  */
2547
- dnsDurationMetric?: boolean | string;
2608
+ dnsDurationMetric?: boolean | string | null;
2548
2609
 
2549
2610
  /**
2550
2611
  * Explicit histogram bucket boundaries for dnsDurationMetric, in seconds, ascending.
@@ -2561,7 +2622,7 @@ export namespace IOInsights {
2561
2622
  *
2562
2623
  * @default false
2563
2624
  */
2564
- connectDurationMetric?: boolean | string;
2625
+ connectDurationMetric?: boolean | string | null;
2565
2626
 
2566
2627
  /**
2567
2628
  * Explicit histogram bucket boundaries for connectDurationMetric, in seconds, ascending.
@@ -2578,7 +2639,7 @@ export namespace IOInsights {
2578
2639
  *
2579
2640
  * @default false
2580
2641
  */
2581
- tlsDurationMetric?: boolean | string;
2642
+ tlsDurationMetric?: boolean | string | null;
2582
2643
 
2583
2644
  /**
2584
2645
  * Explicit histogram bucket boundaries for tlsDurationMetric, in seconds, ascending.
@@ -2598,7 +2659,7 @@ export namespace IOInsights {
2598
2659
  *
2599
2660
  * @default false
2600
2661
  */
2601
- firstByteDurationMetric?: boolean | string;
2662
+ firstByteDurationMetric?: boolean | string | null;
2602
2663
 
2603
2664
  /**
2604
2665
  * Explicit histogram bucket boundaries for firstByteDurationMetric, in seconds, ascending.
@@ -2620,7 +2681,7 @@ export namespace IOInsights {
2620
2681
  *
2621
2682
  * @default false
2622
2683
  */
2623
- downloadThroughputMetric?: boolean | string;
2684
+ downloadThroughputMetric?: boolean | string | null;
2624
2685
 
2625
2686
  /**
2626
2687
  * Explicit histogram bucket boundaries for downloadThroughputMetric, in bytes
@@ -2646,7 +2707,55 @@ export namespace IOInsights {
2646
2707
  *
2647
2708
  * @default false
2648
2709
  */
2649
- cacheStateMetric?: boolean | string;
2710
+ cacheStateMetric?: boolean | string | null;
2711
+ }
2712
+
2713
+ /**
2714
+ * What "traces as logs" (the `log` span creation option) publishes for a span.
2715
+ */
2716
+ export interface TracesAsLogsOptions {
2717
+ /**
2718
+ * If true, the span is published as a log entry when it is enabled. Leave it out to keep what
2719
+ * a less specific place (the span's options, the `defaults`) says.
2720
+ *
2721
+ * @default false
2722
+ */
2723
+ enabled?: boolean;
2724
+
2725
+ /**
2726
+ * If true, the span is published as a log entry when it is disabled. There is no span behind
2727
+ * such an entry: it is logged at the level the span is configured with, with ids of its own
2728
+ * (under the trace and parent it would have had), the attributes it would have carried, and
2729
+ * `insightsSpanDisabled: true` among them.
2730
+ *
2731
+ * @default false
2732
+ */
2733
+ onDisabledSpans?: boolean;
2734
+
2735
+ /**
2736
+ * If true, the log entries published for the span also carry the resource attributes, as
2737
+ * `resource` in the details object that follows the span attributes. They are the same for every
2738
+ * span of a process, so they are left out by default.
2739
+ *
2740
+ * @default false
2741
+ */
2742
+ includeResourceAttributes?: boolean;
2743
+
2744
+ /**
2745
+ * If true, the log entries published for the span also carry its events - among them the
2746
+ * exceptions recorded on it, with their type, message and stack trace, which can make the
2747
+ * entries long.
2748
+ *
2749
+ * @default false
2750
+ */
2751
+ includeEvents?: boolean;
2752
+
2753
+ /**
2754
+ * If true, the log entries published for the span also carry its links to other spans.
2755
+ *
2756
+ * @default false
2757
+ */
2758
+ includeLinks?: boolean;
2650
2759
  }
2651
2760
 
2652
2761
  /**
@@ -2745,7 +2854,7 @@ export namespace IOInsights {
2745
2854
  *
2746
2855
  * @default false
2747
2856
  */
2748
- messagesMetric?: boolean | string;
2857
+ messagesMetric?: boolean | string | null;
2749
2858
 
2750
2859
  /**
2751
2860
  * If `true` or a string, a counter summing WebSocket payload bytes is published
@@ -2754,7 +2863,7 @@ export namespace IOInsights {
2754
2863
  *
2755
2864
  * @default false
2756
2865
  */
2757
- bytesMetric?: boolean | string;
2866
+ bytesMetric?: boolean | string | null;
2758
2867
 
2759
2868
  /**
2760
2869
  * If `true` or a string, the connection establishment time (construction until
@@ -2764,7 +2873,7 @@ export namespace IOInsights {
2764
2873
  *
2765
2874
  * @default false
2766
2875
  */
2767
- connectDurationMetric?: boolean | string;
2876
+ connectDurationMetric?: boolean | string | null;
2768
2877
 
2769
2878
  /**
2770
2879
  * Explicit histogram bucket boundaries for connectDurationMetric, in seconds, ascending.
@@ -2808,7 +2917,7 @@ export namespace IOInsights {
2808
2917
  *
2809
2918
  * @default false
2810
2919
  */
2811
- clsMetric?: boolean | string;
2920
+ clsMetric?: boolean | string | null;
2812
2921
 
2813
2922
  /**
2814
2923
  * Explicit histogram bucket boundaries for clsMetric (unitless score), ascending.
@@ -2826,7 +2935,7 @@ export namespace IOInsights {
2826
2935
  *
2827
2936
  * @default false
2828
2937
  */
2829
- inpMetric?: boolean | string;
2938
+ inpMetric?: boolean | string | null;
2830
2939
 
2831
2940
  /**
2832
2941
  * Explicit histogram bucket boundaries for inpMetric, in seconds, ascending.
@@ -2843,7 +2952,7 @@ export namespace IOInsights {
2843
2952
  *
2844
2953
  * @default false
2845
2954
  */
2846
- lcpMetric?: boolean | string;
2955
+ lcpMetric?: boolean | string | null;
2847
2956
 
2848
2957
  /**
2849
2958
  * Explicit histogram bucket boundaries for lcpMetric, in seconds, ascending.
@@ -2888,6 +2997,18 @@ export namespace IOInsights {
2888
2997
  * @default 0
2889
2998
  */
2890
2999
  chainLength?: number;
3000
+ /**
3001
+ * Unless `false`, focus spans for windows that sit in a workspace also
3002
+ * carry the workspace context - workspaceId, workspaceName and
3003
+ * workspaceTitle. Only workspace membership is resolvable synchronously;
3004
+ * the id/name/title are fetched from the workspaces frame asynchronously
3005
+ * (two round trips per focus change into a workspace window) and added to
3006
+ * the still-open focus span when they arrive - a focus change racing the
3007
+ * lookup loses only these attributes.
3008
+ *
3009
+ * @default true
3010
+ */
3011
+ includeWorkspaceInfo?: boolean;
2891
3012
  }
2892
3013
 
2893
3014
  /**
@@ -3003,18 +3124,6 @@ export namespace IOInsights {
3003
3124
  * Log record exporters.
3004
3125
  */
3005
3126
  logExporters?: (exporterSettings: OTLPExporterNodeConfigBase, settings: LogsSettings, otelSettings: Settings) => LogRecordExporter[];
3006
- /**
3007
- * Name of log level counter metric, set to null to disable.
3008
- *
3009
- * @default insights_log_level_count
3010
- */
3011
- levelCountMetric?: string;
3012
-
3013
- // /**
3014
- // * How long after application startup will any log entries
3015
- // * automatically be associated with the application startup trace.
3016
- // */
3017
- // startupTraceAssociationTimeoutMs?: number;
3018
3127
 
3019
3128
  /**
3020
3129
  * If true, use a predefined list of filters for well-known
@@ -3050,6 +3159,12 @@ export namespace IOInsights {
3050
3159
  */
3051
3160
  headers?: { [x: string]: string } | (() => { [x: string]: string });
3052
3161
 
3162
+ /**
3163
+ * Overrides the properties of the top-level `ssoAuth` for the logs export requests; the ones
3164
+ * that aren't specified here are taken from it.
3165
+ */
3166
+ ssoAuth?: SSOAuthSettings;
3167
+
3053
3168
  /**
3054
3169
  * Whether to add resource attributes to log entry attributes.
3055
3170
  *
@@ -3184,6 +3299,162 @@ export namespace IOInsights {
3184
3299
  waitForFinalExport(timeoutMs?: number): Promise<void>;
3185
3300
  }
3186
3301
 
3302
+ /**
3303
+ * The SSO login information, as far as io.Insights is concerned - see SSOAuthSettings. Whatever
3304
+ * else the login object carries goes into the `auth` header with it (`useAuthHeader`).
3305
+ */
3306
+ export interface SSOAuthInfo {
3307
+ /** The SSO token. */
3308
+ token?: string;
3309
+ /** Headers the SSO login wants sent along. */
3310
+ headers?: { [x: string]: string };
3311
+ }
3312
+
3313
+ /**
3314
+ * Settings for injecting the io.Connect SSO login information into the headers of the
3315
+ * OpenTelemetry export requests.
3316
+ *
3317
+ * The login is asked for on every export (and cached for a while - see `authInfoCacheMs`), so
3318
+ * it doesn't have to be there when io.Insights is initialized, and a refreshed token is picked
3319
+ * up. Exports that happen before anybody has logged in go out without it, unless `waitForLogin`
3320
+ * is set.
3321
+ *
3322
+ * In io.Connect Desktop the login of the platform is used: by the platform itself, and by the
3323
+ * applications that are allowed to have it (`allowAuthInfo` set to `true` in the application
3324
+ * definition) - the rest export without it. It isn't available to Node.js applications. The
3325
+ * io.Connect Gateway gets the login as it is when the gateway is started, which is usually
3326
+ * before anybody has logged in.
3327
+ *
3328
+ * Only applies to the OTLP exporters io.Insights creates itself (from `url`), and to custom
3329
+ * ones that are created from the exporter settings they are handed.
3330
+ */
3331
+ export interface SSOAuthSettings {
3332
+ /**
3333
+ * If `true`, the io.Connect SSO token is sent as the `Authorization` header of the
3334
+ * OpenTelemetry export requests, together with any headers the SSO login provides.
3335
+ *
3336
+ * @default false
3337
+ */
3338
+ enabled?: boolean;
3339
+ /**
3340
+ * If `true`, will also use a custom `auth` header to send the entire io.Connect SSO
3341
+ * authorization object as a JSON string, unless `headers` already specifies one.
3342
+ *
3343
+ * @default false
3344
+ */
3345
+ useAuthHeader?: boolean;
3346
+ /**
3347
+ * If `true`, will use the io.Connect SSO token as-is. If `false`, "Bearer " will be prepended
3348
+ * to the token if it lacks the prefix.
3349
+ *
3350
+ * @default true
3351
+ */
3352
+ useRawToken?: boolean;
3353
+ /**
3354
+ * If `true`, an export that happens before anybody has logged in waits for the login - for
3355
+ * up to `waitForLoginTimeoutMs` - instead of going out without it (and most likely being
3356
+ * rejected, and lost). Only until the first login, and only until the first time the wait
3357
+ * times out: from then on exports don't wait.
3358
+ *
3359
+ * The wait is part of the export, so it counts against the export timeout of the batch
3360
+ * processors (`processorSettings.exportTimeoutMillis`, 30 seconds by default), and whatever
3361
+ * is published in the meantime queues up (`processorSettings.maxQueueSize`).
3362
+ *
3363
+ * @default false
3364
+ */
3365
+ waitForLogin?: boolean;
3366
+ /**
3367
+ * How long an export waits for the login when `waitForLogin` is set, in milliseconds.
3368
+ *
3369
+ * @default 5000
3370
+ */
3371
+ waitForLoginTimeoutMs?: number;
3372
+ /**
3373
+ * For how long the login is reused before it is asked for again, in milliseconds. In an
3374
+ * application of io.Connect Desktop asking means a round trip to the platform.
3375
+ *
3376
+ * @default 30000
3377
+ */
3378
+ authInfoCacheMs?: number;
3379
+ /**
3380
+ * How long to wait for the login to be provided, in milliseconds. A login that doesn't come
3381
+ * in time is treated like one that isn't available: the export goes out without it, and the
3382
+ * login isn't asked for again until `authInfoCacheMs` has passed.
3383
+ *
3384
+ * @default 5000
3385
+ */
3386
+ authInfoTimeoutMs?: number;
3387
+ /**
3388
+ * Provides the login. By default the login of io.Connect Desktop is used, when running in it
3389
+ * (`iodesktop.getAuth()`); hosts with a login of their own specify this. Called on every export
3390
+ * that doesn't find the login in the cache; can return `null` while nobody has logged in.
3391
+ */
3392
+ getAuthInfo?: () => SSOAuthInfo | null | undefined | Promise<SSOAuthInfo | null | undefined>;
3393
+ }
3394
+
3395
+ /**
3396
+ * In io.Connect Desktop, the settings of a late io.Insights initialization - see
3397
+ * Settings.lateInit.
3398
+ */
3399
+ export interface LateInitSettings {
3400
+ /**
3401
+ * Whether io.Insights is initialized late. Applies to an object that leaves it out as well.
3402
+ *
3403
+ * @default false
3404
+ */
3405
+ enabled?: boolean;
3406
+ /**
3407
+ * At what point of the startup io.Insights is initialized. "post-sso" - the only stage for
3408
+ * now - means right after the SSO authentication has completed, which is after the "pre-sso"
3409
+ * autoStart apps have been started and before the "post-sso" ones are.
3410
+ *
3411
+ * @default "post-sso"
3412
+ */
3413
+ initStage?: "post-sso";
3414
+ /**
3415
+ * How long (in milliseconds) to wait for a "pre-sso" autoStart application to provide
3416
+ * additional OTEL attributes by invoking the T42.Otel.AddAttributes Interop method
3417
+ * (`attributes` and `resourceAttributes`, merged into `additionalAttributes` and
3418
+ * `additionalResourceAttributes`) before io.Insights gets initialized. The method is
3419
+ * registered before the "pre-sso" apps are started, the wait begins once the SSO
3420
+ * authentication has completed, and the first invocation ends it; attributes that arrive
3421
+ * later are ignored. `0` (the default) disables the hand-over: the method is not registered
3422
+ * and nothing is waited for. How long the startup waited is published as the
3423
+ * `otelAttributesWaitMs` attribute of the startup span, and logged.
3424
+ *
3425
+ * @default 0
3426
+ */
3427
+ attributesTimeoutMs?: number;
3428
+ }
3429
+
3430
+ /**
3431
+ * In io.Connect Desktop, the settings of the last chance export of the telemetry describing an
3432
+ * abnormal exit - see Settings.lastChanceExportOnError.
3433
+ */
3434
+ export interface LastChanceExportOnErrorSettings {
3435
+ /**
3436
+ * Whether the telemetry describing an abnormal exit is got out before the platform exits.
3437
+ * Applies to an object that leaves it out as well.
3438
+ *
3439
+ * @default true
3440
+ */
3441
+ enabled?: boolean;
3442
+ /**
3443
+ * How long (in milliseconds) to wait for io.Insights to initialize after an error that takes
3444
+ * the platform down before a late initialization, before proceeding with exiting the platform.
3445
+ *
3446
+ * @default 5000
3447
+ */
3448
+ initTimeoutMs?: number;
3449
+ /**
3450
+ * How long (in milliseconds) to wait for the final export of the telemetry before an abnormal
3451
+ * exit of the platform. Used instead of `finalExportTimeoutMs`.
3452
+ *
3453
+ * @default 5000
3454
+ */
3455
+ exportTimeoutMs?: number;
3456
+ }
3457
+
3187
3458
  export interface Settings {
3188
3459
  /**
3189
3460
  * Whether library is enabled.
@@ -3191,6 +3462,69 @@ export namespace IOInsights {
3191
3462
  */
3192
3463
  enabled: boolean;
3193
3464
 
3465
+ /**
3466
+ * In io.Connect Desktop, initializes io.Insights late in the startup - right after the SSO
3467
+ * authentication has completed (see LateInitSettings.initStage) - rather than as early as
3468
+ * possible. The startup telemetry gathered until then is buffered and published once
3469
+ * io.Insights is initialized.
3470
+ *
3471
+ * Early initialization makes the startup trace richer and helps telemetry be published even
3472
+ * in the case of an early startup error; a late one lets a "pre-sso" autoStart application
3473
+ * provide additional OTEL attributes at runtime before io.Insights gets initialized (see
3474
+ * LateInitSettings.attributesTimeoutMs), and lets the platform's own export requests carry
3475
+ * the SSO login from the first one on (see `ssoAuth`).
3476
+ *
3477
+ * `true` switches it on with the default settings; an object also configures it. Has no
3478
+ * effect when io.Insights is disabled.
3479
+ *
3480
+ * @default false
3481
+ */
3482
+ lateInit?: boolean | LateInitSettings;
3483
+
3484
+ /**
3485
+ * In io.Connect Desktop, gets the telemetry describing an abnormal exit out before the
3486
+ * platform exits: a startup error, an unhandled error (crash) at any later point, an exit
3487
+ * with an error code, or a shutdown before the startup has completed (restarts excluded).
3488
+ * The final export waits for up to LastChanceExportOnErrorSettings.exportTimeoutMs instead
3489
+ * of `finalExportTimeoutMs`, and - with a late initialization (`lateInit`) - io.Insights is
3490
+ * initialized after all, within LastChanceExportOnErrorSettings.initTimeoutMs, when the
3491
+ * platform goes down before it was, so the telemetry buffered so far, the error included,
3492
+ * still gets published.
3493
+ *
3494
+ * `true` (the default) uses the default settings; an object configures them; `false`
3495
+ * switches it off - an abnormal exit then waits for the final export as long as a normal one
3496
+ * would, and telemetry buffered before a late initialization is lost.
3497
+ *
3498
+ * @default true
3499
+ */
3500
+ lastChanceExportOnError?: boolean | LastChanceExportOnErrorSettings;
3501
+
3502
+ /**
3503
+ * If `true`, io.Insights publishes through the host application's own
3504
+ * OTEL SDK instead of building providers of its own: the tracer, meter
3505
+ * and logger providers are taken from the OTEL API globals
3506
+ * unconditionally (the globals are never absent - unregistered APIs
3507
+ * return proxy/noop providers, so there is no meaningful fallback).
3508
+ *
3509
+ * Ordering matters: the trace and logs globals are proxies that
3510
+ * late-bind, so signals emitted before the host registers its SDK are
3511
+ * dropped and start flowing once it does; the metrics global is a
3512
+ * snapshot, which io.Insights compensates for by re-resolving it per
3513
+ * meter creation - but meters created before the host registered stay
3514
+ * bound to the noop. Register the host SDK before initializing
3515
+ * io.Insights for full coverage.
3516
+ *
3517
+ * In this mode io.Insights registers nothing: registerGlobalOTELObjects
3518
+ * is effectively ignored, the global propagator is whatever the host
3519
+ * registered (header injection rides it), resource attributes come from
3520
+ * the host's providers (io.Insights resource settings are unused), and
3521
+ * waitForFinalExport is best-effort - flushing on shutdown is the host
3522
+ * SDK's responsibility.
3523
+ *
3524
+ * @default false
3525
+ */
3526
+ useExistingOTELSDK?: boolean;
3527
+
3194
3528
  /**
3195
3529
  * Whether the library should register its own instances of the OTEL SDK global objects,
3196
3530
  * e.g. MeterProvider. This is useful for controlling which instance of the SDK is used,
@@ -3246,28 +3580,19 @@ export namespace IOInsights {
3246
3580
  applicationName?: string;
3247
3581
 
3248
3582
  /**
3249
- * Settings for injecting the io.Connect SSO login information into OpenTelemetry export requests when the platform is configured to use the Electron networking stack.
3583
+ * In io.Connect Desktop: if `true`, the platform will add CPU, memory, and OS information
3584
+ * to the resource attributes of the published signals.
3585
+ *
3586
+ * @default false
3250
3587
  */
3251
- ssoAuth?: {
3252
- /**
3253
- * If `true`, will instruct the platform to use the io.Connect SSO login information when making OpenTelemetry export requests. This only applies to OpenTelemetry exports performed after SSO completes.
3254
- *
3255
- * @default false
3256
- */
3257
- enabled?: boolean;
3258
- /**
3259
- * If `true`, will use a custom `auth` header to send the entire io.Connect SSO authorization object as a JSON string.
3260
- *
3261
- * @default false
3262
- */
3263
- useAuthHeader?: boolean;
3264
- /**
3265
- * If `true`, will use the io.Connect SSO token as-is. If `false`, "Bearer " will be prepended to the token if it lacks the prefix.
3266
- *
3267
- * @default true
3268
- */
3269
- useRawToken?: boolean;
3270
- };
3588
+ addHardwareDataToAttributes?: boolean;
3589
+
3590
+ /**
3591
+ * Settings for injecting the io.Connect SSO login information into the headers of the
3592
+ * OpenTelemetry export requests. Can be overridden for the traces, the metrics and the logs
3593
+ * in their own settings. See SSOAuthSettings.
3594
+ */
3595
+ ssoAuth?: SSOAuthSettings;
3271
3596
 
3272
3597
  /**
3273
3598
  * Suppress double initialization warnings from the OTEL SDK.
@@ -3277,13 +3602,20 @@ export namespace IOInsights {
3277
3602
  suppressDoubleInitializationWarnings?: boolean;
3278
3603
 
3279
3604
  /**
3280
- * 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.
3605
+ * Interval in milliseconds to wait for any remaining telemetry data
3606
+ * to be exported during shutdown of the platform.
3607
+ *
3608
+ * This is the maximum awaiting interval and the platform may shutdown
3609
+ * before it expires if all telemetry data has already been published.
3610
+ *
3611
+ * If `0`, the final export is fire-and-forget: it is started - which also ends, and thereby
3612
+ * publishes, the spans that are still open - but the shutdown doesn't wait for it, so only
3613
+ * what makes it out before the process exits is published. On an abnormal exit of the
3614
+ * platform, `lastChanceExportOnError.exportTimeoutMs` is used instead.
3615
+ *
3616
+ * @default 0
3281
3617
  */
3282
3618
  finalExportTimeoutMs?: number;
3283
- /**
3284
- * Interval in milliseconds to wait for any remaining telemetry data to be published by any apps before proceeding with the platform shutdown.
3285
- */
3286
- finalExportGracePeriodMs?: number;
3287
3619
 
3288
3620
  /**
3289
3621
  * If `true`, the library will swallow all errors, instead of propagating them.