@databricks/appkit 0.70.0 → 0.71.0
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/appkit/package.js +1 -1
- package/dist/core/appkit.d.ts.map +1 -1
- package/dist/core/appkit.js +1 -0
- package/dist/core/appkit.js.map +1 -1
- package/dist/plugins/agents/agents.d.ts.map +1 -1
- package/dist/plugins/agents/agents.js +4 -1
- package/dist/plugins/agents/agents.js.map +1 -1
- package/dist/plugins/agents/mlflow.js +267 -11
- package/dist/plugins/agents/mlflow.js.map +1 -1
- package/dist/plugins/server/index.js +2 -2
- package/dist/plugins/server/index.js.map +1 -1
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +3 -3
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
- package/dist/plugins/server/static-server.js +3 -3
- package/dist/plugins/server/static-server.js.map +1 -1
- package/dist/plugins/server/utils.js +3 -3
- package/dist/plugins/server/utils.js.map +1 -1
- package/dist/plugins/server/vite-dev-server.js +4 -4
- package/dist/plugins/server/vite-dev-server.js.map +1 -1
- package/dist/shared/src/schemas/manifest.d.ts +54 -54
- package/dist/telemetry/index.js +2 -2
- package/dist/telemetry/telemetry-manager.d.ts +2 -1
- package/dist/telemetry/telemetry-manager.js +114 -26
- package/dist/telemetry/telemetry-manager.js.map +1 -1
- package/dist/type-generator/database/generate.js +3 -3
- package/dist/type-generator/database/generate.js.map +1 -1
- package/dist/type-generator/errors.js +45 -11
- package/dist/type-generator/errors.js.map +1 -1
- package/dist/type-generator/migration.js +2 -2
- package/dist/type-generator/migration.js.map +1 -1
- package/dist/type-generator/mv-registry/sync.js +3 -3
- package/dist/type-generator/mv-registry/sync.js.map +1 -1
- package/dist/type-generator/mv-registry/types.d.ts +5 -2
- package/dist/type-generator/mv-registry/types.d.ts.map +1 -1
- package/dist/type-generator/query-registry.js +3 -3
- package/dist/type-generator/query-registry.js.map +1 -1
- package/dist/type-generator/serving/server-file-extractor.js +3 -3
- package/dist/type-generator/serving/server-file-extractor.js.map +1 -1
- package/package.json +4 -4
- package/sbom.cdx.json +1 -1
|
@@ -12,12 +12,12 @@ declare const resourceFieldEntrySchema: z.ZodObject<{
|
|
|
12
12
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13
13
|
type: z.ZodLiteral<"kind">;
|
|
14
14
|
resourceKind: z.ZodEnum<{
|
|
15
|
-
volume: "volume";
|
|
16
|
-
genie_space: "genie_space";
|
|
17
15
|
warehouse: "warehouse";
|
|
16
|
+
genie_space: "genie_space";
|
|
18
17
|
postgres_project: "postgres_project";
|
|
19
18
|
postgres_branch: "postgres_branch";
|
|
20
19
|
postgres_database: "postgres_database";
|
|
20
|
+
volume: "volume";
|
|
21
21
|
}>;
|
|
22
22
|
select: z.ZodOptional<z.ZodString>;
|
|
23
23
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -58,12 +58,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
58
58
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
59
59
|
type: z.ZodLiteral<"kind">;
|
|
60
60
|
resourceKind: z.ZodEnum<{
|
|
61
|
-
volume: "volume";
|
|
62
|
-
genie_space: "genie_space";
|
|
63
61
|
warehouse: "warehouse";
|
|
62
|
+
genie_space: "genie_space";
|
|
64
63
|
postgres_project: "postgres_project";
|
|
65
64
|
postgres_branch: "postgres_branch";
|
|
66
65
|
postgres_database: "postgres_database";
|
|
66
|
+
volume: "volume";
|
|
67
67
|
}>;
|
|
68
68
|
select: z.ZodOptional<z.ZodString>;
|
|
69
69
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -99,12 +99,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
99
99
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
100
|
type: z.ZodLiteral<"kind">;
|
|
101
101
|
resourceKind: z.ZodEnum<{
|
|
102
|
-
volume: "volume";
|
|
103
|
-
genie_space: "genie_space";
|
|
104
102
|
warehouse: "warehouse";
|
|
103
|
+
genie_space: "genie_space";
|
|
105
104
|
postgres_project: "postgres_project";
|
|
106
105
|
postgres_branch: "postgres_branch";
|
|
107
106
|
postgres_database: "postgres_database";
|
|
107
|
+
volume: "volume";
|
|
108
108
|
}>;
|
|
109
109
|
select: z.ZodOptional<z.ZodString>;
|
|
110
110
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -139,12 +139,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
139
139
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
140
|
type: z.ZodLiteral<"kind">;
|
|
141
141
|
resourceKind: z.ZodEnum<{
|
|
142
|
-
volume: "volume";
|
|
143
|
-
genie_space: "genie_space";
|
|
144
142
|
warehouse: "warehouse";
|
|
143
|
+
genie_space: "genie_space";
|
|
145
144
|
postgres_project: "postgres_project";
|
|
146
145
|
postgres_branch: "postgres_branch";
|
|
147
146
|
postgres_database: "postgres_database";
|
|
147
|
+
volume: "volume";
|
|
148
148
|
}>;
|
|
149
149
|
select: z.ZodOptional<z.ZodString>;
|
|
150
150
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -180,12 +180,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
180
180
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
181
181
|
type: z.ZodLiteral<"kind">;
|
|
182
182
|
resourceKind: z.ZodEnum<{
|
|
183
|
-
volume: "volume";
|
|
184
|
-
genie_space: "genie_space";
|
|
185
183
|
warehouse: "warehouse";
|
|
184
|
+
genie_space: "genie_space";
|
|
186
185
|
postgres_project: "postgres_project";
|
|
187
186
|
postgres_branch: "postgres_branch";
|
|
188
187
|
postgres_database: "postgres_database";
|
|
188
|
+
volume: "volume";
|
|
189
189
|
}>;
|
|
190
190
|
select: z.ZodOptional<z.ZodString>;
|
|
191
191
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -220,12 +220,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
220
220
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
221
221
|
type: z.ZodLiteral<"kind">;
|
|
222
222
|
resourceKind: z.ZodEnum<{
|
|
223
|
-
volume: "volume";
|
|
224
|
-
genie_space: "genie_space";
|
|
225
223
|
warehouse: "warehouse";
|
|
224
|
+
genie_space: "genie_space";
|
|
226
225
|
postgres_project: "postgres_project";
|
|
227
226
|
postgres_branch: "postgres_branch";
|
|
228
227
|
postgres_database: "postgres_database";
|
|
228
|
+
volume: "volume";
|
|
229
229
|
}>;
|
|
230
230
|
select: z.ZodOptional<z.ZodString>;
|
|
231
231
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -259,12 +259,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
259
259
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
260
260
|
type: z.ZodLiteral<"kind">;
|
|
261
261
|
resourceKind: z.ZodEnum<{
|
|
262
|
-
volume: "volume";
|
|
263
|
-
genie_space: "genie_space";
|
|
264
262
|
warehouse: "warehouse";
|
|
263
|
+
genie_space: "genie_space";
|
|
265
264
|
postgres_project: "postgres_project";
|
|
266
265
|
postgres_branch: "postgres_branch";
|
|
267
266
|
postgres_database: "postgres_database";
|
|
267
|
+
volume: "volume";
|
|
268
268
|
}>;
|
|
269
269
|
select: z.ZodOptional<z.ZodString>;
|
|
270
270
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -298,12 +298,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
298
298
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
299
299
|
type: z.ZodLiteral<"kind">;
|
|
300
300
|
resourceKind: z.ZodEnum<{
|
|
301
|
-
volume: "volume";
|
|
302
|
-
genie_space: "genie_space";
|
|
303
301
|
warehouse: "warehouse";
|
|
302
|
+
genie_space: "genie_space";
|
|
304
303
|
postgres_project: "postgres_project";
|
|
305
304
|
postgres_branch: "postgres_branch";
|
|
306
305
|
postgres_database: "postgres_database";
|
|
306
|
+
volume: "volume";
|
|
307
307
|
}>;
|
|
308
308
|
select: z.ZodOptional<z.ZodString>;
|
|
309
309
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -337,12 +337,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
337
337
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
338
338
|
type: z.ZodLiteral<"kind">;
|
|
339
339
|
resourceKind: z.ZodEnum<{
|
|
340
|
-
volume: "volume";
|
|
341
|
-
genie_space: "genie_space";
|
|
342
340
|
warehouse: "warehouse";
|
|
341
|
+
genie_space: "genie_space";
|
|
343
342
|
postgres_project: "postgres_project";
|
|
344
343
|
postgres_branch: "postgres_branch";
|
|
345
344
|
postgres_database: "postgres_database";
|
|
345
|
+
volume: "volume";
|
|
346
346
|
}>;
|
|
347
347
|
select: z.ZodOptional<z.ZodString>;
|
|
348
348
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -376,12 +376,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
376
376
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
377
377
|
type: z.ZodLiteral<"kind">;
|
|
378
378
|
resourceKind: z.ZodEnum<{
|
|
379
|
-
volume: "volume";
|
|
380
|
-
genie_space: "genie_space";
|
|
381
379
|
warehouse: "warehouse";
|
|
380
|
+
genie_space: "genie_space";
|
|
382
381
|
postgres_project: "postgres_project";
|
|
383
382
|
postgres_branch: "postgres_branch";
|
|
384
383
|
postgres_database: "postgres_database";
|
|
384
|
+
volume: "volume";
|
|
385
385
|
}>;
|
|
386
386
|
select: z.ZodOptional<z.ZodString>;
|
|
387
387
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -415,12 +415,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
415
415
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
416
416
|
type: z.ZodLiteral<"kind">;
|
|
417
417
|
resourceKind: z.ZodEnum<{
|
|
418
|
-
volume: "volume";
|
|
419
|
-
genie_space: "genie_space";
|
|
420
418
|
warehouse: "warehouse";
|
|
419
|
+
genie_space: "genie_space";
|
|
421
420
|
postgres_project: "postgres_project";
|
|
422
421
|
postgres_branch: "postgres_branch";
|
|
423
422
|
postgres_database: "postgres_database";
|
|
423
|
+
volume: "volume";
|
|
424
424
|
}>;
|
|
425
425
|
select: z.ZodOptional<z.ZodString>;
|
|
426
426
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -457,12 +457,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
457
457
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
458
458
|
type: z.ZodLiteral<"kind">;
|
|
459
459
|
resourceKind: z.ZodEnum<{
|
|
460
|
-
volume: "volume";
|
|
461
|
-
genie_space: "genie_space";
|
|
462
460
|
warehouse: "warehouse";
|
|
461
|
+
genie_space: "genie_space";
|
|
463
462
|
postgres_project: "postgres_project";
|
|
464
463
|
postgres_branch: "postgres_branch";
|
|
465
464
|
postgres_database: "postgres_database";
|
|
465
|
+
volume: "volume";
|
|
466
466
|
}>;
|
|
467
467
|
select: z.ZodOptional<z.ZodString>;
|
|
468
468
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -498,12 +498,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
498
498
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
499
499
|
type: z.ZodLiteral<"kind">;
|
|
500
500
|
resourceKind: z.ZodEnum<{
|
|
501
|
-
volume: "volume";
|
|
502
|
-
genie_space: "genie_space";
|
|
503
501
|
warehouse: "warehouse";
|
|
502
|
+
genie_space: "genie_space";
|
|
504
503
|
postgres_project: "postgres_project";
|
|
505
504
|
postgres_branch: "postgres_branch";
|
|
506
505
|
postgres_database: "postgres_database";
|
|
506
|
+
volume: "volume";
|
|
507
507
|
}>;
|
|
508
508
|
select: z.ZodOptional<z.ZodString>;
|
|
509
509
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -537,12 +537,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
537
537
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
538
538
|
type: z.ZodLiteral<"kind">;
|
|
539
539
|
resourceKind: z.ZodEnum<{
|
|
540
|
-
volume: "volume";
|
|
541
|
-
genie_space: "genie_space";
|
|
542
540
|
warehouse: "warehouse";
|
|
541
|
+
genie_space: "genie_space";
|
|
543
542
|
postgres_project: "postgres_project";
|
|
544
543
|
postgres_branch: "postgres_branch";
|
|
545
544
|
postgres_database: "postgres_database";
|
|
545
|
+
volume: "volume";
|
|
546
546
|
}>;
|
|
547
547
|
select: z.ZodOptional<z.ZodString>;
|
|
548
548
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -579,12 +579,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
579
579
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
580
580
|
type: z.ZodLiteral<"kind">;
|
|
581
581
|
resourceKind: z.ZodEnum<{
|
|
582
|
-
volume: "volume";
|
|
583
|
-
genie_space: "genie_space";
|
|
584
582
|
warehouse: "warehouse";
|
|
583
|
+
genie_space: "genie_space";
|
|
585
584
|
postgres_project: "postgres_project";
|
|
586
585
|
postgres_branch: "postgres_branch";
|
|
587
586
|
postgres_database: "postgres_database";
|
|
587
|
+
volume: "volume";
|
|
588
588
|
}>;
|
|
589
589
|
select: z.ZodOptional<z.ZodString>;
|
|
590
590
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -620,12 +620,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
620
620
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
621
621
|
type: z.ZodLiteral<"kind">;
|
|
622
622
|
resourceKind: z.ZodEnum<{
|
|
623
|
-
volume: "volume";
|
|
624
|
-
genie_space: "genie_space";
|
|
625
623
|
warehouse: "warehouse";
|
|
624
|
+
genie_space: "genie_space";
|
|
626
625
|
postgres_project: "postgres_project";
|
|
627
626
|
postgres_branch: "postgres_branch";
|
|
628
627
|
postgres_database: "postgres_database";
|
|
628
|
+
volume: "volume";
|
|
629
629
|
}>;
|
|
630
630
|
select: z.ZodOptional<z.ZodString>;
|
|
631
631
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -660,12 +660,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
660
660
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
661
661
|
type: z.ZodLiteral<"kind">;
|
|
662
662
|
resourceKind: z.ZodEnum<{
|
|
663
|
-
volume: "volume";
|
|
664
|
-
genie_space: "genie_space";
|
|
665
663
|
warehouse: "warehouse";
|
|
664
|
+
genie_space: "genie_space";
|
|
666
665
|
postgres_project: "postgres_project";
|
|
667
666
|
postgres_branch: "postgres_branch";
|
|
668
667
|
postgres_database: "postgres_database";
|
|
668
|
+
volume: "volume";
|
|
669
669
|
}>;
|
|
670
670
|
select: z.ZodOptional<z.ZodString>;
|
|
671
671
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -701,12 +701,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
701
701
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
702
702
|
type: z.ZodLiteral<"kind">;
|
|
703
703
|
resourceKind: z.ZodEnum<{
|
|
704
|
-
volume: "volume";
|
|
705
|
-
genie_space: "genie_space";
|
|
706
704
|
warehouse: "warehouse";
|
|
705
|
+
genie_space: "genie_space";
|
|
707
706
|
postgres_project: "postgres_project";
|
|
708
707
|
postgres_branch: "postgres_branch";
|
|
709
708
|
postgres_database: "postgres_database";
|
|
709
|
+
volume: "volume";
|
|
710
710
|
}>;
|
|
711
711
|
select: z.ZodOptional<z.ZodString>;
|
|
712
712
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -741,12 +741,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
741
741
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
742
742
|
type: z.ZodLiteral<"kind">;
|
|
743
743
|
resourceKind: z.ZodEnum<{
|
|
744
|
-
volume: "volume";
|
|
745
|
-
genie_space: "genie_space";
|
|
746
744
|
warehouse: "warehouse";
|
|
745
|
+
genie_space: "genie_space";
|
|
747
746
|
postgres_project: "postgres_project";
|
|
748
747
|
postgres_branch: "postgres_branch";
|
|
749
748
|
postgres_database: "postgres_database";
|
|
749
|
+
volume: "volume";
|
|
750
750
|
}>;
|
|
751
751
|
select: z.ZodOptional<z.ZodString>;
|
|
752
752
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -780,12 +780,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
780
780
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
781
781
|
type: z.ZodLiteral<"kind">;
|
|
782
782
|
resourceKind: z.ZodEnum<{
|
|
783
|
-
volume: "volume";
|
|
784
|
-
genie_space: "genie_space";
|
|
785
783
|
warehouse: "warehouse";
|
|
784
|
+
genie_space: "genie_space";
|
|
786
785
|
postgres_project: "postgres_project";
|
|
787
786
|
postgres_branch: "postgres_branch";
|
|
788
787
|
postgres_database: "postgres_database";
|
|
788
|
+
volume: "volume";
|
|
789
789
|
}>;
|
|
790
790
|
select: z.ZodOptional<z.ZodString>;
|
|
791
791
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -819,12 +819,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
819
819
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
820
820
|
type: z.ZodLiteral<"kind">;
|
|
821
821
|
resourceKind: z.ZodEnum<{
|
|
822
|
-
volume: "volume";
|
|
823
|
-
genie_space: "genie_space";
|
|
824
822
|
warehouse: "warehouse";
|
|
823
|
+
genie_space: "genie_space";
|
|
825
824
|
postgres_project: "postgres_project";
|
|
826
825
|
postgres_branch: "postgres_branch";
|
|
827
826
|
postgres_database: "postgres_database";
|
|
827
|
+
volume: "volume";
|
|
828
828
|
}>;
|
|
829
829
|
select: z.ZodOptional<z.ZodString>;
|
|
830
830
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -858,12 +858,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
858
858
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
859
859
|
type: z.ZodLiteral<"kind">;
|
|
860
860
|
resourceKind: z.ZodEnum<{
|
|
861
|
-
volume: "volume";
|
|
862
|
-
genie_space: "genie_space";
|
|
863
861
|
warehouse: "warehouse";
|
|
862
|
+
genie_space: "genie_space";
|
|
864
863
|
postgres_project: "postgres_project";
|
|
865
864
|
postgres_branch: "postgres_branch";
|
|
866
865
|
postgres_database: "postgres_database";
|
|
866
|
+
volume: "volume";
|
|
867
867
|
}>;
|
|
868
868
|
select: z.ZodOptional<z.ZodString>;
|
|
869
869
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -897,12 +897,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
897
897
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
898
898
|
type: z.ZodLiteral<"kind">;
|
|
899
899
|
resourceKind: z.ZodEnum<{
|
|
900
|
-
volume: "volume";
|
|
901
|
-
genie_space: "genie_space";
|
|
902
900
|
warehouse: "warehouse";
|
|
901
|
+
genie_space: "genie_space";
|
|
903
902
|
postgres_project: "postgres_project";
|
|
904
903
|
postgres_branch: "postgres_branch";
|
|
905
904
|
postgres_database: "postgres_database";
|
|
905
|
+
volume: "volume";
|
|
906
906
|
}>;
|
|
907
907
|
select: z.ZodOptional<z.ZodString>;
|
|
908
908
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -936,12 +936,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
936
936
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
937
937
|
type: z.ZodLiteral<"kind">;
|
|
938
938
|
resourceKind: z.ZodEnum<{
|
|
939
|
-
volume: "volume";
|
|
940
|
-
genie_space: "genie_space";
|
|
941
939
|
warehouse: "warehouse";
|
|
940
|
+
genie_space: "genie_space";
|
|
942
941
|
postgres_project: "postgres_project";
|
|
943
942
|
postgres_branch: "postgres_branch";
|
|
944
943
|
postgres_database: "postgres_database";
|
|
944
|
+
volume: "volume";
|
|
945
945
|
}>;
|
|
946
946
|
select: z.ZodOptional<z.ZodString>;
|
|
947
947
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -978,12 +978,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
978
978
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
979
979
|
type: z.ZodLiteral<"kind">;
|
|
980
980
|
resourceKind: z.ZodEnum<{
|
|
981
|
-
volume: "volume";
|
|
982
|
-
genie_space: "genie_space";
|
|
983
981
|
warehouse: "warehouse";
|
|
982
|
+
genie_space: "genie_space";
|
|
984
983
|
postgres_project: "postgres_project";
|
|
985
984
|
postgres_branch: "postgres_branch";
|
|
986
985
|
postgres_database: "postgres_database";
|
|
986
|
+
volume: "volume";
|
|
987
987
|
}>;
|
|
988
988
|
select: z.ZodOptional<z.ZodString>;
|
|
989
989
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1019,12 +1019,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
1019
1019
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1020
1020
|
type: z.ZodLiteral<"kind">;
|
|
1021
1021
|
resourceKind: z.ZodEnum<{
|
|
1022
|
-
volume: "volume";
|
|
1023
|
-
genie_space: "genie_space";
|
|
1024
1022
|
warehouse: "warehouse";
|
|
1023
|
+
genie_space: "genie_space";
|
|
1025
1024
|
postgres_project: "postgres_project";
|
|
1026
1025
|
postgres_branch: "postgres_branch";
|
|
1027
1026
|
postgres_database: "postgres_database";
|
|
1027
|
+
volume: "volume";
|
|
1028
1028
|
}>;
|
|
1029
1029
|
select: z.ZodOptional<z.ZodString>;
|
|
1030
1030
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1058,12 +1058,12 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
1058
1058
|
discovery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1059
1059
|
type: z.ZodLiteral<"kind">;
|
|
1060
1060
|
resourceKind: z.ZodEnum<{
|
|
1061
|
-
volume: "volume";
|
|
1062
|
-
genie_space: "genie_space";
|
|
1063
1061
|
warehouse: "warehouse";
|
|
1062
|
+
genie_space: "genie_space";
|
|
1064
1063
|
postgres_project: "postgres_project";
|
|
1065
1064
|
postgres_branch: "postgres_branch";
|
|
1066
1065
|
postgres_database: "postgres_database";
|
|
1066
|
+
volume: "volume";
|
|
1067
1067
|
}>;
|
|
1068
1068
|
select: z.ZodOptional<z.ZodString>;
|
|
1069
1069
|
display: z.ZodOptional<z.ZodString>;
|
package/dist/telemetry/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { normalizeTelemetryOptions } from "./config.js";
|
|
|
2
2
|
import { instrumentations } from "./instrumentations.js";
|
|
3
3
|
import { TelemetryProvider } from "./telemetry-provider.js";
|
|
4
4
|
import { TelemetryManager } from "./telemetry-manager.js";
|
|
5
|
-
import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
5
|
+
import { SpanKind as SpanKind$1, SpanStatusCode } from "@opentelemetry/api";
|
|
6
6
|
import { SeverityNumber as SeverityNumber$1 } from "@opentelemetry/api-logs";
|
|
7
7
|
|
|
8
|
-
export { SeverityNumber$1 as SeverityNumber, SpanKind, SpanStatusCode };
|
|
8
|
+
export { SeverityNumber$1 as SeverityNumber, SpanKind$1 as SpanKind, SpanStatusCode };
|
|
@@ -1,24 +1,49 @@
|
|
|
1
1
|
import { createLogger } from "../logging/logger.js";
|
|
2
2
|
import { TelemetryProvider } from "./telemetry-provider.js";
|
|
3
3
|
import { AppKitSampler } from "./trace-sampler.js";
|
|
4
|
+
import { metrics } from "@opentelemetry/api";
|
|
5
|
+
import { logs } from "@opentelemetry/api-logs";
|
|
4
6
|
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
|
|
5
7
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
|
|
6
8
|
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
|
|
7
9
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
|
8
10
|
import { registerInstrumentations } from "@opentelemetry/instrumentation";
|
|
9
11
|
import { detectResources, envDetector, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
|
|
10
|
-
import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
11
|
-
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
12
|
-
import {
|
|
12
|
+
import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
13
|
+
import { MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
14
|
+
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
15
|
+
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
13
16
|
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
|
|
14
17
|
|
|
15
18
|
//#region src/telemetry/telemetry-manager.ts
|
|
16
19
|
const logger = createLogger("telemetry");
|
|
20
|
+
/**
|
|
21
|
+
* Owns the app's OpenTelemetry providers, split into two phases so plugins can
|
|
22
|
+
* contribute trace span processors before the tracer provider is built.
|
|
23
|
+
*
|
|
24
|
+
* - `initialize()` runs at app bootstrap, before plugin setup. It registers the
|
|
25
|
+
* meter and logger providers eagerly, because OTel's metrics API has no lazy
|
|
26
|
+
* proxy: a counter/histogram bound against the NoOp meter (as every connector
|
|
27
|
+
* and the cache do in their constructors) stays NoOp for the process lifetime.
|
|
28
|
+
* It does NOT register a tracer provider.
|
|
29
|
+
* - `registerSpanProcessor()` is called by plugins during `setup()` to add a
|
|
30
|
+
* span processor (e.g. an MLflow exporter) to the not-yet-built tracer.
|
|
31
|
+
* - `start()` runs after all plugin `setup()` completes. It builds the single
|
|
32
|
+
* global tracer provider with the OTLP processor (if configured) plus every
|
|
33
|
+
* contributed processor. Deferring is safe for traces: OTel's ProxyTracer
|
|
34
|
+
* rebinds tracers obtained before registration, and no span is emitted during
|
|
35
|
+
* setup.
|
|
36
|
+
*/
|
|
17
37
|
var TelemetryManager = class TelemetryManager {
|
|
18
38
|
static DEFAULT_EXPORT_INTERVAL_MS = 1e4;
|
|
19
39
|
static DEFAULT_FALLBACK_APP_NAME = "databricks-app";
|
|
20
40
|
static instance;
|
|
21
|
-
|
|
41
|
+
resource;
|
|
42
|
+
meterProvider;
|
|
43
|
+
loggerProvider;
|
|
44
|
+
tracerProvider;
|
|
45
|
+
spanProcessors = [];
|
|
46
|
+
started = false;
|
|
22
47
|
shutdownPromise;
|
|
23
48
|
/**
|
|
24
49
|
* Create a scoped telemetry provider for a specific plugin.
|
|
@@ -38,29 +63,84 @@ var TelemetryManager = class TelemetryManager {
|
|
|
38
63
|
static initialize(config = {}) {
|
|
39
64
|
TelemetryManager.getInstance()._initialize(config);
|
|
40
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Contribute a span processor to the not-yet-built tracer provider. Called by
|
|
68
|
+
* plugins during `setup()`. No-op with a warning once `start()` has run, since
|
|
69
|
+
* a started provider's processors are immutable in OTel JS 2.x.
|
|
70
|
+
*/
|
|
71
|
+
static registerSpanProcessor(processor) {
|
|
72
|
+
TelemetryManager.getInstance()._registerSpanProcessor(processor);
|
|
73
|
+
}
|
|
74
|
+
_registerSpanProcessor(processor) {
|
|
75
|
+
if (this.started) {
|
|
76
|
+
logger.warn("registerSpanProcessor called after start(); processor ignored. Contribute span processors during plugin setup().");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.spanProcessors.push(processor);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Phase 1: register the meter and logger providers eagerly (before plugin
|
|
83
|
+
* setup), so metric instruments bound in connector/cache constructors attach
|
|
84
|
+
* to real meters. The tracer provider is deferred to `start()`.
|
|
85
|
+
*
|
|
86
|
+
* When no OTLP endpoint is configured, meter/logger registration is skipped;
|
|
87
|
+
* a contributed span processor can still bring up tracing in `start()`.
|
|
88
|
+
*/
|
|
41
89
|
_initialize(config) {
|
|
42
|
-
if (this.
|
|
90
|
+
if (this.resource) return;
|
|
91
|
+
this.resource = this.createResource(config);
|
|
43
92
|
if (!process.env.OTEL_EXPORTER_OTLP_ENDPOINT) return;
|
|
44
93
|
try {
|
|
45
|
-
this.
|
|
46
|
-
resource: this.
|
|
47
|
-
|
|
48
|
-
sampler: new AppKitSampler(),
|
|
49
|
-
traceExporter: new OTLPTraceExporter({ headers: config.headers }),
|
|
50
|
-
metricReaders: [new PeriodicExportingMetricReader({
|
|
94
|
+
this.meterProvider = new MeterProvider({
|
|
95
|
+
resource: this.resource,
|
|
96
|
+
readers: [new PeriodicExportingMetricReader({
|
|
51
97
|
exporter: new OTLPMetricExporter({ headers: config.headers }),
|
|
52
98
|
exportIntervalMillis: config.exportIntervalMs || TelemetryManager.DEFAULT_EXPORT_INTERVAL_MS
|
|
53
|
-
})]
|
|
54
|
-
|
|
55
|
-
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
metrics.setGlobalMeterProvider(this.meterProvider);
|
|
102
|
+
this.loggerProvider = new LoggerProvider({
|
|
103
|
+
resource: this.resource,
|
|
104
|
+
processors: [new BatchLogRecordProcessor(new OTLPLogExporter({ headers: config.headers }))]
|
|
56
105
|
});
|
|
57
|
-
this.
|
|
58
|
-
|
|
106
|
+
logs.setGlobalLoggerProvider(this.loggerProvider);
|
|
107
|
+
this.spanProcessors.push(new BatchSpanProcessor(new OTLPTraceExporter({ headers: config.headers })));
|
|
108
|
+
this.registerInstrumentations(this.getDefaultInstrumentations());
|
|
109
|
+
logger.debug("Meter/logger providers initialized");
|
|
59
110
|
} catch (error) {
|
|
60
111
|
logger.error("Failed to initialize: %O", error);
|
|
61
112
|
}
|
|
62
113
|
}
|
|
63
114
|
/**
|
|
115
|
+
* Phase 2: build and register the global tracer provider. Called by core
|
|
116
|
+
* after every plugin's `setup()` completes, so all contributed span
|
|
117
|
+
* processors are known. No-op when nothing needs tracing (no OTLP endpoint
|
|
118
|
+
* and no contributed processor), preserving "no telemetry unless configured".
|
|
119
|
+
*
|
|
120
|
+
* `NodeTracerProvider.register()` installs the async-hooks context manager and
|
|
121
|
+
* W3C propagators — the same wiring `NodeSDK.start()` did — so span nesting
|
|
122
|
+
* across awaits is preserved.
|
|
123
|
+
*/
|
|
124
|
+
static start() {
|
|
125
|
+
TelemetryManager.getInstance()._start();
|
|
126
|
+
}
|
|
127
|
+
_start() {
|
|
128
|
+
if (this.started) return;
|
|
129
|
+
this.started = true;
|
|
130
|
+
if (this.spanProcessors.length === 0) return;
|
|
131
|
+
try {
|
|
132
|
+
this.tracerProvider = new NodeTracerProvider({
|
|
133
|
+
resource: this.resource,
|
|
134
|
+
sampler: new AppKitSampler(),
|
|
135
|
+
spanProcessors: this.spanProcessors
|
|
136
|
+
});
|
|
137
|
+
this.tracerProvider.register();
|
|
138
|
+
logger.debug("Tracer provider started with %d span processor(s)", this.spanProcessors.length);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
logger.error("Failed to start tracer provider: %O", error);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
64
144
|
* Register OpenTelemetry instrumentations.
|
|
65
145
|
* Can be called at any time, but recommended to call in plugin constructor.
|
|
66
146
|
* @param instrumentations - Array of OpenTelemetry instrumentations to register
|
|
@@ -91,23 +171,31 @@ var TelemetryManager = class TelemetryManager {
|
|
|
91
171
|
})];
|
|
92
172
|
}
|
|
93
173
|
/**
|
|
94
|
-
* Flush and shut down the
|
|
174
|
+
* Flush and shut down the tracer, meter, and logger providers.
|
|
95
175
|
*
|
|
96
|
-
* Idempotent: the
|
|
176
|
+
* Idempotent: the provider references are cleared synchronously and concurrent
|
|
97
177
|
* or repeated calls await the same in-flight flush. Awaited by the core
|
|
98
178
|
* lifecycle manager during graceful shutdown — that manager owns the
|
|
99
179
|
* process signal handlers, so telemetry no longer registers its own.
|
|
100
180
|
*/
|
|
101
181
|
async shutdown() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
182
|
+
const providers = [
|
|
183
|
+
this.tracerProvider,
|
|
184
|
+
this.meterProvider,
|
|
185
|
+
this.loggerProvider
|
|
186
|
+
].filter((p) => p !== void 0);
|
|
187
|
+
if (providers.length > 0) {
|
|
188
|
+
this.tracerProvider = void 0;
|
|
189
|
+
this.meterProvider = void 0;
|
|
190
|
+
this.loggerProvider = void 0;
|
|
105
191
|
this.shutdownPromise = (async () => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
192
|
+
await Promise.all(providers.map(async (provider) => {
|
|
193
|
+
try {
|
|
194
|
+
await provider.shutdown();
|
|
195
|
+
} catch (error) {
|
|
196
|
+
logger.error("Error shutting down: %O", error);
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
111
199
|
})();
|
|
112
200
|
}
|
|
113
201
|
return this.shutdownPromise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-manager.js","names":[],"sources":["../../src/telemetry/telemetry-manager.ts"],"sourcesContent":["import { getNodeAutoInstrumentations } from \"@opentelemetry/auto-instrumentations-node\";\nimport { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-proto\";\nimport { OTLPMetricExporter } from \"@opentelemetry/exporter-metrics-otlp-proto\";\nimport { OTLPTraceExporter } from \"@opentelemetry/exporter-trace-otlp-proto\";\nimport {\n type Instrumentation,\n registerInstrumentations as otelRegisterInstrumentations,\n} from \"@opentelemetry/instrumentation\";\nimport {\n detectResources,\n envDetector,\n hostDetector,\n processDetector,\n type Resource,\n resourceFromAttributes,\n} from \"@opentelemetry/resources\";\nimport { BatchLogRecordProcessor } from \"@opentelemetry/sdk-logs\";\nimport { PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\";\nimport { NodeSDK } from \"@opentelemetry/sdk-node\";\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n} from \"@opentelemetry/semantic-conventions\";\nimport type { TelemetryOptions } from \"shared\";\n\nimport { createLogger } from \"../logging/logger\";\nimport { TelemetryProvider } from \"./telemetry-provider\";\nimport { AppKitSampler } from \"./trace-sampler\";\nimport type { TelemetryConfig } from \"./types\";\n\nconst logger = createLogger(\"telemetry\");\n\nexport class TelemetryManager {\n private static readonly DEFAULT_EXPORT_INTERVAL_MS = 10000;\n private static readonly DEFAULT_FALLBACK_APP_NAME = \"databricks-app\";\n\n private static instance?: TelemetryManager;\n private sdk?: NodeSDK;\n private shutdownPromise?: Promise<void>;\n\n /**\n * Create a scoped telemetry provider for a specific plugin.\n * The plugin's name will be used as the default tracer/meter name.\n * @param pluginName - The name of the plugin to create scoped telemetry for\n * @param telemetryConfig - The telemetry configuration for the plugin\n * @returns A scoped telemetry instance for the plugin\n */\n static getProvider(\n pluginName: string,\n telemetryConfig?: TelemetryOptions,\n ): TelemetryProvider {\n const globalManager = TelemetryManager.getInstance();\n return new TelemetryProvider(pluginName, globalManager, telemetryConfig);\n }\n\n private constructor() {}\n\n static getInstance(): TelemetryManager {\n if (!TelemetryManager.instance) {\n TelemetryManager.instance = new TelemetryManager();\n }\n return TelemetryManager.instance;\n }\n\n static initialize(config: Partial<TelemetryConfig> = {}): void {\n const instance = TelemetryManager.getInstance();\n instance._initialize(config);\n }\n\n private _initialize(config: Partial<TelemetryConfig>): void {\n if (this.sdk) return;\n\n if (!process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n return;\n }\n\n try {\n this.sdk = new NodeSDK({\n resource: this.createResource(config),\n autoDetectResources: false,\n sampler: new AppKitSampler(),\n traceExporter: new OTLPTraceExporter({ headers: config.headers }),\n metricReaders: [\n new PeriodicExportingMetricReader({\n exporter: new OTLPMetricExporter({ headers: config.headers }),\n exportIntervalMillis:\n config.exportIntervalMs ||\n TelemetryManager.DEFAULT_EXPORT_INTERVAL_MS,\n }),\n ],\n logRecordProcessors: [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({ headers: config.headers }),\n ),\n ],\n instrumentations: this.getDefaultInstrumentations(),\n });\n\n this.sdk.start();\n logger.debug(\"Initialized successfully\");\n } catch (error) {\n logger.error(\"Failed to initialize: %O\", error);\n }\n }\n\n /**\n * Register OpenTelemetry instrumentations.\n * Can be called at any time, but recommended to call in plugin constructor.\n * @param instrumentations - Array of OpenTelemetry instrumentations to register\n */\n registerInstrumentations(instrumentations: Instrumentation[]): void {\n otelRegisterInstrumentations({\n // global providers set by NodeSDK.start()\n instrumentations,\n });\n }\n\n private createResource(config: Partial<TelemetryConfig>): Resource {\n const serviceName =\n config.serviceName ||\n process.env.OTEL_SERVICE_NAME ||\n process.env.DATABRICKS_APP_NAME ||\n TelemetryManager.DEFAULT_FALLBACK_APP_NAME;\n const initialResource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: serviceName,\n [ATTR_SERVICE_VERSION]: config.serviceVersion ?? undefined,\n });\n const detectedResource = detectResources({\n detectors: [envDetector, hostDetector, processDetector],\n });\n return initialResource.merge(detectedResource);\n }\n\n private getDefaultInstrumentations(): Instrumentation[] {\n return [\n ...getNodeAutoInstrumentations({\n //\n // enabled as a part of the server plugin\n //\n \"@opentelemetry/instrumentation-http\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-express\": {\n enabled: false,\n },\n //\n // reduce noise\n //\n \"@opentelemetry/instrumentation-fs\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-dns\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-net\": {\n enabled: false,\n },\n }),\n ];\n }\n\n /**\n * Flush and shut down the OpenTelemetry SDK.\n *\n * Idempotent: the SDK reference is cleared synchronously and concurrent\n * or repeated calls await the same in-flight flush. Awaited by the core\n * lifecycle manager during graceful shutdown — that manager owns the\n * process signal handlers, so telemetry no longer registers its own.\n */\n async shutdown(): Promise<void> {\n if (this.sdk) {\n const sdk = this.sdk;\n this.sdk = undefined;\n this.shutdownPromise = (async () => {\n try {\n await sdk.shutdown();\n } catch (error) {\n logger.error(\"Error shutting down: %O\", error);\n }\n })();\n }\n\n return this.shutdownPromise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAM,SAAS,aAAa,YAAY;AAExC,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,OAAwB,6BAA6B;CACrD,OAAwB,4BAA4B;CAEpD,OAAe;CACf,AAAQ;CACR,AAAQ;;;;;;;;CASR,OAAO,YACL,YACA,iBACmB;AAEnB,SAAO,IAAI,kBAAkB,YADP,iBAAiB,aAAa,EACI,gBAAgB;;CAG1E,AAAQ,cAAc;CAEtB,OAAO,cAAgC;AACrC,MAAI,CAAC,iBAAiB,SACpB,kBAAiB,WAAW,IAAI,kBAAkB;AAEpD,SAAO,iBAAiB;;CAG1B,OAAO,WAAW,SAAmC,EAAE,EAAQ;AAE7D,EADiB,iBAAiB,aAAa,CACtC,YAAY,OAAO;;CAG9B,AAAQ,YAAY,QAAwC;AAC1D,MAAI,KAAK,IAAK;AAEd,MAAI,CAAC,QAAQ,IAAI,4BACf;AAGF,MAAI;AACF,QAAK,MAAM,IAAI,QAAQ;IACrB,UAAU,KAAK,eAAe,OAAO;IACrC,qBAAqB;IACrB,SAAS,IAAI,eAAe;IAC5B,eAAe,IAAI,kBAAkB,EAAE,SAAS,OAAO,SAAS,CAAC;IACjE,eAAe,CACb,IAAI,8BAA8B;KAChC,UAAU,IAAI,mBAAmB,EAAE,SAAS,OAAO,SAAS,CAAC;KAC7D,sBACE,OAAO,oBACP,iBAAiB;KACpB,CAAC,CACH;IACD,qBAAqB,CACnB,IAAI,wBACF,IAAI,gBAAgB,EAAE,SAAS,OAAO,SAAS,CAAC,CACjD,CACF;IACD,kBAAkB,KAAK,4BAA4B;IACpD,CAAC;AAEF,QAAK,IAAI,OAAO;AAChB,UAAO,MAAM,2BAA2B;WACjC,OAAO;AACd,UAAO,MAAM,4BAA4B,MAAM;;;;;;;;CASnD,yBAAyB,kBAA2C;AAClE,2BAA6B,EAE3B,kBACD,CAAC;;CAGJ,AAAQ,eAAe,QAA4C;EACjE,MAAM,cACJ,OAAO,eACP,QAAQ,IAAI,qBACZ,QAAQ,IAAI,uBACZ,iBAAiB;EACnB,MAAM,kBAAkB,uBAAuB;IAC5C,oBAAoB;IACpB,uBAAuB,OAAO,kBAAkB;GAClD,CAAC;EACF,MAAM,mBAAmB,gBAAgB,EACvC,WAAW;GAAC;GAAa;GAAc;GAAgB,EACxD,CAAC;AACF,SAAO,gBAAgB,MAAM,iBAAiB;;CAGhD,AAAQ,6BAAgD;AACtD,SAAO,CACL,GAAG,4BAA4B;GAI7B,uCAAuC,EACrC,SAAS,OACV;GACD,0CAA0C,EACxC,SAAS,OACV;GAID,qCAAqC,EACnC,SAAS,OACV;GACD,sCAAsC,EACpC,SAAS,OACV;GACD,sCAAsC,EACpC,SAAS,OACV;GACF,CAAC,CACH;;;;;;;;;;CAWH,MAAM,WAA0B;AAC9B,MAAI,KAAK,KAAK;GACZ,MAAM,MAAM,KAAK;AACjB,QAAK,MAAM;AACX,QAAK,mBAAmB,YAAY;AAClC,QAAI;AACF,WAAM,IAAI,UAAU;aACb,OAAO;AACd,YAAO,MAAM,2BAA2B,MAAM;;OAE9C;;AAGN,SAAO,KAAK"}
|
|
1
|
+
{"version":3,"file":"telemetry-manager.js","names":[],"sources":["../../src/telemetry/telemetry-manager.ts"],"sourcesContent":["import { metrics } from \"@opentelemetry/api\";\nimport { logs } from \"@opentelemetry/api-logs\";\nimport { getNodeAutoInstrumentations } from \"@opentelemetry/auto-instrumentations-node\";\nimport { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-proto\";\nimport { OTLPMetricExporter } from \"@opentelemetry/exporter-metrics-otlp-proto\";\nimport { OTLPTraceExporter } from \"@opentelemetry/exporter-trace-otlp-proto\";\nimport {\n type Instrumentation,\n registerInstrumentations as otelRegisterInstrumentations,\n} from \"@opentelemetry/instrumentation\";\nimport {\n detectResources,\n envDetector,\n hostDetector,\n processDetector,\n type Resource,\n resourceFromAttributes,\n} from \"@opentelemetry/resources\";\nimport {\n BatchLogRecordProcessor,\n LoggerProvider,\n} from \"@opentelemetry/sdk-logs\";\nimport {\n MeterProvider,\n PeriodicExportingMetricReader,\n} from \"@opentelemetry/sdk-metrics\";\nimport {\n BatchSpanProcessor,\n type SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\nimport { NodeTracerProvider } from \"@opentelemetry/sdk-trace-node\";\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n} from \"@opentelemetry/semantic-conventions\";\nimport type { TelemetryOptions } from \"shared\";\n\nimport { createLogger } from \"../logging/logger\";\nimport { TelemetryProvider } from \"./telemetry-provider\";\nimport { AppKitSampler } from \"./trace-sampler\";\nimport type { TelemetryConfig } from \"./types\";\n\nconst logger = createLogger(\"telemetry\");\n\n/**\n * Owns the app's OpenTelemetry providers, split into two phases so plugins can\n * contribute trace span processors before the tracer provider is built.\n *\n * - `initialize()` runs at app bootstrap, before plugin setup. It registers the\n * meter and logger providers eagerly, because OTel's metrics API has no lazy\n * proxy: a counter/histogram bound against the NoOp meter (as every connector\n * and the cache do in their constructors) stays NoOp for the process lifetime.\n * It does NOT register a tracer provider.\n * - `registerSpanProcessor()` is called by plugins during `setup()` to add a\n * span processor (e.g. an MLflow exporter) to the not-yet-built tracer.\n * - `start()` runs after all plugin `setup()` completes. It builds the single\n * global tracer provider with the OTLP processor (if configured) plus every\n * contributed processor. Deferring is safe for traces: OTel's ProxyTracer\n * rebinds tracers obtained before registration, and no span is emitted during\n * setup.\n */\nexport class TelemetryManager {\n private static readonly DEFAULT_EXPORT_INTERVAL_MS = 10000;\n private static readonly DEFAULT_FALLBACK_APP_NAME = \"databricks-app\";\n\n private static instance?: TelemetryManager;\n private resource?: Resource;\n private meterProvider?: MeterProvider;\n private loggerProvider?: LoggerProvider;\n private tracerProvider?: NodeTracerProvider;\n private readonly spanProcessors: SpanProcessor[] = [];\n private started = false;\n private shutdownPromise?: Promise<void>;\n\n /**\n * Create a scoped telemetry provider for a specific plugin.\n * The plugin's name will be used as the default tracer/meter name.\n * @param pluginName - The name of the plugin to create scoped telemetry for\n * @param telemetryConfig - The telemetry configuration for the plugin\n * @returns A scoped telemetry instance for the plugin\n */\n static getProvider(\n pluginName: string,\n telemetryConfig?: TelemetryOptions,\n ): TelemetryProvider {\n const globalManager = TelemetryManager.getInstance();\n return new TelemetryProvider(pluginName, globalManager, telemetryConfig);\n }\n\n private constructor() {}\n\n static getInstance(): TelemetryManager {\n if (!TelemetryManager.instance) {\n TelemetryManager.instance = new TelemetryManager();\n }\n return TelemetryManager.instance;\n }\n\n static initialize(config: Partial<TelemetryConfig> = {}): void {\n const instance = TelemetryManager.getInstance();\n instance._initialize(config);\n }\n\n /**\n * Contribute a span processor to the not-yet-built tracer provider. Called by\n * plugins during `setup()`. No-op with a warning once `start()` has run, since\n * a started provider's processors are immutable in OTel JS 2.x.\n */\n static registerSpanProcessor(processor: SpanProcessor): void {\n TelemetryManager.getInstance()._registerSpanProcessor(processor);\n }\n\n private _registerSpanProcessor(processor: SpanProcessor): void {\n if (this.started) {\n logger.warn(\n \"registerSpanProcessor called after start(); processor ignored. \" +\n \"Contribute span processors during plugin setup().\",\n );\n return;\n }\n this.spanProcessors.push(processor);\n }\n\n /**\n * Phase 1: register the meter and logger providers eagerly (before plugin\n * setup), so metric instruments bound in connector/cache constructors attach\n * to real meters. The tracer provider is deferred to `start()`.\n *\n * When no OTLP endpoint is configured, meter/logger registration is skipped;\n * a contributed span processor can still bring up tracing in `start()`.\n */\n private _initialize(config: Partial<TelemetryConfig>): void {\n if (this.resource) return;\n this.resource = this.createResource(config);\n\n // OTLP exporters need an endpoint. Without one there is nothing to export\n // metrics/logs to, so skip those providers — but still capture the resource\n // and let `start()` bring up a tracer if a plugin contributed a processor.\n if (!process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n return;\n }\n\n try {\n this.meterProvider = new MeterProvider({\n resource: this.resource,\n readers: [\n new PeriodicExportingMetricReader({\n exporter: new OTLPMetricExporter({ headers: config.headers }),\n exportIntervalMillis:\n config.exportIntervalMs ||\n TelemetryManager.DEFAULT_EXPORT_INTERVAL_MS,\n }),\n ],\n });\n metrics.setGlobalMeterProvider(this.meterProvider);\n\n this.loggerProvider = new LoggerProvider({\n resource: this.resource,\n processors: [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({ headers: config.headers }),\n ),\n ],\n });\n logs.setGlobalLoggerProvider(this.loggerProvider);\n\n // The OTLP trace exporter is the first span processor; contributed\n // processors join it in `start()`.\n this.spanProcessors.push(\n new BatchSpanProcessor(\n new OTLPTraceExporter({ headers: config.headers }),\n ),\n );\n\n this.registerInstrumentations(this.getDefaultInstrumentations());\n logger.debug(\"Meter/logger providers initialized\");\n } catch (error) {\n logger.error(\"Failed to initialize: %O\", error);\n }\n }\n\n /**\n * Phase 2: build and register the global tracer provider. Called by core\n * after every plugin's `setup()` completes, so all contributed span\n * processors are known. No-op when nothing needs tracing (no OTLP endpoint\n * and no contributed processor), preserving \"no telemetry unless configured\".\n *\n * `NodeTracerProvider.register()` installs the async-hooks context manager and\n * W3C propagators — the same wiring `NodeSDK.start()` did — so span nesting\n * across awaits is preserved.\n */\n static start(): void {\n TelemetryManager.getInstance()._start();\n }\n\n private _start(): void {\n if (this.started) return;\n this.started = true;\n\n if (this.spanProcessors.length === 0) {\n return;\n }\n\n try {\n this.tracerProvider = new NodeTracerProvider({\n resource: this.resource,\n sampler: new AppKitSampler(),\n spanProcessors: this.spanProcessors,\n });\n this.tracerProvider.register();\n logger.debug(\n \"Tracer provider started with %d span processor(s)\",\n this.spanProcessors.length,\n );\n } catch (error) {\n logger.error(\"Failed to start tracer provider: %O\", error);\n }\n }\n\n /**\n * Register OpenTelemetry instrumentations.\n * Can be called at any time, but recommended to call in plugin constructor.\n * @param instrumentations - Array of OpenTelemetry instrumentations to register\n */\n registerInstrumentations(instrumentations: Instrumentation[]): void {\n otelRegisterInstrumentations({\n // Instrumentations bind to the global providers registered by start()\n // (tracer) and _initialize() (meter/logger).\n instrumentations,\n });\n }\n\n private createResource(config: Partial<TelemetryConfig>): Resource {\n const serviceName =\n config.serviceName ||\n process.env.OTEL_SERVICE_NAME ||\n process.env.DATABRICKS_APP_NAME ||\n TelemetryManager.DEFAULT_FALLBACK_APP_NAME;\n const initialResource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: serviceName,\n [ATTR_SERVICE_VERSION]: config.serviceVersion ?? undefined,\n });\n const detectedResource = detectResources({\n detectors: [envDetector, hostDetector, processDetector],\n });\n return initialResource.merge(detectedResource);\n }\n\n private getDefaultInstrumentations(): Instrumentation[] {\n return [\n ...getNodeAutoInstrumentations({\n //\n // enabled as a part of the server plugin\n //\n \"@opentelemetry/instrumentation-http\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-express\": {\n enabled: false,\n },\n //\n // reduce noise\n //\n \"@opentelemetry/instrumentation-fs\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-dns\": {\n enabled: false,\n },\n \"@opentelemetry/instrumentation-net\": {\n enabled: false,\n },\n }),\n ];\n }\n\n /**\n * Flush and shut down the tracer, meter, and logger providers.\n *\n * Idempotent: the provider references are cleared synchronously and concurrent\n * or repeated calls await the same in-flight flush. Awaited by the core\n * lifecycle manager during graceful shutdown — that manager owns the\n * process signal handlers, so telemetry no longer registers its own.\n */\n async shutdown(): Promise<void> {\n const providers = [\n this.tracerProvider,\n this.meterProvider,\n this.loggerProvider,\n ].filter((p): p is NonNullable<typeof p> => p !== undefined);\n\n if (providers.length > 0) {\n this.tracerProvider = undefined;\n this.meterProvider = undefined;\n this.loggerProvider = undefined;\n this.shutdownPromise = (async () => {\n await Promise.all(\n providers.map(async (provider) => {\n try {\n await provider.shutdown();\n } catch (error) {\n logger.error(\"Error shutting down: %O\", error);\n }\n }),\n );\n })();\n }\n\n return this.shutdownPromise;\n }\n}\n"],"mappings":"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"}
|