@interopio/otel 0.0.219 → 0.0.220
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 +390 -52
- package/package.json +3 -3
package/insights.d.ts
CHANGED
|
@@ -50,17 +50,17 @@ import { deprecate } from "util";
|
|
|
50
50
|
export namespace IOInsights {
|
|
51
51
|
export interface API extends Manager<Settings> {
|
|
52
52
|
/**
|
|
53
|
-
* io.insights.metrics
|
|
53
|
+
* io.insights Metrics API, often accessible as io.insights.metrics
|
|
54
54
|
*/
|
|
55
55
|
metrics: MetricsManager;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* io.insights.traces
|
|
58
|
+
* io.insights Traces API, often accessible as io.insights.traces
|
|
59
59
|
*/
|
|
60
60
|
traces: TracesManager;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* io.insights.logs
|
|
63
|
+
* io.insights Logs API, often accessible as io.insights.logs
|
|
64
64
|
*/
|
|
65
65
|
logs: LogsManager;
|
|
66
66
|
}
|
|
@@ -126,9 +126,42 @@ export namespace IOInsights {
|
|
|
126
126
|
* Metrics API.
|
|
127
127
|
*/
|
|
128
128
|
export interface MetricsManager extends Manager<MetricsSettings> {
|
|
129
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Creates or retrieves a metric by name.
|
|
131
|
+
*
|
|
132
|
+
* If a metric is already created with this name, it will be returned.
|
|
133
|
+
*
|
|
134
|
+
* Otherwise, if settings exist for a metric with this name, either provided
|
|
135
|
+
* by the platform or by configuration, a metric will be created.
|
|
136
|
+
*
|
|
137
|
+
* Otherwise, returns undefined.
|
|
138
|
+
*
|
|
139
|
+
* Subsequent calls to this method with the same name return the same metric.
|
|
140
|
+
*
|
|
141
|
+
* @param name the name of the metric, e.g. platform_startup
|
|
142
|
+
*/
|
|
143
|
+
get(name: string): Metric | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Creates or retrieves a metric based on the provided settings.
|
|
146
|
+
*
|
|
147
|
+
* If a metric is already created with this name, it will be returned.
|
|
148
|
+
*
|
|
149
|
+
* Otherwise, if settings exist for a metric with this name, either provided
|
|
150
|
+
* by the platform or by configuration, they will be merged with the
|
|
151
|
+
* settings provided to this method before creating it.
|
|
152
|
+
*
|
|
153
|
+
* Otherwise, the settings provided will be used as is.
|
|
154
|
+
*
|
|
155
|
+
* Subsequent calls to this method with the same name return the same metric.
|
|
156
|
+
*
|
|
157
|
+
* @param settings settings to use when creating the metric
|
|
158
|
+
*/
|
|
130
159
|
getFromSettings(settings: MetricSettings): Metric | undefined;
|
|
131
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Builder class used to set up Metrics module.
|
|
164
|
+
*/
|
|
132
165
|
export interface MetricsManagerBuilder {
|
|
133
166
|
build(): MetricsManager;
|
|
134
167
|
withLogger(logger: Logger): this;
|
|
@@ -137,11 +170,18 @@ export namespace IOInsights {
|
|
|
137
170
|
withDependencyContainer(container: MetricsDependencyContainer): this;
|
|
138
171
|
}
|
|
139
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Advanced usage. Allows overriding meterProvider and metricReaders instantiation
|
|
175
|
+
* logic.
|
|
176
|
+
*/
|
|
140
177
|
export type MetricsMeterProviderCreateFunc = () => {
|
|
141
178
|
meterProvider: MetricsMeterProvider;
|
|
142
179
|
metricReaders: MetricReader[];
|
|
143
180
|
};
|
|
144
181
|
|
|
182
|
+
/**
|
|
183
|
+
* @ignore
|
|
184
|
+
*/
|
|
145
185
|
export interface MetricsMeterProvider extends MeterProvider {
|
|
146
186
|
forceFlush(): Promise<void>;
|
|
147
187
|
}
|
|
@@ -158,6 +198,7 @@ export namespace IOInsights {
|
|
|
158
198
|
unsubscribeCallback?: () => Promise<void>
|
|
159
199
|
): Metric;
|
|
160
200
|
}
|
|
201
|
+
|
|
161
202
|
/**
|
|
162
203
|
* @ignore
|
|
163
204
|
*/
|
|
@@ -326,7 +367,7 @@ export namespace IOInsights {
|
|
|
326
367
|
user?: string;
|
|
327
368
|
unit?: string;
|
|
328
369
|
buckets?: number[];
|
|
329
|
-
baseMetricType?: "histogram" | "gauge";
|
|
370
|
+
baseMetricType?: "histogram" | "gauge";
|
|
330
371
|
additionalAttributes?: { [key: string]: unknown } | (() => { [key: string]: unknown });
|
|
331
372
|
publishingSettings?: MetricPublishingSettings;
|
|
332
373
|
}
|
|
@@ -335,6 +376,11 @@ export namespace IOInsights {
|
|
|
335
376
|
* Controls the publishing of the metric.
|
|
336
377
|
*/
|
|
337
378
|
export interface MetricPublishingSettings {
|
|
379
|
+
/**
|
|
380
|
+
* Defines sampling probability for the metric.
|
|
381
|
+
*
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
338
384
|
sample?: number | boolean;
|
|
339
385
|
/**
|
|
340
386
|
* Controls the publishing of specific attributes.
|
|
@@ -356,14 +402,43 @@ export namespace IOInsights {
|
|
|
356
402
|
reduceModality?: number;
|
|
357
403
|
}
|
|
358
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Base interface for all metrics.
|
|
407
|
+
*/
|
|
359
408
|
export interface Metric {
|
|
409
|
+
/**
|
|
410
|
+
* Settings used to create the metric.
|
|
411
|
+
*/
|
|
360
412
|
settings: MetricSettings;
|
|
413
|
+
/**
|
|
414
|
+
* Whether the metric is started.
|
|
415
|
+
*/
|
|
361
416
|
started: boolean;
|
|
362
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Starts the metric, allowing it to publish values.
|
|
420
|
+
*/
|
|
363
421
|
start(): Promise<void>;
|
|
422
|
+
/**
|
|
423
|
+
* Stops the metric, meaning it can no long publish values.
|
|
424
|
+
*/
|
|
364
425
|
stop(): Promise<void>;
|
|
365
426
|
}
|
|
366
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Base interface for non-observable metrics with independent values, such as Gauge and Histogram.
|
|
430
|
+
*/
|
|
431
|
+
export interface RecordingMetric<TData extends IOInsights.MetricData> extends Metric {
|
|
432
|
+
record(value: number, data?: TData): void;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Base interface for non-observable metrics with incremental values, such as Counter and UpDownCounter.
|
|
437
|
+
*/
|
|
438
|
+
export interface IncrementalMetric<TData extends IOInsights.MetricData> extends Metric {
|
|
439
|
+
add(count: number, data?: TData): void;
|
|
440
|
+
}
|
|
441
|
+
|
|
367
442
|
/**
|
|
368
443
|
* @ignore
|
|
369
444
|
*/
|
|
@@ -430,11 +505,21 @@ export namespace IOInsights {
|
|
|
430
505
|
/*rest: */
|
|
431
506
|
| "null";
|
|
432
507
|
|
|
508
|
+
/**
|
|
509
|
+
* Metric filters that can be specified as default.
|
|
510
|
+
*
|
|
511
|
+
* Metric filters allow controlling specific metric data points, e.g.
|
|
512
|
+
* whether a particular value of a specific metric will be published.
|
|
513
|
+
*/
|
|
433
514
|
export interface MetricDefaultFilter {
|
|
515
|
+
/**
|
|
516
|
+
* Matches the type of the metric.
|
|
517
|
+
*/
|
|
434
518
|
type?: MetricType;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
519
|
+
/**
|
|
520
|
+
* Matches the attributes attached to a metric value. Not all metrics
|
|
521
|
+
* have all attribute values.
|
|
522
|
+
*/
|
|
438
523
|
attributes?: {
|
|
439
524
|
/**
|
|
440
525
|
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
@@ -446,11 +531,42 @@ export namespace IOInsights {
|
|
|
446
531
|
*/
|
|
447
532
|
includesFrameCreation?: boolean;
|
|
448
533
|
};
|
|
534
|
+
/**
|
|
535
|
+
* Whether or not the value for the matching metric will be published.
|
|
536
|
+
*/
|
|
537
|
+
enabled: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Sampling probability.
|
|
540
|
+
*/
|
|
541
|
+
sample?: number | boolean;
|
|
542
|
+
/**
|
|
543
|
+
* If `true`, this filter rule will be matched before any default filters provided
|
|
544
|
+
* by io.Connect. The default filters are usually meant filter out non-representative
|
|
545
|
+
* operations (e.g. partial workspace loads), but you can use this property to
|
|
546
|
+
* force them to be measured.
|
|
547
|
+
* If `false`, default filters will be matched before this filtering rule.
|
|
548
|
+
*
|
|
549
|
+
* @default false
|
|
550
|
+
*/
|
|
551
|
+
overrideDefaultFilters?: boolean;
|
|
449
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Metric filters that can be specified as part of a specific metric.
|
|
555
|
+
*/
|
|
450
556
|
export interface MetricFilter extends MetricDefaultFilter {
|
|
557
|
+
/**
|
|
558
|
+
* The name of the matched metric.
|
|
559
|
+
*/
|
|
451
560
|
name: string;
|
|
561
|
+
/**
|
|
562
|
+
* The type of the matched metric.
|
|
563
|
+
*/
|
|
452
564
|
type: MetricType;
|
|
453
565
|
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* @ignore
|
|
569
|
+
*/
|
|
454
570
|
export interface MetricsDependencyContainer {
|
|
455
571
|
performanceProvider: PerformanceProvider;
|
|
456
572
|
instanceStartedHandler: InstanceActionHandler;
|
|
@@ -478,12 +594,19 @@ export namespace IOInsights {
|
|
|
478
594
|
platformStartedHandler: PlatformStartedHandler;
|
|
479
595
|
platformErrorHandler: PlatformErrorHandler;
|
|
480
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* @ignore
|
|
599
|
+
*/
|
|
481
600
|
export type Unsubscribe = () => void;
|
|
482
|
-
|
|
601
|
+
/**
|
|
602
|
+
* @ignore
|
|
603
|
+
*/
|
|
483
604
|
export interface InstanceActionHandlerArgs {
|
|
484
605
|
application: string;
|
|
485
606
|
}
|
|
486
|
-
|
|
607
|
+
/**
|
|
608
|
+
* @ignore
|
|
609
|
+
*/
|
|
487
610
|
export type InstanceActionHandler = (
|
|
488
611
|
callback: (args: InstanceActionHandlerArgs) => void
|
|
489
612
|
) => Unsubscribe;
|
|
@@ -491,49 +614,71 @@ export namespace IOInsights {
|
|
|
491
614
|
export interface InstanceErrorHandlerArgs {
|
|
492
615
|
application: string;
|
|
493
616
|
}
|
|
494
|
-
|
|
617
|
+
/**
|
|
618
|
+
* @ignore
|
|
619
|
+
*/
|
|
495
620
|
export type InstanceErrorHandler = (
|
|
496
621
|
callback: (args: InstanceErrorHandlerArgs) => void
|
|
497
622
|
) => Unsubscribe;
|
|
498
|
-
|
|
623
|
+
/**
|
|
624
|
+
* @ignore
|
|
625
|
+
*/
|
|
499
626
|
export interface PlatformErrorHandlerArgs {}
|
|
500
|
-
|
|
627
|
+
/**
|
|
628
|
+
* @ignore
|
|
629
|
+
*/
|
|
501
630
|
export type PlatformErrorHandler = (
|
|
502
631
|
callback: (args: PlatformErrorHandlerArgs) => void
|
|
503
632
|
) => Unsubscribe;
|
|
504
|
-
|
|
633
|
+
/**
|
|
634
|
+
* @ignore
|
|
635
|
+
*/
|
|
505
636
|
export interface InstanceCrashHandlerArgs {
|
|
506
637
|
application: string;
|
|
507
638
|
reason: string;
|
|
508
639
|
}
|
|
509
|
-
|
|
640
|
+
/**
|
|
641
|
+
* @ignore
|
|
642
|
+
*/
|
|
510
643
|
export type InstanceCrashHandler = (
|
|
511
644
|
callback: (args: InstanceCrashHandlerArgs) => void
|
|
512
645
|
) => Unsubscribe;
|
|
513
|
-
|
|
646
|
+
/**
|
|
647
|
+
* @ignore
|
|
648
|
+
*/
|
|
514
649
|
export interface InstanceFocusedHandlerArgs {
|
|
515
650
|
application: string;
|
|
516
651
|
focused: boolean;
|
|
517
652
|
}
|
|
518
|
-
|
|
653
|
+
/**
|
|
654
|
+
* @ignore
|
|
655
|
+
*/
|
|
519
656
|
export type InstanceFocusedHandler = (
|
|
520
657
|
callback: (args: InstanceFocusedHandlerArgs) => void
|
|
521
658
|
) => Unsubscribe;
|
|
522
|
-
|
|
659
|
+
/**
|
|
660
|
+
* @ignore
|
|
661
|
+
*/
|
|
523
662
|
export interface LayoutRestoredHandlerArgs {
|
|
524
663
|
layout: string;
|
|
525
664
|
startTime: Date;
|
|
526
665
|
endTime: Date;
|
|
527
666
|
}
|
|
528
|
-
|
|
667
|
+
/**
|
|
668
|
+
* @ignore
|
|
669
|
+
*/
|
|
529
670
|
export type LayoutRestoredHandler = (
|
|
530
671
|
callback: (args: LayoutRestoredHandlerArgs) => void
|
|
531
672
|
) => Unsubscribe;
|
|
532
|
-
|
|
673
|
+
/**
|
|
674
|
+
* @ignore
|
|
675
|
+
*/
|
|
533
676
|
export interface WorkspaceActionHandlerArgs {
|
|
534
677
|
layout: string;
|
|
535
678
|
}
|
|
536
|
-
|
|
679
|
+
/**
|
|
680
|
+
* @ignore
|
|
681
|
+
*/
|
|
537
682
|
export interface WorkspaceTimedActionHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
538
683
|
startTime: Date;
|
|
539
684
|
endTime: Date;
|
|
@@ -548,7 +693,9 @@ export namespace IOInsights {
|
|
|
548
693
|
includesFrameCreation: boolean;
|
|
549
694
|
[x: string]: any;
|
|
550
695
|
}
|
|
551
|
-
|
|
696
|
+
/**
|
|
697
|
+
* @ignore
|
|
698
|
+
*/
|
|
552
699
|
export interface WorkspaceRestoredHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
553
700
|
startTime: Date;
|
|
554
701
|
endTime: Date;
|
|
@@ -563,7 +710,9 @@ export namespace IOInsights {
|
|
|
563
710
|
includesFrameCreation?: boolean;
|
|
564
711
|
[x: string]: any;
|
|
565
712
|
}
|
|
566
|
-
|
|
713
|
+
/**
|
|
714
|
+
* @ignore
|
|
715
|
+
*/
|
|
567
716
|
export interface WorkspaceAppsStartedHandlerArgs extends WorkspaceTimedActionHandlerArgs {
|
|
568
717
|
/**
|
|
569
718
|
* Indicates whether the workspace loading involved a complex operation where existing apps are added to a new workspace.
|
|
@@ -571,56 +720,86 @@ export namespace IOInsights {
|
|
|
571
720
|
*/
|
|
572
721
|
complexLoad: boolean;
|
|
573
722
|
}
|
|
574
|
-
|
|
723
|
+
/**
|
|
724
|
+
* @ignore
|
|
725
|
+
*/
|
|
575
726
|
export interface WorkspaceStartupHandlerArgs extends WorkspaceAppsStartedHandlerArgs {
|
|
576
727
|
/**
|
|
577
728
|
* Indicates whether the metric includes the time to create and load the Workspace Frame App when the workspace is opened in a new frame.
|
|
578
729
|
*/
|
|
579
730
|
includesFrameCreation: boolean;
|
|
580
731
|
}
|
|
581
|
-
|
|
732
|
+
/**
|
|
733
|
+
* @ignore
|
|
734
|
+
*/
|
|
582
735
|
export interface WorkspaceSavedHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
583
736
|
oldLayout: string;
|
|
584
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* @ignore
|
|
740
|
+
*/
|
|
585
741
|
export interface WorkspaceLoadedHandlerArgs extends WorkspaceActionHandlerArgs {
|
|
586
742
|
startTime: Date;
|
|
587
743
|
endTime: Date;
|
|
588
744
|
complexLoad?: boolean;
|
|
589
745
|
includesFrameCreation?: boolean;
|
|
590
746
|
}
|
|
591
|
-
|
|
747
|
+
/**
|
|
748
|
+
* @ignore
|
|
749
|
+
*/
|
|
592
750
|
export type WorkspaceGenericActionHandler<T extends WorkspaceActionHandlerArgs> = (
|
|
593
751
|
callback: (args: T) => void
|
|
594
752
|
) => Unsubscribe;
|
|
595
|
-
|
|
753
|
+
/**
|
|
754
|
+
* @ignore
|
|
755
|
+
*/
|
|
596
756
|
export type WorkspaceActionHandler = WorkspaceGenericActionHandler<WorkspaceActionHandlerArgs>;
|
|
757
|
+
/**
|
|
758
|
+
* @ignore
|
|
759
|
+
*/
|
|
597
760
|
export type WorkspaceLoadedHandler = WorkspaceGenericActionHandler<WorkspaceLoadedHandlerArgs>;
|
|
761
|
+
/**
|
|
762
|
+
* @ignore
|
|
763
|
+
*/
|
|
598
764
|
export type WorkspaceRestoredHandler =
|
|
599
765
|
WorkspaceGenericActionHandler<WorkspaceRestoredHandlerArgs>;
|
|
766
|
+
/**
|
|
767
|
+
* @ignore
|
|
768
|
+
*/
|
|
600
769
|
export type WorkspaceSavedHandler = WorkspaceGenericActionHandler<WorkspaceSavedHandlerArgs>;
|
|
601
|
-
|
|
770
|
+
/**
|
|
771
|
+
* @ignore
|
|
772
|
+
*/
|
|
602
773
|
export interface InstanceReadyHandlerArgs {
|
|
603
774
|
application: string;
|
|
604
775
|
startTime: Date;
|
|
605
776
|
endTime: Date;
|
|
606
777
|
api: string;
|
|
607
778
|
}
|
|
608
|
-
|
|
779
|
+
/**
|
|
780
|
+
* @ignore
|
|
781
|
+
*/
|
|
609
782
|
export type InstanceReadyHandler = (
|
|
610
783
|
callback: (args: InstanceReadyHandlerArgs) => void
|
|
611
784
|
) => Unsubscribe;
|
|
612
|
-
|
|
785
|
+
/**
|
|
786
|
+
* @ignore
|
|
787
|
+
*/
|
|
613
788
|
export interface PlatformStartedHandlerArgs {
|
|
614
789
|
startTime: Date;
|
|
615
790
|
endTime: Date;
|
|
616
791
|
idleTimeMs?: number;
|
|
617
792
|
api: string;
|
|
618
793
|
}
|
|
619
|
-
|
|
794
|
+
/**
|
|
795
|
+
* @ignore
|
|
796
|
+
*/
|
|
620
797
|
export type PlatformStartedHandler = (
|
|
621
798
|
callback: (args: PlatformStartedHandlerArgs) => void
|
|
622
799
|
) => Unsubscribe;
|
|
623
|
-
|
|
800
|
+
/**
|
|
801
|
+
* @ignore
|
|
802
|
+
*/
|
|
624
803
|
export interface PerformanceProvider {
|
|
625
804
|
getAppsCPU(): Promise<AppCPU[] | undefined>;
|
|
626
805
|
getAppsMemory(): Promise<AppMemory[] | undefined>;
|
|
@@ -628,25 +807,33 @@ export namespace IOInsights {
|
|
|
628
807
|
getSystemCPU(): Promise<SystemCPU | undefined>;
|
|
629
808
|
getSystemMemory(): Promise<SystemMemory | undefined>;
|
|
630
809
|
}
|
|
631
|
-
|
|
810
|
+
/**
|
|
811
|
+
* @ignore
|
|
812
|
+
*/
|
|
632
813
|
export interface AppCPU {
|
|
633
814
|
app: string;
|
|
634
815
|
instance: string;
|
|
635
816
|
cpu: number;
|
|
636
817
|
}
|
|
637
|
-
|
|
818
|
+
/**
|
|
819
|
+
* @ignore
|
|
820
|
+
*/
|
|
638
821
|
export interface AppMemory {
|
|
639
822
|
app: string;
|
|
640
823
|
instance: string;
|
|
641
824
|
memory: number;
|
|
642
825
|
}
|
|
643
|
-
|
|
826
|
+
/**
|
|
827
|
+
* @ignore
|
|
828
|
+
*/
|
|
644
829
|
export interface SystemCPU {
|
|
645
830
|
current: number;
|
|
646
831
|
average: number;
|
|
647
832
|
platform: number;
|
|
648
833
|
}
|
|
649
|
-
|
|
834
|
+
/**
|
|
835
|
+
* @ignore
|
|
836
|
+
*/
|
|
650
837
|
export interface SystemMemory {
|
|
651
838
|
platformTotal: number;
|
|
652
839
|
systemTotal: number;
|
|
@@ -657,6 +844,9 @@ export namespace IOInsights {
|
|
|
657
844
|
* Traces API.
|
|
658
845
|
*/
|
|
659
846
|
export interface TracesManager extends Manager<TracesSettings> {
|
|
847
|
+
/**
|
|
848
|
+
* The tracing state representing the currently active trace and span, if any.
|
|
849
|
+
*/
|
|
660
850
|
currentTracingState: TracingState | null;
|
|
661
851
|
|
|
662
852
|
/**
|
|
@@ -679,6 +869,7 @@ export namespace IOInsights {
|
|
|
679
869
|
* Works in conjunction with the userJourney setting to track the user's entire session flow.
|
|
680
870
|
*/
|
|
681
871
|
userJourneyMarker?: MarkerSpanCallback;
|
|
872
|
+
/** @ignore */
|
|
682
873
|
setUserJourneyMarker(userJourneyMarker: MarkerSpanCallback): void;
|
|
683
874
|
|
|
684
875
|
/**
|
|
@@ -696,8 +887,18 @@ export namespace IOInsights {
|
|
|
696
887
|
*/
|
|
697
888
|
clickstreamMarker?: MarkerSpanCallback;
|
|
698
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Allows updating the configured filters.
|
|
892
|
+
*/
|
|
699
893
|
setFilterConfig(filters: SpanFilter[]): void;
|
|
700
894
|
|
|
895
|
+
/**
|
|
896
|
+
* Allows creating a span for a named trace.
|
|
897
|
+
*
|
|
898
|
+
* @param source The name of the span to create.
|
|
899
|
+
* @param traceName The name of the trace to nest the span in. If one doesn't exist, it will be created.
|
|
900
|
+
* @param callback Logic to execute in the span.
|
|
901
|
+
*/
|
|
701
902
|
withSequenceSpanEx<T>(
|
|
702
903
|
source: string,
|
|
703
904
|
traceName:
|
|
@@ -706,6 +907,14 @@ export namespace IOInsights {
|
|
|
706
907
|
callback:
|
|
707
908
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
708
909
|
|
|
910
|
+
/**
|
|
911
|
+
* Allows creating a span for a named trace.
|
|
912
|
+
*
|
|
913
|
+
* @param source The name of the span to create.
|
|
914
|
+
* @param traceName The name of the trace to nest the span in. If one doesn't exist, it will be created.
|
|
915
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
916
|
+
* @param callback Logic to execute in the span.
|
|
917
|
+
*/
|
|
709
918
|
withSequenceSpanEx<T>(
|
|
710
919
|
source: string,
|
|
711
920
|
traceName:
|
|
@@ -717,6 +926,15 @@ export namespace IOInsights {
|
|
|
717
926
|
callback:
|
|
718
927
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
719
928
|
|
|
929
|
+
/**
|
|
930
|
+
* Allows creating a span for a named trace.
|
|
931
|
+
*
|
|
932
|
+
* @param source The name of the span to create.
|
|
933
|
+
* @param traceName The name of the trace to nest the span in. If one doesn't exist, it will be created.
|
|
934
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
935
|
+
* @param options Options to use when creating the span.
|
|
936
|
+
* @param callback Logic to execute in the span.
|
|
937
|
+
*/
|
|
720
938
|
withSequenceSpanEx<T>(
|
|
721
939
|
source: string,
|
|
722
940
|
traceName:
|
|
@@ -731,6 +949,9 @@ export namespace IOInsights {
|
|
|
731
949
|
callback:
|
|
732
950
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
733
951
|
|
|
952
|
+
/**
|
|
953
|
+
* @ignore
|
|
954
|
+
*/
|
|
734
955
|
withSequenceSpanEx<T>(
|
|
735
956
|
source: string,
|
|
736
957
|
traceName:
|
|
@@ -747,11 +968,24 @@ export namespace IOInsights {
|
|
|
747
968
|
callback?:
|
|
748
969
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
749
970
|
|
|
971
|
+
/**
|
|
972
|
+
* Allows creating a span for a named trace.
|
|
973
|
+
*
|
|
974
|
+
* @param source The name of the span to create. The name of the trace will be <source>.start, and if one doesn't exist, it will be created.
|
|
975
|
+
* @param callback Logic to execute in the span.
|
|
976
|
+
*/
|
|
750
977
|
withSequenceSpan<T>(
|
|
751
978
|
source: string,
|
|
752
979
|
callback:
|
|
753
980
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
754
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Allows creating a span for a named trace.
|
|
984
|
+
*
|
|
985
|
+
* @param source The name of the span to create. The name of the trace will be <source>.start, and if one doesn't exist, it will be created.
|
|
986
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
987
|
+
* @param callback Logic to execute in the span.
|
|
988
|
+
*/
|
|
755
989
|
withSequenceSpan<T>(
|
|
756
990
|
source: string,
|
|
757
991
|
filteringContext:
|
|
@@ -760,6 +994,14 @@ export namespace IOInsights {
|
|
|
760
994
|
callback:
|
|
761
995
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
762
996
|
|
|
997
|
+
/**
|
|
998
|
+
* Allows creating a span for a named trace.
|
|
999
|
+
*
|
|
1000
|
+
* @param source The name of the span to create. The name of the trace will be <source>.start, and if one doesn't exist, it will be created.
|
|
1001
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
1002
|
+
* @param options Options to use when creating the span.
|
|
1003
|
+
* @param callback Logic to execute in the span.
|
|
1004
|
+
*/
|
|
763
1005
|
withSequenceSpan<T>(
|
|
764
1006
|
source: string,
|
|
765
1007
|
filteringContext:
|
|
@@ -771,6 +1013,9 @@ export namespace IOInsights {
|
|
|
771
1013
|
callback:
|
|
772
1014
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
773
1015
|
|
|
1016
|
+
/**
|
|
1017
|
+
* @ignore
|
|
1018
|
+
*/
|
|
774
1019
|
withSequenceSpan<T>(
|
|
775
1020
|
source: string,
|
|
776
1021
|
filteringContextOrCallback:
|
|
@@ -784,14 +1029,36 @@ export namespace IOInsights {
|
|
|
784
1029
|
callback?:
|
|
785
1030
|
| IOInsights.WithSpanCallback<T>): Promise<T>;
|
|
786
1031
|
|
|
787
|
-
|
|
788
|
-
|
|
1032
|
+
/**
|
|
1033
|
+
* Allows creating a span for the currently active trace. If one doesn't exist, it will be created.
|
|
1034
|
+
*
|
|
1035
|
+
* @param source The name of the span to create.
|
|
1036
|
+
* @param callback Logic to execute in the span.
|
|
1037
|
+
*/
|
|
1038
|
+
withSpan<T>(
|
|
1039
|
+
source: string,
|
|
1040
|
+
callback: WithSpanCallback<T>): T;
|
|
1041
|
+
/**
|
|
1042
|
+
* Allows creating a span for the currently active trace. If one doesn't exist, it will be created.
|
|
1043
|
+
*
|
|
1044
|
+
* @param source The name of the span to create.
|
|
1045
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
1046
|
+
* @param callback Logic to execute in the span.
|
|
1047
|
+
*/
|
|
789
1048
|
withSpan<T>(
|
|
790
1049
|
source: string,
|
|
791
1050
|
filteringContext: FilteringContext,
|
|
792
1051
|
callback: WithSpanCallback<T>
|
|
793
1052
|
): T;
|
|
794
1053
|
|
|
1054
|
+
/**
|
|
1055
|
+
* Allows creating a span for the currently active trace or a specified trace. If one doesn't exist, it will be created.
|
|
1056
|
+
*
|
|
1057
|
+
* @param source The name of the span to create.
|
|
1058
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
1059
|
+
* @param propagationInfo Span and trace id to use for manually nesting the new trace.
|
|
1060
|
+
* @param callback Logic to execute in the span.
|
|
1061
|
+
*/
|
|
795
1062
|
withSpan<T>(
|
|
796
1063
|
source: string,
|
|
797
1064
|
filteringContext: FilteringContext,
|
|
@@ -799,6 +1066,15 @@ export namespace IOInsights {
|
|
|
799
1066
|
callback: WithSpanCallback<T>
|
|
800
1067
|
): T;
|
|
801
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* Allows creating a span for the currently active trace or a specified trace. If one doesn't exist, it will be created.
|
|
1071
|
+
*
|
|
1072
|
+
* @param source The name of the span to create.
|
|
1073
|
+
* @param filteringContext Filtering context used to match against the tracing filtering configuration.
|
|
1074
|
+
* @param propagationInfo Span and trace id to use for manually nesting the new trace.
|
|
1075
|
+
* @param options Options to use when creating the span.
|
|
1076
|
+
* @param callback Logic to execute in the span.
|
|
1077
|
+
*/
|
|
802
1078
|
withSpan<T>(
|
|
803
1079
|
source: string,
|
|
804
1080
|
filteringContext: FilteringContext,
|
|
@@ -809,6 +1085,9 @@ export namespace IOInsights {
|
|
|
809
1085
|
}
|
|
810
1086
|
|
|
811
1087
|
interface TracingState {
|
|
1088
|
+
/**
|
|
1089
|
+
* Ends the current span. Same as endSpan().
|
|
1090
|
+
*/
|
|
812
1091
|
end(): void;
|
|
813
1092
|
/**
|
|
814
1093
|
* If false, this is a placeholder object, and all its methods
|
|
@@ -859,6 +1138,9 @@ export namespace IOInsights {
|
|
|
859
1138
|
*/
|
|
860
1139
|
enabled: boolean;
|
|
861
1140
|
|
|
1141
|
+
/**
|
|
1142
|
+
* Property for internal use.
|
|
1143
|
+
*/
|
|
862
1144
|
rootPropagationInfo?: PropagationInfo;
|
|
863
1145
|
|
|
864
1146
|
/**
|
|
@@ -1110,18 +1392,35 @@ export namespace IOInsights {
|
|
|
1110
1392
|
*/
|
|
1111
1393
|
additionalResourceAttributes?: { [x: string]: unknown } | (() => { [x: string]: unknown });
|
|
1112
1394
|
|
|
1395
|
+
/**
|
|
1396
|
+
* Allows specifying a constructor callback for creating the tracerProvider instance.
|
|
1397
|
+
*/
|
|
1113
1398
|
tracerProvider?: (tracerProviderSettings: TracerConfig, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => TracerProvider;
|
|
1399
|
+
/**
|
|
1400
|
+
* Allows specifying a constructor callback for creating the Sampler instance.
|
|
1401
|
+
*/
|
|
1114
1402
|
sampler?: (defaultSampler: Sampler, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => Sampler;
|
|
1403
|
+
/**
|
|
1404
|
+
* Allows specifying a constructor callback for creating the SpanProcessor instances.
|
|
1405
|
+
*/
|
|
1115
1406
|
spanProcessors?: (processorSettings: BatchSpanProcessorBrowserConfig | undefined, exporterSettings: OTLPExporterNodeConfigBase, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => SpanProcessor[];
|
|
1407
|
+
/**
|
|
1408
|
+
* Allows specifying a constructor callback for creating the SpanExporter instances.
|
|
1409
|
+
*/
|
|
1116
1410
|
spanExporters?: (exporterSettings: OTLPExporterNodeConfigBase, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => SpanExporter[];
|
|
1411
|
+
/**
|
|
1412
|
+
* Allows specifying a constructor callback for creating the TextMapPropagator instance.
|
|
1413
|
+
*/
|
|
1117
1414
|
propagator?: (tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => TextMapPropagator;
|
|
1415
|
+
/**
|
|
1416
|
+
* Allows specifying a constructor callback for creating the ContextManager instance.
|
|
1417
|
+
*/
|
|
1118
1418
|
contextManager?: (tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => ContextManager;
|
|
1119
|
-
providerRegistrationSettings?: (tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => {
|
|
1120
|
-
propagator?: TextMapPropagator;
|
|
1121
|
-
contextManager?: ContextManager;
|
|
1122
|
-
};
|
|
1123
1419
|
}
|
|
1124
1420
|
|
|
1421
|
+
/**
|
|
1422
|
+
* Builder class used to set up Traces module.
|
|
1423
|
+
*/
|
|
1125
1424
|
export interface TracesManagerBuilder {
|
|
1126
1425
|
build(): TracesManager;
|
|
1127
1426
|
withLogger(logger: Logger): this;
|
|
@@ -1134,8 +1433,14 @@ export namespace IOInsights {
|
|
|
1134
1433
|
read: (source: string) => Promise<PropagationInfo | null>): this;
|
|
1135
1434
|
}
|
|
1136
1435
|
|
|
1436
|
+
/**
|
|
1437
|
+
* Callback executed during a span. See `withSpan`
|
|
1438
|
+
*/
|
|
1137
1439
|
export type WithSpanCallback<T> = (tracingState: TracingState) => T;
|
|
1138
1440
|
|
|
1441
|
+
/**
|
|
1442
|
+
* Options that can be provided when using `withSpan` as a decorator
|
|
1443
|
+
*/
|
|
1139
1444
|
export interface WithSpanDecoratorOptions extends WithSpanOptions {
|
|
1140
1445
|
argMapping?:
|
|
1141
1446
|
| { [x: string]: string }
|
|
@@ -1144,11 +1449,17 @@ export namespace IOInsights {
|
|
|
1144
1449
|
thisMapping?: { [x: string]: string } | ((that: any) => any);
|
|
1145
1450
|
}
|
|
1146
1451
|
|
|
1452
|
+
/**
|
|
1453
|
+
* Span and trace information that can be used to manually control the
|
|
1454
|
+
* nesting of a newly created span.
|
|
1455
|
+
*/
|
|
1147
1456
|
export interface PropagationInfo {
|
|
1148
1457
|
traceparent?: string;
|
|
1149
1458
|
tracestate?: string;
|
|
1150
1459
|
forceTracing?: boolean;
|
|
1151
1460
|
}
|
|
1461
|
+
|
|
1462
|
+
/** @ignore */
|
|
1152
1463
|
export interface PropagationInfoCarrier {
|
|
1153
1464
|
__interopIOTracePropagationInfo?: PropagationInfo;
|
|
1154
1465
|
}
|
|
@@ -1158,6 +1469,9 @@ export namespace IOInsights {
|
|
|
1158
1469
|
fullFilteringContext: FilteringContext
|
|
1159
1470
|
) => PropagationInfo | null;
|
|
1160
1471
|
|
|
1472
|
+
/**
|
|
1473
|
+
* Key-value pair that can be used to match a span against a filter in the tracing filtering config.
|
|
1474
|
+
*/
|
|
1161
1475
|
export type FilteringContext = {
|
|
1162
1476
|
app?: string;
|
|
1163
1477
|
user?: string;
|
|
@@ -1169,6 +1483,9 @@ export namespace IOInsights {
|
|
|
1169
1483
|
userId?: string;
|
|
1170
1484
|
} & Record<string, any>;
|
|
1171
1485
|
|
|
1486
|
+
/**
|
|
1487
|
+
* Verbosity level of a span. Controls how much information is added using `.addData()`.
|
|
1488
|
+
*/
|
|
1172
1489
|
export enum SpanVerbosity {
|
|
1173
1490
|
OFF,
|
|
1174
1491
|
LOWEST,
|
|
@@ -1178,6 +1495,10 @@ export namespace IOInsights {
|
|
|
1178
1495
|
WARN,
|
|
1179
1496
|
HIGHEST,
|
|
1180
1497
|
}
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Options that can be used when creating a span.
|
|
1501
|
+
*/
|
|
1181
1502
|
export interface WithSpanOptions extends Omit<SpanCreationOptions, "sample"> {
|
|
1182
1503
|
defaultFilters?: SpanFilter[];
|
|
1183
1504
|
structure?: "sibling" | "nested";
|
|
@@ -1302,6 +1623,7 @@ export namespace IOInsights {
|
|
|
1302
1623
|
*/
|
|
1303
1624
|
minDurationMs?: number;
|
|
1304
1625
|
|
|
1626
|
+
/** @ignore */
|
|
1305
1627
|
getPropagationInfo?: PropagationInfoCallback;
|
|
1306
1628
|
|
|
1307
1629
|
/**
|
|
@@ -1321,6 +1643,9 @@ export namespace IOInsights {
|
|
|
1321
1643
|
overrideDefaultFilters?: boolean;
|
|
1322
1644
|
}
|
|
1323
1645
|
|
|
1646
|
+
/**
|
|
1647
|
+
* Filter entry that can match a span to control its settings.
|
|
1648
|
+
*/
|
|
1324
1649
|
export interface SpanFilter extends Omit<SpanCreationOptions, "getPropagationInfo"> {
|
|
1325
1650
|
/**
|
|
1326
1651
|
* Specifies the source string used for matching spans.
|
|
@@ -1343,17 +1668,21 @@ export namespace IOInsights {
|
|
|
1343
1668
|
[key: string]: string | number | boolean;
|
|
1344
1669
|
};
|
|
1345
1670
|
}
|
|
1671
|
+
|
|
1672
|
+
// /**
|
|
1673
|
+
// * Configuration for automatic instrumentation of common browser operations.
|
|
1674
|
+
// * Enables automatic tracing of document load, user interactions, fetch requests, and XHR calls.
|
|
1675
|
+
// */
|
|
1676
|
+
// export interface AutoInstrumentationOptions {
|
|
1677
|
+
// documentLoad?: boolean | DocumentLoadInstrumentationConfig;
|
|
1678
|
+
// userInteraction?: boolean | UserInteractionInstrumentationConfig;
|
|
1679
|
+
// fetch?: boolean | FetchInstrumentationConfig;
|
|
1680
|
+
// xhr?: boolean | XMLHttpRequestInstrumentationConfig;
|
|
1681
|
+
// ignoreObservabilityUrls?: boolean;
|
|
1682
|
+
// }
|
|
1346
1683
|
/**
|
|
1347
|
-
*
|
|
1348
|
-
|
|
1349
|
-
*/
|
|
1350
|
-
export interface AutoInstrumentationOptions {
|
|
1351
|
-
documentLoad?: boolean | DocumentLoadInstrumentationConfig;
|
|
1352
|
-
userInteraction?: boolean | UserInteractionInstrumentationConfig;
|
|
1353
|
-
fetch?: boolean | FetchInstrumentationConfig;
|
|
1354
|
-
xhr?: boolean | XMLHttpRequestInstrumentationConfig;
|
|
1355
|
-
ignoreObservabilityUrls?: boolean;
|
|
1356
|
-
}
|
|
1684
|
+
* Settings used to control the sampling probability of spans.
|
|
1685
|
+
*/
|
|
1357
1686
|
export interface SamplingSettings {
|
|
1358
1687
|
/**
|
|
1359
1688
|
* Span name to determine if span will match this sampling setting entry.
|
|
@@ -1513,6 +1842,9 @@ export namespace IOInsights {
|
|
|
1513
1842
|
export interface LogsManager extends Manager<LogsSettings> {
|
|
1514
1843
|
emit(logRecord: LogRecord): Promise<void> | null;
|
|
1515
1844
|
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Builder class used to set up Logs module.
|
|
1847
|
+
*/
|
|
1516
1848
|
export interface LogsManagerBuilder {
|
|
1517
1849
|
build(): LogsManager;
|
|
1518
1850
|
withLogger(logger: Logger): this;
|
|
@@ -1688,6 +2020,9 @@ export namespace IOInsights {
|
|
|
1688
2020
|
enabled?: boolean;
|
|
1689
2021
|
}
|
|
1690
2022
|
|
|
2023
|
+
/**
|
|
2024
|
+
* Level of log entry.
|
|
2025
|
+
*/
|
|
1691
2026
|
export const enum LoggerLogLevel {
|
|
1692
2027
|
NONE = 0,
|
|
1693
2028
|
ERROR = 30,
|
|
@@ -1698,6 +2033,9 @@ export namespace IOInsights {
|
|
|
1698
2033
|
ALL = 9999,
|
|
1699
2034
|
}
|
|
1700
2035
|
|
|
2036
|
+
/**
|
|
2037
|
+
* Log interface that can be passed to library for its own logging.
|
|
2038
|
+
*/
|
|
1701
2039
|
export interface Logger {
|
|
1702
2040
|
level?: LoggerLogLevel;
|
|
1703
2041
|
error(message: string, ...args: unknown[]): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/otel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.220",
|
|
4
4
|
"description": "io.Insights observability library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"@opentelemetry/resources": "^2.0.0",
|
|
40
40
|
"@opentelemetry/sdk-logs": "^0.200.0",
|
|
41
41
|
"@opentelemetry/sdk-metrics": "^2.0.0",
|
|
42
|
-
"@opentelemetry/sdk-trace-base": "^2.0.0"
|
|
42
|
+
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
43
|
+
"log4js": "^6.9.1"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@types/chai": "^4.3.20",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
"@typescript-eslint/parser": "^7.18.0",
|
|
50
51
|
"chai": "^4.5.0",
|
|
51
52
|
"eslint": "^8.57.1",
|
|
52
|
-
"log4js": "^6.9.1",
|
|
53
53
|
"mocha": "^10.8.2",
|
|
54
54
|
"rimraf": "^5.0.10",
|
|
55
55
|
"typescript": "^4.9.5"
|