@geekmidas/telescope 10.0.0-alpha.99 → 10.0.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/CHANGELOG.md +79 -0
- package/README.md +18 -28
- package/dist/InMemoryMetricsStorage-BbKCL3YL.d.mts +47 -0
- package/dist/InMemoryMetricsStorage-BbKCL3YL.d.mts.map +1 -0
- package/dist/InMemoryMetricsStorage-C4drxT7G.mjs +247 -0
- package/dist/InMemoryMetricsStorage-C4drxT7G.mjs.map +1 -0
- package/dist/InMemoryMetricsStorage-D0njWUSi.cjs +252 -0
- package/dist/InMemoryMetricsStorage-D0njWUSi.cjs.map +1 -0
- package/dist/InMemoryMetricsStorage-TvPdZjL0.d.cts +47 -0
- package/dist/InMemoryMetricsStorage-TvPdZjL0.d.cts.map +1 -0
- package/dist/{MetricsAggregator-BJdIvfEv.d.mts → MetricsAggregator-4SqelGcG.d.cts} +6 -3
- package/dist/MetricsAggregator-4SqelGcG.d.cts.map +1 -0
- package/dist/MetricsAggregator-B7lUICdH.cjs +363 -0
- package/dist/MetricsAggregator-B7lUICdH.cjs.map +1 -0
- package/dist/{MetricsAggregator-CnC3oT5q.d.cts → MetricsAggregator-DZrW8ls6.d.mts} +6 -3
- package/dist/MetricsAggregator-DZrW8ls6.d.mts.map +1 -0
- package/dist/MetricsAggregator-S3DQWNas.mjs +357 -0
- package/dist/MetricsAggregator-S3DQWNas.mjs.map +1 -0
- package/dist/MetricsStorage-B86e4131.d.cts +60 -0
- package/dist/MetricsStorage-B86e4131.d.cts.map +1 -0
- package/dist/MetricsStorage-BWyP2_12.d.mts +60 -0
- package/dist/MetricsStorage-BWyP2_12.d.mts.map +1 -0
- package/dist/MetricsStorage-BypQXWiv.mjs +0 -0
- package/dist/MetricsStorage-Or8pVCe4.cjs +0 -0
- package/dist/Telescope-Cs3fv8jt.cjs +395 -0
- package/dist/Telescope-Cs3fv8jt.cjs.map +1 -0
- package/dist/{Telescope-BVfDvVvY.d.mts → Telescope-D4nmwDRA.d.cts} +7 -4
- package/dist/Telescope-D4nmwDRA.d.cts.map +1 -0
- package/dist/Telescope-Dh5av3FC.mjs +389 -0
- package/dist/Telescope-Dh5av3FC.mjs.map +1 -0
- package/dist/{Telescope-DeqSHfuB.d.cts → Telescope-Dl6VSfxd.d.mts} +7 -4
- package/dist/Telescope-Dl6VSfxd.d.mts.map +1 -0
- package/dist/Telescope.cjs +4 -385
- package/dist/Telescope.d.cts +3 -1
- package/dist/Telescope.d.mts +3 -1
- package/dist/Telescope.mjs +4 -384
- package/dist/adapters/index.d.cts +2 -2
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +0 -1
- package/dist/adapters/lambda.cjs +10 -9
- package/dist/adapters/lambda.cjs.map +1 -1
- package/dist/adapters/lambda.d.cts +13 -9
- package/dist/adapters/lambda.d.cts.map +1 -1
- package/dist/adapters/lambda.d.mts +13 -9
- package/dist/adapters/lambda.d.mts.map +1 -1
- package/dist/adapters/lambda.mjs +4 -3
- package/dist/adapters/lambda.mjs.map +1 -1
- package/dist/adapters/middy.cjs +4 -236
- package/dist/adapters/middy.d.cts +5 -60
- package/dist/adapters/middy.d.mts +5 -60
- package/dist/adapters/middy.mjs +3 -234
- package/dist/adapters/types.d.cts +2 -162
- package/dist/adapters/types.d.mts +2 -162
- package/dist/adapters/types.mjs +0 -1
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → chunk-CUT6urMc.cjs} +10 -8
- package/dist/core--quSp5Qr.d.mts +78 -0
- package/dist/core--quSp5Qr.d.mts.map +1 -0
- package/dist/core-B4Jpia5H.d.cts +78 -0
- package/dist/core-B4Jpia5H.d.cts.map +1 -0
- package/dist/core-CtVHRJGv.cjs +199 -0
- package/dist/core-CtVHRJGv.cjs.map +1 -0
- package/dist/core-D6hJ6exL.mjs +139 -0
- package/dist/core-D6hJ6exL.mjs.map +1 -0
- package/dist/core.cjs +22 -22
- package/dist/core.d.cts +4 -4
- package/dist/core.d.mts +4 -4
- package/dist/core.mjs +4 -3
- package/dist/hono--uKQ7Jgi.d.mts +71 -0
- package/dist/hono--uKQ7Jgi.d.mts.map +1 -0
- package/dist/hono-C4EgpbKQ.cjs +160 -0
- package/dist/hono-C4EgpbKQ.cjs.map +1 -0
- package/dist/hono-CemCKU87.d.cts +71 -0
- package/dist/hono-CemCKU87.d.cts.map +1 -0
- package/dist/hono-DxhvnVbF.mjs +136 -0
- package/dist/hono-DxhvnVbF.mjs.map +1 -0
- package/dist/http-BiNtg85L.d.mts +107 -0
- package/dist/http-BiNtg85L.d.mts.map +1 -0
- package/dist/http-DQzgLczm.mjs +159 -0
- package/dist/http-DQzgLczm.mjs.map +1 -0
- package/dist/http-D_Z8sYXZ.cjs +219 -0
- package/dist/http-D_Z8sYXZ.cjs.map +1 -0
- package/dist/http-Dvca6fC3.d.cts +107 -0
- package/dist/http-Dvca6fC3.d.cts.map +1 -0
- package/dist/index-BL32-cvv.d.cts +1 -0
- package/dist/index-CsuikFeJ.d.mts +1 -0
- package/dist/index.cjs +9 -8
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +7 -5
- package/dist/instrumentation/core.cjs +11 -147
- package/dist/instrumentation/core.d.cts +3 -74
- package/dist/instrumentation/core.d.mts +3 -74
- package/dist/instrumentation/core.mjs +2 -137
- package/dist/instrumentation/hono.cjs +6 -174
- package/dist/instrumentation/hono.d.cts +2 -86
- package/dist/instrumentation/hono.d.mts +2 -86
- package/dist/instrumentation/hono.mjs +3 -170
- package/dist/instrumentation/http.cjs +11 -189
- package/dist/instrumentation/http.d.cts +2 -119
- package/dist/instrumentation/http.d.mts +2 -119
- package/dist/instrumentation/http.mjs +2 -178
- package/dist/instrumentation/index.cjs +47 -56
- package/dist/instrumentation/index.d.cts +9 -11
- package/dist/instrumentation/index.d.mts +9 -11
- package/dist/instrumentation/index.mjs +9 -10
- package/dist/instrumentation/middleware.cjs +6 -164
- package/dist/instrumentation/middleware.d.cts +2 -83
- package/dist/instrumentation/middleware.d.mts +2 -83
- package/dist/instrumentation/middleware.mjs +3 -160
- package/dist/instrumentation/otel.cjs +3 -137
- package/dist/instrumentation/otel.d.cts +2 -97
- package/dist/instrumentation/otel.d.mts +2 -97
- package/dist/instrumentation/otel.mjs +3 -136
- package/dist/instrumentation/setup.cjs +4 -142
- package/dist/instrumentation/setup.d.cts +3 -139
- package/dist/instrumentation/setup.d.mts +3 -139
- package/dist/instrumentation/setup.mjs +3 -139
- package/dist/instrumentation/tracing.cjs +10 -114
- package/dist/instrumentation/tracing.d.cts +2 -49
- package/dist/instrumentation/tracing.d.mts +2 -49
- package/dist/instrumentation/tracing.mjs +2 -105
- package/dist/logger/console.cjs +12 -18
- package/dist/logger/console.cjs.map +1 -1
- package/dist/logger/console.d.cts +10 -7
- package/dist/logger/console.d.cts.map +1 -1
- package/dist/logger/console.d.mts +10 -7
- package/dist/logger/console.d.mts.map +1 -1
- package/dist/logger/console.mjs +11 -17
- package/dist/logger/console.mjs.map +1 -1
- package/dist/logger/pino.cjs +5 -6
- package/dist/logger/pino.cjs.map +1 -1
- package/dist/logger/pino.d.cts +10 -6
- package/dist/logger/pino.d.cts.map +1 -1
- package/dist/logger/pino.d.mts +10 -6
- package/dist/logger/pino.d.mts.map +1 -1
- package/dist/logger/pino.mjs +3 -2
- package/dist/logger/pino.mjs.map +1 -1
- package/dist/memory--BK4iWiv.d.cts +40 -0
- package/dist/memory--BK4iWiv.d.cts.map +1 -0
- package/dist/memory-6S9H-IF5.mjs +123 -0
- package/dist/memory-6S9H-IF5.mjs.map +1 -0
- package/dist/memory-B0d_n1g5.cjs +129 -0
- package/dist/memory-B0d_n1g5.cjs.map +1 -0
- package/dist/memory-DCirEVFW.d.mts +40 -0
- package/dist/memory-DCirEVFW.d.mts.map +1 -0
- package/dist/metrics/MetricsAggregator.cjs +2 -354
- package/dist/metrics/MetricsAggregator.d.cts +2 -1
- package/dist/metrics/MetricsAggregator.d.mts +2 -1
- package/dist/metrics/MetricsAggregator.mjs +2 -353
- package/dist/metrics/index.cjs +4 -3
- package/dist/metrics/index.d.cts +4 -2
- package/dist/metrics/index.d.mts +4 -2
- package/dist/metrics/index.mjs +4 -2
- package/dist/metrics/storage/InMemoryMetricsStorage.cjs +3 -240
- package/dist/metrics/storage/InMemoryMetricsStorage.d.cts +4 -43
- package/dist/metrics/storage/InMemoryMetricsStorage.d.mts +4 -43
- package/dist/metrics/storage/InMemoryMetricsStorage.mjs +3 -239
- package/dist/metrics/storage/MetricsStorage.cjs +1 -0
- package/dist/metrics/storage/MetricsStorage.d.cts +3 -56
- package/dist/metrics/storage/MetricsStorage.d.mts +3 -56
- package/dist/metrics/storage/MetricsStorage.mjs +1 -1
- package/dist/metrics/storage/index.cjs +6 -6
- package/dist/metrics/storage/index.d.cts +3 -3
- package/dist/metrics/storage/index.d.mts +3 -3
- package/dist/metrics/storage/index.mjs +5 -4
- package/dist/metrics/storage/types.cjs +2 -34
- package/dist/metrics/storage/types.d.cts +2 -207
- package/dist/metrics/storage/types.d.mts +2 -207
- package/dist/metrics/storage/types.mjs +2 -33
- package/dist/metrics-D5YT-Rnq.mjs +0 -0
- package/dist/metrics-fhD3l3C3.cjs +0 -0
- package/dist/middleware-B2jFUukM.cjs +184 -0
- package/dist/middleware-B2jFUukM.cjs.map +1 -0
- package/dist/middleware-BTDncHwm.mjs +160 -0
- package/dist/middleware-BTDncHwm.mjs.map +1 -0
- package/dist/middleware-CA84nsNN.d.cts +74 -0
- package/dist/middleware-CA84nsNN.d.cts.map +1 -0
- package/dist/middleware-DAceVpfw.d.mts +74 -0
- package/dist/middleware-DAceVpfw.d.mts.map +1 -0
- package/dist/middy-B6Btl8XE.d.mts +64 -0
- package/dist/middy-B6Btl8XE.d.mts.map +1 -0
- package/dist/middy-BTR3cyvk.mjs +236 -0
- package/dist/middy-BTR3cyvk.mjs.map +1 -0
- package/dist/middy-Bq0defVg.d.cts +64 -0
- package/dist/middy-Bq0defVg.d.cts.map +1 -0
- package/dist/middy-y5Zp27eG.cjs +247 -0
- package/dist/middy-y5Zp27eG.cjs.map +1 -0
- package/dist/otel-1bJPb2Z7.d.mts +101 -0
- package/dist/otel-1bJPb2Z7.d.mts.map +1 -0
- package/dist/otel-C1HqHA2O.cjs +136 -0
- package/dist/otel-C1HqHA2O.cjs.map +1 -0
- package/dist/otel-SBVoVEHr.d.cts +101 -0
- package/dist/otel-SBVoVEHr.d.cts.map +1 -0
- package/dist/otel-wulj5B-X.mjs +130 -0
- package/dist/otel-wulj5B-X.mjs.map +1 -0
- package/dist/otlp/hono.cjs +15 -9
- package/dist/otlp/hono.cjs.map +1 -1
- package/dist/otlp/hono.d.cts +13 -3
- package/dist/otlp/hono.d.cts.map +1 -1
- package/dist/otlp/hono.d.mts +13 -3
- package/dist/otlp/hono.d.mts.map +1 -1
- package/dist/otlp/hono.mjs +11 -5
- package/dist/otlp/hono.mjs.map +1 -1
- package/dist/otlp/index.cjs +11 -11
- package/dist/otlp/index.d.cts +7 -4
- package/dist/otlp/index.d.mts +7 -4
- package/dist/otlp/index.mjs +5 -4
- package/dist/otlp/receiver.cjs +4 -88
- package/dist/otlp/receiver.d.cts +7 -59
- package/dist/otlp/receiver.d.mts +7 -59
- package/dist/otlp/receiver.mjs +4 -87
- package/dist/otlp/transformer.cjs +5 -214
- package/dist/otlp/transformer.d.cts +3 -1
- package/dist/otlp/transformer.d.mts +3 -1
- package/dist/otlp/transformer.mjs +3 -211
- package/dist/otlp/types.cjs +5 -57
- package/dist/otlp/types.d.cts +1 -1
- package/dist/otlp/types.d.mts +1 -1
- package/dist/otlp/types.mjs +2 -53
- package/dist/receiver-Cj1lbAOO.cjs +94 -0
- package/dist/receiver-Cj1lbAOO.cjs.map +1 -0
- package/dist/receiver-CxVd_9CB.mjs +89 -0
- package/dist/receiver-CxVd_9CB.mjs.map +1 -0
- package/dist/receiver-DLICx5uU.d.cts +63 -0
- package/dist/receiver-DLICx5uU.d.cts.map +1 -0
- package/dist/receiver-UeZT-H8u.d.mts +63 -0
- package/dist/receiver-UeZT-H8u.d.mts.map +1 -0
- package/dist/redact-BzkITCNW.mjs +83 -0
- package/dist/redact-BzkITCNW.mjs.map +1 -0
- package/dist/redact-DVaSSPZT.cjs +95 -0
- package/dist/redact-DVaSSPZT.cjs.map +1 -0
- package/dist/redact.cjs +3 -84
- package/dist/redact.d.cts +8 -4
- package/dist/redact.d.cts.map +1 -1
- package/dist/redact.d.mts +8 -4
- package/dist/redact.d.mts.map +1 -1
- package/dist/redact.mjs +2 -80
- package/dist/server/hono.cjs +54 -33
- package/dist/server/hono.cjs.map +1 -1
- package/dist/server/hono.d.cts +14 -19
- package/dist/server/hono.d.cts.map +1 -1
- package/dist/server/hono.d.mts +14 -19
- package/dist/server/hono.d.mts.map +1 -1
- package/dist/server/hono.mjs +52 -31
- package/dist/server/hono.mjs.map +1 -1
- package/dist/setup-B9jM77Qk.mjs +98 -0
- package/dist/setup-B9jM77Qk.mjs.map +1 -0
- package/dist/setup-Bkxm4g6b.d.mts +87 -0
- package/dist/setup-Bkxm4g6b.d.mts.map +1 -0
- package/dist/setup-CYpff5B9.cjs +110 -0
- package/dist/setup-CYpff5B9.cjs.map +1 -0
- package/dist/setup-D58N1f9O.d.cts +87 -0
- package/dist/setup-D58N1f9O.d.cts.map +1 -0
- package/dist/storage/kysely.cjs +70 -82
- package/dist/storage/kysely.cjs.map +1 -1
- package/dist/storage/kysely.d.cts +20 -36
- package/dist/storage/kysely.d.cts.map +1 -1
- package/dist/storage/kysely.d.mts +20 -36
- package/dist/storage/kysely.d.mts.map +1 -1
- package/dist/storage/kysely.mjs +69 -81
- package/dist/storage/kysely.mjs.map +1 -1
- package/dist/storage/memory.cjs +2 -122
- package/dist/storage/memory.d.cts +3 -36
- package/dist/storage/memory.d.mts +3 -36
- package/dist/storage/memory.mjs +2 -121
- package/dist/tracing-BX8uY2nR.d.cts +53 -0
- package/dist/tracing-BX8uY2nR.d.cts.map +1 -0
- package/dist/tracing-Bt1zWRlb.cjs +167 -0
- package/dist/tracing-Bt1zWRlb.cjs.map +1 -0
- package/dist/tracing-Cijm_5NI.mjs +113 -0
- package/dist/tracing-Cijm_5NI.mjs.map +1 -0
- package/dist/tracing-PnECEbEu.d.mts +53 -0
- package/dist/tracing-PnECEbEu.d.mts.map +1 -0
- package/dist/transformer-BXQPhzql.mjs +215 -0
- package/dist/transformer-BXQPhzql.mjs.map +1 -0
- package/dist/transformer-CLGZ0EQc.cjs +232 -0
- package/dist/transformer-CLGZ0EQc.cjs.map +1 -0
- package/dist/{transformer-BtqjAs0b.d.cts → transformer-CTGsaVfV.d.mts} +8 -4
- package/dist/transformer-CTGsaVfV.d.mts.map +1 -0
- package/dist/{transformer-DI6t8-YA.d.mts → transformer-ICEbxpFf.d.cts} +8 -4
- package/dist/transformer-ICEbxpFf.d.cts.map +1 -0
- package/dist/{types-BVujq4zd.d.mts → types-B1EIa_cQ.d.mts} +4 -3
- package/dist/types-B1EIa_cQ.d.mts.map +1 -0
- package/dist/types-BRzW1NM8.d.cts +166 -0
- package/dist/types-BRzW1NM8.d.cts.map +1 -0
- package/dist/types-BS3Rx8Sk.d.cts +209 -0
- package/dist/types-BS3Rx8Sk.d.cts.map +1 -0
- package/dist/types-Bwm_jNU7.mjs +54 -0
- package/dist/types-Bwm_jNU7.mjs.map +1 -0
- package/dist/types-BzQ78Efw.d.mts +166 -0
- package/dist/types-BzQ78Efw.d.mts.map +1 -0
- package/dist/types-CbNGXnJE.d.mts +209 -0
- package/dist/types-CbNGXnJE.d.mts.map +1 -0
- package/dist/{types-DVETVdpa.d.cts → types-CmOB7CLO.d.cts} +7 -6
- package/dist/types-CmOB7CLO.d.cts.map +1 -0
- package/dist/{types-DVETVdpa.d.mts → types-DBc0q5KD.d.mts} +7 -6
- package/dist/types-DBc0q5KD.d.mts.map +1 -0
- package/dist/types-Dsh-DIO_.cjs +78 -0
- package/dist/types-Dsh-DIO_.cjs.map +1 -0
- package/dist/types-ZW-nfWf6.cjs +40 -0
- package/dist/types-ZW-nfWf6.cjs.map +1 -0
- package/dist/{types-BVujq4zd.d.cts → types-l7Rlb5Mg.d.cts} +4 -3
- package/dist/types-l7Rlb5Mg.d.cts.map +1 -0
- package/dist/types-ojhnLdwz.mjs +34 -0
- package/dist/types-ojhnLdwz.mjs.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +0 -1
- package/dist/ui-assets-BEXqOQLe.cjs +48 -0
- package/dist/ui-assets-BEXqOQLe.cjs.map +1 -0
- package/dist/ui-assets-BhTDUsrM.mjs +30 -0
- package/dist/ui-assets-BhTDUsrM.mjs.map +1 -0
- package/dist/ui-assets.cjs +5 -0
- package/dist/ui-assets.d.cts +13 -0
- package/dist/ui-assets.d.cts.map +1 -0
- package/dist/ui-assets.d.mts +13 -0
- package/dist/ui-assets.d.mts.map +1 -0
- package/dist/ui-assets.mjs +3 -0
- package/package.json +46 -46
- package/src/Telescope.ts +561 -0
- package/src/__tests__/Telescope.spec.ts +438 -0
- package/src/__tests__/pino-transport.spec.ts +115 -0
- package/src/__tests__/redact.spec.ts +336 -0
- package/src/adapters/__tests__/lambda.spec.ts +318 -0
- package/src/adapters/__tests__/middy.spec.ts +741 -0
- package/src/adapters/index.ts +22 -0
- package/src/adapters/lambda.ts +432 -0
- package/src/adapters/middy.ts +402 -0
- package/src/adapters/types.ts +181 -0
- package/src/core.ts +51 -0
- package/src/index.ts +34 -0
- package/src/instrumentation/__tests__/core.spec.ts +248 -0
- package/src/instrumentation/__tests__/hono.spec.ts +348 -0
- package/src/instrumentation/__tests__/middleware.spec.ts +528 -0
- package/src/instrumentation/__tests__/otel.spec.ts +291 -0
- package/src/instrumentation/__tests__/tracing.spec.ts +208 -0
- package/src/instrumentation/core.ts +228 -0
- package/src/instrumentation/hono.ts +270 -0
- package/src/instrumentation/http.ts +306 -0
- package/src/instrumentation/index.ts +90 -0
- package/src/instrumentation/middleware.ts +297 -0
- package/src/instrumentation/otel.ts +271 -0
- package/src/instrumentation/setup.ts +246 -0
- package/src/instrumentation/tracing.ts +145 -0
- package/src/logger/__tests__/console.spec.ts +366 -0
- package/src/logger/__tests__/pino.spec.ts +217 -0
- package/src/logger/console.ts +230 -0
- package/src/logger/pino.ts +201 -0
- package/src/metrics/MetricsAggregator.ts +555 -0
- package/src/metrics/__tests__/MetricsAggregator.spec.ts +298 -0
- package/src/metrics/index.ts +2 -0
- package/src/metrics/storage/InMemoryMetricsStorage.ts +380 -0
- package/src/metrics/storage/MetricsStorage.ts +74 -0
- package/src/metrics/storage/index.ts +3 -0
- package/src/metrics/storage/types.ts +243 -0
- package/src/otlp/__tests__/receiver.spec.ts +367 -0
- package/src/otlp/__tests__/transformer.spec.ts +455 -0
- package/src/otlp/hono.ts +120 -0
- package/src/otlp/index.ts +22 -0
- package/src/otlp/receiver.ts +162 -0
- package/src/otlp/transformer.ts +367 -0
- package/src/otlp/types.ts +364 -0
- package/src/redact.ts +116 -0
- package/src/server/__tests__/hono.spec.ts +814 -0
- package/src/server/hono.ts +442 -0
- package/src/storage/__tests__/kysely.spec.ts +715 -0
- package/src/storage/__tests__/memory.spec.ts +694 -0
- package/src/storage/kysely.ts +599 -0
- package/src/storage/memory.ts +204 -0
- package/src/types.ts +447 -0
- package/src/ui-assets.ts +40 -0
- package/tsconfig.json +9 -0
- package/ui/CHANGELOG.md +7 -0
- package/ui/index.html +12 -0
- package/ui/node_modules/.bin/tsc +21 -0
- package/ui/node_modules/.bin/tsserver +21 -0
- package/ui/node_modules/.bin/vite +21 -0
- package/ui/package.json +24 -0
- package/ui/src/App.tsx +595 -0
- package/ui/src/api.ts +88 -0
- package/ui/src/components/ExceptionDetail.tsx +100 -0
- package/ui/src/components/FilterBar.tsx +162 -0
- package/ui/src/components/LogDetail.tsx +91 -0
- package/ui/src/components/RequestDetail.tsx +143 -0
- package/ui/src/main.tsx +10 -0
- package/ui/src/styles.css +11 -0
- package/ui/src/types.ts +63 -0
- package/ui/src/vite-env.d.ts +1 -0
- package/ui/src/vite-plugin-gkm-config.ts +54 -0
- package/ui/tsconfig.json +20 -0
- package/ui/tsconfig.tsbuildinfo +1 -0
- package/ui/vite.config.ts +13 -0
- package/dist/MetricsAggregator-BJdIvfEv.d.mts.map +0 -1
- package/dist/MetricsAggregator-CnC3oT5q.d.cts.map +0 -1
- package/dist/Telescope-BVfDvVvY.d.mts.map +0 -1
- package/dist/Telescope-DeqSHfuB.d.cts.map +0 -1
- package/dist/Telescope.cjs.map +0 -1
- package/dist/Telescope.mjs.map +0 -1
- package/dist/adapters/middy.cjs.map +0 -1
- package/dist/adapters/middy.d.cts.map +0 -1
- package/dist/adapters/middy.d.mts.map +0 -1
- package/dist/adapters/middy.mjs.map +0 -1
- package/dist/adapters/types.d.cts.map +0 -1
- package/dist/adapters/types.d.mts.map +0 -1
- package/dist/instrumentation/core.cjs.map +0 -1
- package/dist/instrumentation/core.d.cts.map +0 -1
- package/dist/instrumentation/core.d.mts.map +0 -1
- package/dist/instrumentation/core.mjs.map +0 -1
- package/dist/instrumentation/hono.cjs.map +0 -1
- package/dist/instrumentation/hono.d.cts.map +0 -1
- package/dist/instrumentation/hono.d.mts.map +0 -1
- package/dist/instrumentation/hono.mjs.map +0 -1
- package/dist/instrumentation/http.cjs.map +0 -1
- package/dist/instrumentation/http.d.cts.map +0 -1
- package/dist/instrumentation/http.d.mts.map +0 -1
- package/dist/instrumentation/http.mjs.map +0 -1
- package/dist/instrumentation/middleware.cjs.map +0 -1
- package/dist/instrumentation/middleware.d.cts.map +0 -1
- package/dist/instrumentation/middleware.d.mts.map +0 -1
- package/dist/instrumentation/middleware.mjs.map +0 -1
- package/dist/instrumentation/otel.cjs.map +0 -1
- package/dist/instrumentation/otel.d.cts.map +0 -1
- package/dist/instrumentation/otel.d.mts.map +0 -1
- package/dist/instrumentation/otel.mjs.map +0 -1
- package/dist/instrumentation/sampler.cjs +0 -54
- package/dist/instrumentation/sampler.cjs.map +0 -1
- package/dist/instrumentation/sampler.d.cts +0 -38
- package/dist/instrumentation/sampler.d.cts.map +0 -1
- package/dist/instrumentation/sampler.d.mts +0 -38
- package/dist/instrumentation/sampler.d.mts.map +0 -1
- package/dist/instrumentation/sampler.mjs +0 -52
- package/dist/instrumentation/sampler.mjs.map +0 -1
- package/dist/instrumentation/setup.cjs.map +0 -1
- package/dist/instrumentation/setup.d.cts.map +0 -1
- package/dist/instrumentation/setup.d.mts.map +0 -1
- package/dist/instrumentation/setup.mjs.map +0 -1
- package/dist/instrumentation/tracing.cjs.map +0 -1
- package/dist/instrumentation/tracing.d.cts.map +0 -1
- package/dist/instrumentation/tracing.d.mts.map +0 -1
- package/dist/instrumentation/tracing.mjs.map +0 -1
- package/dist/instrumentation/trust.cjs +0 -107
- package/dist/instrumentation/trust.cjs.map +0 -1
- package/dist/instrumentation/trust.d.cts +0 -57
- package/dist/instrumentation/trust.d.cts.map +0 -1
- package/dist/instrumentation/trust.d.mts +0 -57
- package/dist/instrumentation/trust.d.mts.map +0 -1
- package/dist/instrumentation/trust.mjs +0 -104
- package/dist/instrumentation/trust.mjs.map +0 -1
- package/dist/metrics/MetricsAggregator.cjs.map +0 -1
- package/dist/metrics/MetricsAggregator.mjs.map +0 -1
- package/dist/metrics/storage/InMemoryMetricsStorage.cjs.map +0 -1
- package/dist/metrics/storage/InMemoryMetricsStorage.d.cts.map +0 -1
- package/dist/metrics/storage/InMemoryMetricsStorage.d.mts.map +0 -1
- package/dist/metrics/storage/InMemoryMetricsStorage.mjs.map +0 -1
- package/dist/metrics/storage/MetricsStorage.d.cts.map +0 -1
- package/dist/metrics/storage/MetricsStorage.d.mts.map +0 -1
- package/dist/metrics/storage/types.cjs.map +0 -1
- package/dist/metrics/storage/types.d.cts.map +0 -1
- package/dist/metrics/storage/types.d.mts.map +0 -1
- package/dist/metrics/storage/types.mjs.map +0 -1
- package/dist/otlp/receiver.cjs.map +0 -1
- package/dist/otlp/receiver.d.cts.map +0 -1
- package/dist/otlp/receiver.d.mts.map +0 -1
- package/dist/otlp/receiver.mjs.map +0 -1
- package/dist/otlp/transformer.cjs.map +0 -1
- package/dist/otlp/transformer.mjs.map +0 -1
- package/dist/otlp/types.cjs.map +0 -1
- package/dist/otlp/types.mjs.map +0 -1
- package/dist/redact.cjs.map +0 -1
- package/dist/redact.mjs.map +0 -1
- package/dist/storage/memory.cjs.map +0 -1
- package/dist/storage/memory.d.cts.map +0 -1
- package/dist/storage/memory.d.mts.map +0 -1
- package/dist/storage/memory.mjs.map +0 -1
- package/dist/transformer-BtqjAs0b.d.cts.map +0 -1
- package/dist/transformer-DI6t8-YA.d.mts.map +0 -1
- package/dist/types-BVujq4zd.d.cts.map +0 -1
- package/dist/types-BVujq4zd.d.mts.map +0 -1
- package/dist/types-DVETVdpa.d.cts.map +0 -1
- package/dist/types-DVETVdpa.d.mts.map +0 -1
|
@@ -1,139 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Options for configuring telemetry
|
|
5
|
-
*/
|
|
6
|
-
export interface TelemetryOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Service name for resource identification
|
|
9
|
-
*/
|
|
10
|
-
serviceName: string;
|
|
11
|
-
/**
|
|
12
|
-
* Service version
|
|
13
|
-
*/
|
|
14
|
-
serviceVersion?: string;
|
|
15
|
-
/**
|
|
16
|
-
* The `service.namespace` resource attribute — the product an app is part
|
|
17
|
-
* of, so several services from one workspace group together.
|
|
18
|
-
*/
|
|
19
|
-
serviceNamespace?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The stage this process runs as (`production`, `staging`, …). Sent as
|
|
22
|
-
* `deployment.environment.name`, and as the older `deployment.environment`
|
|
23
|
-
* many backends still filter on.
|
|
24
|
-
*/
|
|
25
|
-
deploymentEnvironment?: string;
|
|
26
|
-
/**
|
|
27
|
-
* OTLP endpoint URL (e.g., 'http://localhost:3000/__telescope/v1').
|
|
28
|
-
* Traces go to `<endpoint>/traces` and logs to `<endpoint>/logs`.
|
|
29
|
-
*
|
|
30
|
-
* If not provided, the standard `OTEL_EXPORTER_OTLP_ENDPOINT` (and its
|
|
31
|
-
* per-signal `_TRACES_`/`_LOGS_` variants and `OTEL_EXPORTER_OTLP_HEADERS`)
|
|
32
|
-
* configure the exporters, with the spec's `/v1/traces` and `/v1/logs`
|
|
33
|
-
* paths. With neither, traces are written to the console.
|
|
34
|
-
*/
|
|
35
|
-
endpoint?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The fraction of new traces to sample, from 0 to 1. A span whose parent
|
|
38
|
-
* in this process was sampled (or not) follows its parent, so a trace is
|
|
39
|
-
* never cut in half; a caller's sampled flag is capped at this rate, so a
|
|
40
|
-
* request cannot force a trace the stage would not keep (`traceSampler`).
|
|
41
|
-
*
|
|
42
|
-
* When left out, the standard `OTEL_TRACES_SAMPLER` and
|
|
43
|
-
* `OTEL_TRACES_SAMPLER_ARG` decide — `parentbased_traceidratio` with `0.1`
|
|
44
|
-
* is the same capped sampler at 0.1; with neither, every trace is sampled.
|
|
45
|
-
*/
|
|
46
|
-
sampleRatio?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Shut the SDK down and exit on `SIGTERM`.
|
|
49
|
-
*
|
|
50
|
-
* Turn it off when the process has its own graceful shutdown — exiting as
|
|
51
|
-
* soon as telemetry is flushed would cut in-flight requests short.
|
|
52
|
-
* @default true
|
|
53
|
-
*/
|
|
54
|
-
handleSignals?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Whether to instrument Pino for log correlation.
|
|
57
|
-
*
|
|
58
|
-
* It hooks module loading, so it sees nothing inside a bundle. A logger
|
|
59
|
-
* from `@geekmidas/logger`'s `createLogger` sends its records through the
|
|
60
|
-
* logs API itself; turn this off for one, or each record is sent twice
|
|
61
|
-
* where pino can be hooked.
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
instrumentPino?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Whether the http auto-instrumentation opens a span for each incoming
|
|
67
|
-
* request.
|
|
68
|
-
*
|
|
69
|
-
* Turn it off when the server opens its own — `honoTelemetryMiddleware`,
|
|
70
|
-
* as a `gkm build` server does — or each request is traced twice where
|
|
71
|
-
* `node:http` can be hooked, and not at all in a bundle, where it cannot.
|
|
72
|
-
* Outgoing requests are traced either way.
|
|
73
|
-
* @default true
|
|
74
|
-
*/
|
|
75
|
-
incomingHttpSpans?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Whether to enable auto-instrumentation for common libraries
|
|
78
|
-
* (http, fetch, express, etc.)
|
|
79
|
-
* @default true
|
|
80
|
-
*/
|
|
81
|
-
autoInstrument?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Enable debug logging for OTel SDK
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
debug?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Additional resource attributes
|
|
89
|
-
*/
|
|
90
|
-
resourceAttributes?: Record<string, string>;
|
|
91
|
-
/**
|
|
92
|
-
* Headers to send with OTLP requests
|
|
93
|
-
*/
|
|
94
|
-
headers?: Record<string, string>;
|
|
95
|
-
/**
|
|
96
|
-
* Span processor strategy.
|
|
97
|
-
* - 'batch': Efficient batching for long-running servers (default)
|
|
98
|
-
* - 'simple': Immediate export for serverless environments (Lambda, Edge)
|
|
99
|
-
*
|
|
100
|
-
* If not specified, automatically selected based on environment detection.
|
|
101
|
-
*/
|
|
102
|
-
spanProcessorStrategy?: SpanProcessorStrategy;
|
|
103
|
-
/**
|
|
104
|
-
* Environment type for automatic configuration
|
|
105
|
-
* @default 'server'
|
|
106
|
-
*/
|
|
107
|
-
environment?: 'server' | 'lambda' | 'edge' | 'custom';
|
|
108
|
-
}
|
|
109
|
-
/** A `sampleRatio` outside 0–1, which no sampler can honour. */
|
|
110
|
-
export declare class InvalidSampleRatio extends Error {
|
|
111
|
-
readonly sampleRatio: number;
|
|
112
|
-
constructor(sampleRatio: number);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Set up OpenTelemetry instrumentation.
|
|
116
|
-
* Call this BEFORE importing your application code.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* // instrumentation.ts (create this file)
|
|
121
|
-
* import { setupTelemetry } from '@geekmidas/telescope/instrumentation';
|
|
122
|
-
*
|
|
123
|
-
* setupTelemetry({
|
|
124
|
-
* serviceName: 'my-api',
|
|
125
|
-
* endpoint: 'http://localhost:3000/__telescope/v1',
|
|
126
|
-
* });
|
|
127
|
-
*
|
|
128
|
-
* // Then in your entry point:
|
|
129
|
-
* // import './instrumentation';
|
|
130
|
-
* // import { app } from './app';
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export declare function setupTelemetry(options: TelemetryOptions): void;
|
|
134
|
-
/**
|
|
135
|
-
* Shut down telemetry (for testing or graceful shutdown)
|
|
136
|
-
*/
|
|
137
|
-
export declare function shutdownTelemetry(): Promise<void>;
|
|
138
|
-
//#endregion
|
|
139
|
-
//# sourceMappingURL=setup.d.mts.map
|
|
1
|
+
import "../types-BzQ78Efw.mjs";
|
|
2
|
+
import { TelemetryOptions, setupTelemetry, shutdownTelemetry } from "../setup-Bkxm4g6b.mjs";
|
|
3
|
+
export { TelemetryOptions, setupTelemetry, shutdownTelemetry };
|
|
@@ -1,140 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { DiagConsoleLogger, DiagLogLevel, diag } from "@opentelemetry/api";
|
|
4
|
-
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
|
|
5
|
-
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
6
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
7
|
-
import { PinoInstrumentation } from "@opentelemetry/instrumentation-pino";
|
|
8
|
-
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
9
|
-
import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
10
|
-
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
11
|
-
import { ConsoleSpanExporter } from "@opentelemetry/sdk-trace-node";
|
|
12
|
-
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
|
|
13
|
-
//#region src/instrumentation/setup.ts
|
|
14
|
-
let sdk = null;
|
|
15
|
-
let onSigterm = null;
|
|
16
|
-
/** A `sampleRatio` outside 0–1, which no sampler can honour. */
|
|
17
|
-
var InvalidSampleRatio = class extends Error {
|
|
18
|
-
sampleRatio;
|
|
19
|
-
constructor(sampleRatio) {
|
|
20
|
-
super(`sampleRatio must be a number from 0 (no traces) to 1 (every trace), got ${sampleRatio}. Pass a fraction such as 0.1 to keep one trace in ten.`);
|
|
21
|
-
this.sampleRatio = sampleRatio;
|
|
22
|
-
this.name = "InvalidSampleRatio";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/** Whether the standard OTLP environment variables name a collector. */
|
|
26
|
-
function otlpEndpointFromEnv(signal) {
|
|
27
|
-
return Boolean(process.env[`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`] || process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The sampler for an explicit ratio, or for the stage's rate in
|
|
31
|
-
* `OTEL_TRACES_SAMPLER_ARG` — or undefined to let the SDK read any other
|
|
32
|
-
* `OTEL_TRACES_SAMPLER` itself.
|
|
33
|
-
*/
|
|
34
|
-
function samplerFor(sampleRatio) {
|
|
35
|
-
if (sampleRatio === void 0) return traceSamplerFromEnv();
|
|
36
|
-
if (!Number.isFinite(sampleRatio) || sampleRatio < 0 || sampleRatio > 1) throw new InvalidSampleRatio(sampleRatio);
|
|
37
|
-
return traceSampler(sampleRatio);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Set up OpenTelemetry instrumentation.
|
|
41
|
-
* Call this BEFORE importing your application code.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* // instrumentation.ts (create this file)
|
|
46
|
-
* import { setupTelemetry } from '@geekmidas/telescope/instrumentation';
|
|
47
|
-
*
|
|
48
|
-
* setupTelemetry({
|
|
49
|
-
* serviceName: 'my-api',
|
|
50
|
-
* endpoint: 'http://localhost:3000/__telescope/v1',
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* // Then in your entry point:
|
|
54
|
-
* // import './instrumentation';
|
|
55
|
-
* // import { app } from './app';
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
function setupTelemetry(options) {
|
|
59
|
-
if (sdk) return;
|
|
60
|
-
const { serviceName, serviceVersion = "1.0.0", serviceNamespace, deploymentEnvironment, endpoint, sampleRatio, handleSignals = true, instrumentPino = true, incomingHttpSpans = true, autoInstrument = true, debug = false, resourceAttributes = {}, headers, spanProcessorStrategy, environment = "server" } = options;
|
|
61
|
-
const sampler = samplerFor(sampleRatio);
|
|
62
|
-
if (debug) diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
|
63
|
-
const resource = resourceFromAttributes({
|
|
64
|
-
[ATTR_SERVICE_NAME]: serviceName,
|
|
65
|
-
[ATTR_SERVICE_VERSION]: serviceVersion,
|
|
66
|
-
...serviceNamespace && { "service.namespace": serviceNamespace },
|
|
67
|
-
...deploymentEnvironment && {
|
|
68
|
-
"deployment.environment.name": deploymentEnvironment,
|
|
69
|
-
"deployment.environment": deploymentEnvironment
|
|
70
|
-
},
|
|
71
|
-
...resourceAttributes
|
|
72
|
-
});
|
|
73
|
-
const instrumentations = [];
|
|
74
|
-
if (instrumentPino) instrumentations.push(new PinoInstrumentation({ logHook: (span, record) => {
|
|
75
|
-
record.trace_id = span.spanContext().traceId;
|
|
76
|
-
record.span_id = span.spanContext().spanId;
|
|
77
|
-
record.trace_flags = span.spanContext().traceFlags;
|
|
78
|
-
} }));
|
|
79
|
-
if (autoInstrument) instrumentations.push(getNodeAutoInstrumentations({
|
|
80
|
-
"@opentelemetry/instrumentation-fs": { enabled: false },
|
|
81
|
-
"@opentelemetry/instrumentation-http": {
|
|
82
|
-
disableIncomingRequestInstrumentation: !incomingHttpSpans,
|
|
83
|
-
ignoreIncomingRequestHook: (request) => {
|
|
84
|
-
const path = request.url || "";
|
|
85
|
-
return path.includes("/__health") || path.includes("/__telescope") || path.includes("/favicon");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
let traceExporter;
|
|
90
|
-
if (endpoint) traceExporter = new OTLPTraceExporter({
|
|
91
|
-
url: `${endpoint}/traces`,
|
|
92
|
-
headers: headers ?? {}
|
|
93
|
-
});
|
|
94
|
-
else if (otlpEndpointFromEnv("TRACES")) traceExporter = new OTLPTraceExporter(headers ? { headers } : {});
|
|
95
|
-
else traceExporter = new ConsoleSpanExporter();
|
|
96
|
-
const strategy = spanProcessorStrategy ?? getRecommendedStrategy(environment);
|
|
97
|
-
const spanProcessor = createSpanProcessor(traceExporter, { strategy });
|
|
98
|
-
setGlobalSpanProcessor(spanProcessor);
|
|
99
|
-
let logProcessor;
|
|
100
|
-
if (endpoint || otlpEndpointFromEnv("LOGS")) {
|
|
101
|
-
const logExporter = endpoint ? new OTLPLogExporter({
|
|
102
|
-
url: `${endpoint}/logs`,
|
|
103
|
-
headers: headers ?? {}
|
|
104
|
-
}) : new OTLPLogExporter(headers ? { headers } : {});
|
|
105
|
-
logProcessor = new BatchLogRecordProcessor({ exporter: logExporter });
|
|
106
|
-
setGlobalLogProcessor(logProcessor);
|
|
107
|
-
}
|
|
108
|
-
sdk = new NodeSDK({
|
|
109
|
-
resource,
|
|
110
|
-
traceExporter,
|
|
111
|
-
spanProcessors: [spanProcessor],
|
|
112
|
-
...logProcessor && { logRecordProcessors: [logProcessor] },
|
|
113
|
-
...sampler && { sampler },
|
|
114
|
-
instrumentations
|
|
115
|
-
});
|
|
116
|
-
sdk.start();
|
|
117
|
-
if (handleSignals) {
|
|
118
|
-
onSigterm = () => {
|
|
119
|
-
sdk?.shutdown().then(() => {}).catch((_error) => {}).finally(() => process.exit(0));
|
|
120
|
-
};
|
|
121
|
-
process.on("SIGTERM", onSigterm);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Shut down telemetry (for testing or graceful shutdown)
|
|
126
|
-
*/
|
|
127
|
-
async function shutdownTelemetry() {
|
|
128
|
-
if (onSigterm) {
|
|
129
|
-
process.off("SIGTERM", onSigterm);
|
|
130
|
-
onSigterm = null;
|
|
131
|
-
}
|
|
132
|
-
if (sdk) {
|
|
133
|
-
await sdk.shutdown();
|
|
134
|
-
sdk = null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
|
-
export { InvalidSampleRatio, setupTelemetry, shutdownTelemetry };
|
|
1
|
+
import "../core-D6hJ6exL.mjs";
|
|
2
|
+
import { setupTelemetry, shutdownTelemetry } from "../setup-B9jM77Qk.mjs";
|
|
139
3
|
|
|
140
|
-
|
|
4
|
+
export { setupTelemetry, shutdownTelemetry };
|
|
@@ -1,115 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
let _opentelemetry_api = require("@opentelemetry/api");
|
|
3
|
-
//#region src/instrumentation/tracing.ts
|
|
4
|
-
/**
|
|
5
|
-
* Get the currently active span
|
|
6
|
-
*/
|
|
7
|
-
function getActiveSpan() {
|
|
8
|
-
return _opentelemetry_api.trace.getActiveSpan();
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Set attributes on the active span
|
|
12
|
-
*/
|
|
13
|
-
function setSpanAttributes(attributes) {
|
|
14
|
-
const span = getActiveSpan();
|
|
15
|
-
if (span) span.setAttributes(attributes);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Create a new span as a child of the current span
|
|
19
|
-
*/
|
|
20
|
-
function createSpan(name, attributes) {
|
|
21
|
-
return _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Execute a function within a new span context
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const result = await withSpan('processOrder', async (span) => {
|
|
29
|
-
* span.setAttribute('order.id', orderId);
|
|
30
|
-
* const order = await processOrder(orderId);
|
|
31
|
-
* return order;
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
async function withSpan(name, fn, attributes) {
|
|
36
|
-
const span = _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
37
|
-
try {
|
|
38
|
-
const result = await _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), () => fn(span));
|
|
39
|
-
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
|
|
40
|
-
return result;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
span.setStatus({
|
|
43
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
44
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
45
|
-
});
|
|
46
|
-
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
47
|
-
throw error;
|
|
48
|
-
} finally {
|
|
49
|
-
span.end();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Synchronous version of withSpan
|
|
54
|
-
*/
|
|
55
|
-
function withSpanSync(name, fn, attributes) {
|
|
56
|
-
const span = _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
57
|
-
try {
|
|
58
|
-
const result = _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), () => fn(span));
|
|
59
|
-
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
|
|
60
|
-
return result;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
span.setStatus({
|
|
63
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
64
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
65
|
-
});
|
|
66
|
-
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
67
|
-
throw error;
|
|
68
|
-
} finally {
|
|
69
|
-
span.end();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the current trace ID (useful for log correlation)
|
|
74
|
-
*/
|
|
75
|
-
function getTraceId() {
|
|
76
|
-
return getActiveSpan()?.spanContext().traceId;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the current span ID
|
|
80
|
-
*/
|
|
81
|
-
function getSpanId() {
|
|
82
|
-
return getActiveSpan()?.spanContext().spanId;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Record an exception on the current span
|
|
86
|
-
*/
|
|
87
|
-
function recordException(error) {
|
|
88
|
-
const span = getActiveSpan();
|
|
89
|
-
if (span) {
|
|
90
|
-
span.recordException(error);
|
|
91
|
-
span.setStatus({
|
|
92
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
93
|
-
message: error.message
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Add an event to the current span
|
|
99
|
-
*/
|
|
100
|
-
function addSpanEvent(name, attributes) {
|
|
101
|
-
const span = getActiveSpan();
|
|
102
|
-
if (span) span.addEvent(name, attributes);
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
exports.addSpanEvent = addSpanEvent;
|
|
106
|
-
exports.createSpan = createSpan;
|
|
107
|
-
exports.getActiveSpan = getActiveSpan;
|
|
108
|
-
exports.getSpanId = getSpanId;
|
|
109
|
-
exports.getTraceId = getTraceId;
|
|
110
|
-
exports.recordException = recordException;
|
|
111
|
-
exports.setSpanAttributes = setSpanAttributes;
|
|
112
|
-
exports.withSpan = withSpan;
|
|
113
|
-
exports.withSpanSync = withSpanSync;
|
|
1
|
+
const require_tracing = require('../tracing-Bt1zWRlb.cjs');
|
|
114
2
|
|
|
115
|
-
|
|
3
|
+
exports.addSpanEvent = require_tracing.addSpanEvent;
|
|
4
|
+
exports.createSpan = require_tracing.createSpan;
|
|
5
|
+
exports.getActiveSpan = require_tracing.getActiveSpan;
|
|
6
|
+
exports.getSpanId = require_tracing.getSpanId;
|
|
7
|
+
exports.getTraceId = require_tracing.getTraceId;
|
|
8
|
+
exports.recordException = require_tracing.recordException;
|
|
9
|
+
exports.setSpanAttributes = require_tracing.setSpanAttributes;
|
|
10
|
+
exports.withSpan = require_tracing.withSpan;
|
|
11
|
+
exports.withSpanSync = require_tracing.withSpanSync;
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the currently active span
|
|
5
|
-
*/
|
|
6
|
-
export declare function getActiveSpan(): Span | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Set attributes on the active span
|
|
9
|
-
*/
|
|
10
|
-
export declare function setSpanAttributes(attributes: Attributes): void;
|
|
11
|
-
/**
|
|
12
|
-
* Create a new span as a child of the current span
|
|
13
|
-
*/
|
|
14
|
-
export declare function createSpan(name: string, attributes?: Attributes): Span;
|
|
15
|
-
/**
|
|
16
|
-
* Execute a function within a new span context
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const result = await withSpan('processOrder', async (span) => {
|
|
21
|
-
* span.setAttribute('order.id', orderId);
|
|
22
|
-
* const order = await processOrder(orderId);
|
|
23
|
-
* return order;
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Attributes): Promise<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Synchronous version of withSpan
|
|
30
|
-
*/
|
|
31
|
-
export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Attributes): T;
|
|
32
|
-
/**
|
|
33
|
-
* Get the current trace ID (useful for log correlation)
|
|
34
|
-
*/
|
|
35
|
-
export declare function getTraceId(): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Get the current span ID
|
|
38
|
-
*/
|
|
39
|
-
export declare function getSpanId(): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Record an exception on the current span
|
|
42
|
-
*/
|
|
43
|
-
export declare function recordException(error: Error): void;
|
|
44
|
-
/**
|
|
45
|
-
* Add an event to the current span
|
|
46
|
-
*/
|
|
47
|
-
export declare function addSpanEvent(name: string, attributes?: Attributes): void;
|
|
48
|
-
//#endregion
|
|
49
|
-
//# sourceMappingURL=tracing.d.cts.map
|
|
1
|
+
import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-BX8uY2nR.cjs";
|
|
2
|
+
export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the currently active span
|
|
5
|
-
*/
|
|
6
|
-
export declare function getActiveSpan(): Span | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Set attributes on the active span
|
|
9
|
-
*/
|
|
10
|
-
export declare function setSpanAttributes(attributes: Attributes): void;
|
|
11
|
-
/**
|
|
12
|
-
* Create a new span as a child of the current span
|
|
13
|
-
*/
|
|
14
|
-
export declare function createSpan(name: string, attributes?: Attributes): Span;
|
|
15
|
-
/**
|
|
16
|
-
* Execute a function within a new span context
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const result = await withSpan('processOrder', async (span) => {
|
|
21
|
-
* span.setAttribute('order.id', orderId);
|
|
22
|
-
* const order = await processOrder(orderId);
|
|
23
|
-
* return order;
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Attributes): Promise<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Synchronous version of withSpan
|
|
30
|
-
*/
|
|
31
|
-
export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Attributes): T;
|
|
32
|
-
/**
|
|
33
|
-
* Get the current trace ID (useful for log correlation)
|
|
34
|
-
*/
|
|
35
|
-
export declare function getTraceId(): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Get the current span ID
|
|
38
|
-
*/
|
|
39
|
-
export declare function getSpanId(): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Record an exception on the current span
|
|
42
|
-
*/
|
|
43
|
-
export declare function recordException(error: Error): void;
|
|
44
|
-
/**
|
|
45
|
-
* Add an event to the current span
|
|
46
|
-
*/
|
|
47
|
-
export declare function addSpanEvent(name: string, attributes?: Attributes): void;
|
|
48
|
-
//#endregion
|
|
49
|
-
//# sourceMappingURL=tracing.d.mts.map
|
|
1
|
+
import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-PnECEbEu.mjs";
|
|
2
|
+
export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
|
|
@@ -1,106 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/instrumentation/tracing.ts
|
|
3
|
-
/**
|
|
4
|
-
* Get the currently active span
|
|
5
|
-
*/
|
|
6
|
-
function getActiveSpan() {
|
|
7
|
-
return trace.getActiveSpan();
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Set attributes on the active span
|
|
11
|
-
*/
|
|
12
|
-
function setSpanAttributes(attributes) {
|
|
13
|
-
const span = getActiveSpan();
|
|
14
|
-
if (span) span.setAttributes(attributes);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Create a new span as a child of the current span
|
|
18
|
-
*/
|
|
19
|
-
function createSpan(name, attributes) {
|
|
20
|
-
return trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Execute a function within a new span context
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* const result = await withSpan('processOrder', async (span) => {
|
|
28
|
-
* span.setAttribute('order.id', orderId);
|
|
29
|
-
* const order = await processOrder(orderId);
|
|
30
|
-
* return order;
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
async function withSpan(name, fn, attributes) {
|
|
35
|
-
const span = trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
36
|
-
try {
|
|
37
|
-
const result = await context.with(trace.setSpan(context.active(), span), () => fn(span));
|
|
38
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
39
|
-
return result;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
span.setStatus({
|
|
42
|
-
code: SpanStatusCode.ERROR,
|
|
43
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
44
|
-
});
|
|
45
|
-
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
46
|
-
throw error;
|
|
47
|
-
} finally {
|
|
48
|
-
span.end();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Synchronous version of withSpan
|
|
53
|
-
*/
|
|
54
|
-
function withSpanSync(name, fn, attributes) {
|
|
55
|
-
const span = trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
|
|
56
|
-
try {
|
|
57
|
-
const result = context.with(trace.setSpan(context.active(), span), () => fn(span));
|
|
58
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
59
|
-
return result;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
span.setStatus({
|
|
62
|
-
code: SpanStatusCode.ERROR,
|
|
63
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
64
|
-
});
|
|
65
|
-
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
66
|
-
throw error;
|
|
67
|
-
} finally {
|
|
68
|
-
span.end();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get the current trace ID (useful for log correlation)
|
|
73
|
-
*/
|
|
74
|
-
function getTraceId() {
|
|
75
|
-
return getActiveSpan()?.spanContext().traceId;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get the current span ID
|
|
79
|
-
*/
|
|
80
|
-
function getSpanId() {
|
|
81
|
-
return getActiveSpan()?.spanContext().spanId;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Record an exception on the current span
|
|
85
|
-
*/
|
|
86
|
-
function recordException(error) {
|
|
87
|
-
const span = getActiveSpan();
|
|
88
|
-
if (span) {
|
|
89
|
-
span.recordException(error);
|
|
90
|
-
span.setStatus({
|
|
91
|
-
code: SpanStatusCode.ERROR,
|
|
92
|
-
message: error.message
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Add an event to the current span
|
|
98
|
-
*/
|
|
99
|
-
function addSpanEvent(name, attributes) {
|
|
100
|
-
const span = getActiveSpan();
|
|
101
|
-
if (span) span.addEvent(name, attributes);
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
|
|
1
|
+
import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-Cijm_5NI.mjs";
|
|
105
2
|
|
|
106
|
-
|
|
3
|
+
export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
|
package/dist/logger/console.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
//#region src/logger/console.ts
|
|
3
3
|
/**
|
|
4
4
|
* A logger that sends logs to both Telescope and an optional underlying logger.
|
|
@@ -51,10 +51,8 @@ var TelescopeLogger = class TelescopeLogger {
|
|
|
51
51
|
};
|
|
52
52
|
message = msg ?? "";
|
|
53
53
|
}
|
|
54
|
-
if (this.logger)
|
|
55
|
-
|
|
56
|
-
else this.logger[level](objOrMsg, msg, ...args);
|
|
57
|
-
}
|
|
54
|
+
if (this.logger) if (typeof objOrMsg === "string") this.logger[level](objOrMsg);
|
|
55
|
+
else this.logger[level](objOrMsg, msg, ...args);
|
|
58
56
|
this.telescope[level](message, context, this.requestId).catch(() => {});
|
|
59
57
|
};
|
|
60
58
|
return fn;
|
|
@@ -63,11 +61,9 @@ var TelescopeLogger = class TelescopeLogger {
|
|
|
63
61
|
info = this.createLogFn("info");
|
|
64
62
|
warn = this.createLogFn("warn");
|
|
65
63
|
error = this.createLogFn("error");
|
|
66
|
-
fatal = (
|
|
67
|
-
if (this.logger)
|
|
68
|
-
|
|
69
|
-
else this.logger.fatal(objOrMsg, msg, ...args);
|
|
70
|
-
}
|
|
64
|
+
fatal = (objOrMsg, msg, ...args) => {
|
|
65
|
+
if (this.logger) if (typeof objOrMsg === "string") this.logger.fatal(objOrMsg);
|
|
66
|
+
else this.logger.fatal(objOrMsg, msg, ...args);
|
|
71
67
|
let context;
|
|
72
68
|
let message;
|
|
73
69
|
if (typeof objOrMsg === "string") {
|
|
@@ -85,12 +81,10 @@ var TelescopeLogger = class TelescopeLogger {
|
|
|
85
81
|
message = msg ?? "";
|
|
86
82
|
}
|
|
87
83
|
this.telescope.error(message, context, this.requestId).catch(() => {});
|
|
88
|
-
}
|
|
89
|
-
trace = (
|
|
90
|
-
if (this.logger)
|
|
91
|
-
|
|
92
|
-
else this.logger.trace(objOrMsg, msg, ...args);
|
|
93
|
-
}
|
|
84
|
+
};
|
|
85
|
+
trace = (objOrMsg, msg, ...args) => {
|
|
86
|
+
if (this.logger) if (typeof objOrMsg === "string") this.logger.trace(objOrMsg);
|
|
87
|
+
else this.logger.trace(objOrMsg, msg, ...args);
|
|
94
88
|
let context;
|
|
95
89
|
let message;
|
|
96
90
|
if (typeof objOrMsg === "string") {
|
|
@@ -108,7 +102,7 @@ var TelescopeLogger = class TelescopeLogger {
|
|
|
108
102
|
message = msg ?? "";
|
|
109
103
|
}
|
|
110
104
|
this.telescope.debug(message, context, this.requestId).catch(() => {});
|
|
111
|
-
}
|
|
105
|
+
};
|
|
112
106
|
/**
|
|
113
107
|
* Creates a child logger with additional context.
|
|
114
108
|
* The child logger inherits all context from the parent.
|
|
@@ -160,8 +154,8 @@ function createTelescopeLogger(telescope, logger, context) {
|
|
|
160
154
|
context
|
|
161
155
|
});
|
|
162
156
|
}
|
|
157
|
+
|
|
163
158
|
//#endregion
|
|
164
159
|
exports.TelescopeLogger = TelescopeLogger;
|
|
165
160
|
exports.createTelescopeLogger = createTelescopeLogger;
|
|
166
|
-
|
|
167
161
|
//# sourceMappingURL=console.cjs.map
|