@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,86 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/instrumentation/hono.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Options for the Hono telemetry middleware
|
|
6
|
-
*/
|
|
7
|
-
export interface HonoTelemetryMiddlewareOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Whether to record request body as span attribute
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
recordBody?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Whether to record response body as span attribute
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
recordResponseBody?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom function to extract user ID from context
|
|
20
|
-
*/
|
|
21
|
-
getUserId?: (c: Context) => string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Paths to skip tracing (supports wildcards)
|
|
24
|
-
*/
|
|
25
|
-
ignorePaths?: string[];
|
|
26
|
-
/**
|
|
27
|
-
* Whether to skip tracing for this request
|
|
28
|
-
*/
|
|
29
|
-
shouldSkip?: (c: Context) => boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The origins whose `traceparent` is continued: the API's own sites, the
|
|
32
|
-
* same list its CORS allows. A request from any other origin starts a new
|
|
33
|
-
* trace linked to the one it claimed.
|
|
34
|
-
*
|
|
35
|
-
* A function is read on each request, for a server that learns its origins
|
|
36
|
-
* only once the app has loaded its configuration.
|
|
37
|
-
*/
|
|
38
|
-
trustedOrigins?: readonly string[] | (() => readonly string[] | undefined);
|
|
39
|
-
/**
|
|
40
|
-
* Whether a request with no `Origin` from an internal caller continues its
|
|
41
|
-
* `traceparent` — another service on the private network (see `./trust`):
|
|
42
|
-
* no `Origin`, no proxy's forwarding header, and a loopback or private
|
|
43
|
-
* peer address, read from `@hono/node-server`'s socket.
|
|
44
|
-
*
|
|
45
|
-
* `false` trusts no caller without an origin; a function decides itself.
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
internalCallers?: boolean | ((c: Context) => boolean);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get the current span from Hono context
|
|
52
|
-
*/
|
|
53
|
-
export declare function getSpanFromContext(c: Context): Span | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Get the current trace context from Hono context
|
|
56
|
-
*/
|
|
57
|
-
export declare function getTraceContextFromHono(c: Context): any;
|
|
58
|
-
/**
|
|
59
|
-
* Create a telemetry middleware for Hono applications
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* import { honoTelemetryMiddleware } from '@geekmidas/telescope/instrumentation';
|
|
64
|
-
*
|
|
65
|
-
* const app = new Hono();
|
|
66
|
-
* app.use('*', honoTelemetryMiddleware());
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export declare function honoTelemetryMiddleware(options?: HonoTelemetryMiddlewareOptions): MiddlewareHandler;
|
|
70
|
-
/**
|
|
71
|
-
* Run a function within the span context from Hono context
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* app.get('/api/users', async (c) => {
|
|
76
|
-
* return withHonoSpanContext(c, async () => {
|
|
77
|
-
* // Any spans created here will be children of the request span
|
|
78
|
-
* const users = await fetchUsers();
|
|
79
|
-
* return c.json(users);
|
|
80
|
-
* });
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export declare function withHonoSpanContext<T>(c: Context, fn: () => Promise<T>): Promise<T>;
|
|
85
|
-
//#endregion
|
|
86
|
-
//# sourceMappingURL=hono.d.cts.map
|
|
1
|
+
import { HonoTelemetryMiddlewareOptions, getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext } from "../hono-CemCKU87.cjs";
|
|
2
|
+
export { HonoTelemetryMiddlewareOptions, getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext };
|
|
@@ -1,86 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/instrumentation/hono.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Options for the Hono telemetry middleware
|
|
6
|
-
*/
|
|
7
|
-
export interface HonoTelemetryMiddlewareOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Whether to record request body as span attribute
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
recordBody?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Whether to record response body as span attribute
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
recordResponseBody?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom function to extract user ID from context
|
|
20
|
-
*/
|
|
21
|
-
getUserId?: (c: Context$1) => string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Paths to skip tracing (supports wildcards)
|
|
24
|
-
*/
|
|
25
|
-
ignorePaths?: string[];
|
|
26
|
-
/**
|
|
27
|
-
* Whether to skip tracing for this request
|
|
28
|
-
*/
|
|
29
|
-
shouldSkip?: (c: Context$1) => boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The origins whose `traceparent` is continued: the API's own sites, the
|
|
32
|
-
* same list its CORS allows. A request from any other origin starts a new
|
|
33
|
-
* trace linked to the one it claimed.
|
|
34
|
-
*
|
|
35
|
-
* A function is read on each request, for a server that learns its origins
|
|
36
|
-
* only once the app has loaded its configuration.
|
|
37
|
-
*/
|
|
38
|
-
trustedOrigins?: readonly string[] | (() => readonly string[] | undefined);
|
|
39
|
-
/**
|
|
40
|
-
* Whether a request with no `Origin` from an internal caller continues its
|
|
41
|
-
* `traceparent` — another service on the private network (see `./trust`):
|
|
42
|
-
* no `Origin`, no proxy's forwarding header, and a loopback or private
|
|
43
|
-
* peer address, read from `@hono/node-server`'s socket.
|
|
44
|
-
*
|
|
45
|
-
* `false` trusts no caller without an origin; a function decides itself.
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
internalCallers?: boolean | ((c: Context$1) => boolean);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get the current span from Hono context
|
|
52
|
-
*/
|
|
53
|
-
export declare function getSpanFromContext(c: Context$1): Span | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Get the current trace context from Hono context
|
|
56
|
-
*/
|
|
57
|
-
export declare function getTraceContextFromHono(c: Context$1): any;
|
|
58
|
-
/**
|
|
59
|
-
* Create a telemetry middleware for Hono applications
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* import { honoTelemetryMiddleware } from '@geekmidas/telescope/instrumentation';
|
|
64
|
-
*
|
|
65
|
-
* const app = new Hono();
|
|
66
|
-
* app.use('*', honoTelemetryMiddleware());
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export declare function honoTelemetryMiddleware(options?: HonoTelemetryMiddlewareOptions): MiddlewareHandler;
|
|
70
|
-
/**
|
|
71
|
-
* Run a function within the span context from Hono context
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* app.get('/api/users', async (c) => {
|
|
76
|
-
* return withHonoSpanContext(c, async () => {
|
|
77
|
-
* // Any spans created here will be children of the request span
|
|
78
|
-
* const users = await fetchUsers();
|
|
79
|
-
* return c.json(users);
|
|
80
|
-
* });
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export declare function withHonoSpanContext<T>(c: Context$1, fn: () => Promise<T>): Promise<T>;
|
|
85
|
-
//#endregion
|
|
86
|
-
//# sourceMappingURL=hono.d.mts.map
|
|
1
|
+
import { HonoTelemetryMiddlewareOptions, getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext } from "../hono--uKQ7Jgi.mjs";
|
|
2
|
+
export { HonoTelemetryMiddlewareOptions, getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext };
|
|
@@ -1,171 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { context, trace } from "@opentelemetry/api";
|
|
4
|
-
import { routePath } from "hono/route";
|
|
5
|
-
//#region src/instrumentation/hono.ts
|
|
6
|
-
const SPAN_KEY = "telemetry.span";
|
|
7
|
-
const CONTEXT_KEY = "telemetry.context";
|
|
8
|
-
/**
|
|
9
|
-
* Get the current span from Hono context
|
|
10
|
-
*/
|
|
11
|
-
function getSpanFromContext(c) {
|
|
12
|
-
return c.get(SPAN_KEY);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Get the current trace context from Hono context
|
|
16
|
-
*/
|
|
17
|
-
function getTraceContextFromHono(c) {
|
|
18
|
-
return c.get(CONTEXT_KEY);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Create a telemetry middleware for Hono applications
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import { honoTelemetryMiddleware } from '@geekmidas/telescope/instrumentation';
|
|
26
|
-
*
|
|
27
|
-
* const app = new Hono();
|
|
28
|
-
* app.use('*', honoTelemetryMiddleware());
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
function honoTelemetryMiddleware(options = {}) {
|
|
32
|
-
return async (c, next) => {
|
|
33
|
-
if (options.ignorePaths && shouldIgnorePath(c.req.path, options.ignorePaths)) return next();
|
|
34
|
-
if (options.shouldSkip?.(c)) return next();
|
|
35
|
-
const headers = {};
|
|
36
|
-
c.req.raw.headers.forEach((value, key) => {
|
|
37
|
-
headers[key] = value;
|
|
38
|
-
});
|
|
39
|
-
const { parent: parentContext, links } = incomingTraceContext(headers, isTrustedCaller(c, options));
|
|
40
|
-
const attrs = buildHonoSpanAttributes(c, options);
|
|
41
|
-
const span = createHttpServerSpan(attrs, parentContext, links);
|
|
42
|
-
const spanContext = trace.setSpan(parentContext, span);
|
|
43
|
-
c.set(SPAN_KEY, span);
|
|
44
|
-
c.set(CONTEXT_KEY, spanContext);
|
|
45
|
-
if (options.recordBody) try {
|
|
46
|
-
const body = await c.req.text();
|
|
47
|
-
if (body) span.setAttribute("http.request.body", body.length > 4096 ? `${body.slice(0, 4096)}...` : body);
|
|
48
|
-
} catch {}
|
|
49
|
-
try {
|
|
50
|
-
await context.with(spanContext, async () => {
|
|
51
|
-
await next();
|
|
52
|
-
});
|
|
53
|
-
nameAfterRoute(c, span);
|
|
54
|
-
const statusCode = c.res.status;
|
|
55
|
-
if (options.recordResponseBody) try {
|
|
56
|
-
const body = await c.res.clone().text();
|
|
57
|
-
if (body) span.setAttribute("http.response.body", body.length > 4096 ? `${body.slice(0, 4096)}...` : body);
|
|
58
|
-
} catch {}
|
|
59
|
-
endHttpSpan(span, { statusCode }, c.error);
|
|
60
|
-
} catch (error) {
|
|
61
|
-
nameAfterRoute(c, span);
|
|
62
|
-
endHttpSpan(span, { statusCode: 500 }, error instanceof Error ? error : new Error(String(error)));
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Whether this request's `traceparent` is continued: from one of the API's
|
|
69
|
-
* own origins, or from an internal caller.
|
|
70
|
-
*/
|
|
71
|
-
function isTrustedCaller(c, options) {
|
|
72
|
-
const origin = c.req.header("origin");
|
|
73
|
-
if (origin) {
|
|
74
|
-
const trusted = typeof options.trustedOrigins === "function" ? options.trustedOrigins() : options.trustedOrigins;
|
|
75
|
-
return isTrustedOrigin(origin, trusted);
|
|
76
|
-
}
|
|
77
|
-
const internal = options.internalCallers ?? true;
|
|
78
|
-
if (typeof internal === "function") return internal(c);
|
|
79
|
-
if (!internal) return false;
|
|
80
|
-
return isInternalCaller({
|
|
81
|
-
headers: c.req.raw.headers,
|
|
82
|
-
remoteAddress: remoteAddressOf(c)
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/** The TCP peer's address under `@hono/node-server`, or undefined. */
|
|
86
|
-
function remoteAddressOf(c) {
|
|
87
|
-
return c.env?.incoming?.socket?.remoteAddress;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* The route the request matched, once the handler has run — `/users/:id`,
|
|
91
|
-
* never `/users/42` — or undefined when only middleware ran (a 404).
|
|
92
|
-
*
|
|
93
|
-
* Read after `next()`: before it, the route is this middleware's own `*`.
|
|
94
|
-
*/
|
|
95
|
-
function matchedRoute(c) {
|
|
96
|
-
const path = routePath(c);
|
|
97
|
-
return path && !path.includes("*") ? path : void 0;
|
|
98
|
-
}
|
|
99
|
-
/** `GET /users/:id`, or the bare method when no route matched. */
|
|
100
|
-
function nameAfterRoute(c, span) {
|
|
101
|
-
const route = matchedRoute(c);
|
|
102
|
-
if (route) {
|
|
103
|
-
span.setAttribute("http.route", route);
|
|
104
|
-
span.updateName(`${c.req.method} ${route}`);
|
|
105
|
-
} else span.updateName(c.req.method);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Build span attributes from Hono context
|
|
109
|
-
*/
|
|
110
|
-
function buildHonoSpanAttributes(c, options) {
|
|
111
|
-
const req = c.req;
|
|
112
|
-
const url = new URL(req.url);
|
|
113
|
-
const attrs = {
|
|
114
|
-
method: req.method,
|
|
115
|
-
path: url.pathname,
|
|
116
|
-
host: url.host,
|
|
117
|
-
scheme: url.protocol.replace(":", ""),
|
|
118
|
-
userAgent: req.header("user-agent"),
|
|
119
|
-
clientIp: getClientIp(c),
|
|
120
|
-
requestId: req.header("x-request-id") || req.header("x-amzn-requestid")
|
|
121
|
-
};
|
|
122
|
-
if (options.getUserId) {
|
|
123
|
-
const userId = options.getUserId(c);
|
|
124
|
-
if (userId) attrs.user = { userId };
|
|
125
|
-
}
|
|
126
|
-
return attrs;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Extract client IP from Hono context
|
|
130
|
-
*/
|
|
131
|
-
function getClientIp(c) {
|
|
132
|
-
const xForwardedFor = c.req.header("x-forwarded-for");
|
|
133
|
-
if (xForwardedFor) return xForwardedFor.split(",")[0]?.trim();
|
|
134
|
-
const xRealIp = c.req.header("x-real-ip");
|
|
135
|
-
if (xRealIp) return xRealIp;
|
|
136
|
-
const cfConnectingIp = c.req.header("cf-connecting-ip");
|
|
137
|
-
if (cfConnectingIp) return cfConnectingIp;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Check if path should be ignored
|
|
141
|
-
*/
|
|
142
|
-
function shouldIgnorePath(path, ignorePaths) {
|
|
143
|
-
for (const pattern of ignorePaths) if (pattern.endsWith("*")) {
|
|
144
|
-
const prefix = pattern.slice(0, -1);
|
|
145
|
-
if (path.startsWith(prefix)) return true;
|
|
146
|
-
} else if (path === pattern) return true;
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Run a function within the span context from Hono context
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* app.get('/api/users', async (c) => {
|
|
155
|
-
* return withHonoSpanContext(c, async () => {
|
|
156
|
-
* // Any spans created here will be children of the request span
|
|
157
|
-
* const users = await fetchUsers();
|
|
158
|
-
* return c.json(users);
|
|
159
|
-
* });
|
|
160
|
-
* });
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
async function withHonoSpanContext(c, fn) {
|
|
164
|
-
const ctx = getTraceContextFromHono(c);
|
|
165
|
-
if (!ctx) return fn();
|
|
166
|
-
return context.with(ctx, fn);
|
|
167
|
-
}
|
|
168
|
-
//#endregion
|
|
169
|
-
export { getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext };
|
|
1
|
+
import "../http-DQzgLczm.mjs";
|
|
2
|
+
import { getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext } from "../hono-DxhvnVbF.mjs";
|
|
170
3
|
|
|
171
|
-
|
|
4
|
+
export { getSpanFromContext, getTraceContextFromHono, honoTelemetryMiddleware, withHonoSpanContext };
|
|
@@ -1,190 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
let _opentelemetry_api = require("@opentelemetry/api");
|
|
3
|
-
//#region src/instrumentation/http.ts
|
|
4
|
-
const TRACER_NAME = "@geekmidas/constructs";
|
|
5
|
-
/**
|
|
6
|
-
* Get or create a tracer for constructs instrumentation
|
|
7
|
-
*/
|
|
8
|
-
function getConstructsTracer() {
|
|
9
|
-
return _opentelemetry_api.trace.getTracer(TRACER_NAME);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Convert HTTP attributes to OpenTelemetry semantic conventions
|
|
13
|
-
*/
|
|
14
|
-
function toOtelAttributes(attrs) {
|
|
15
|
-
const otelAttrs = {};
|
|
16
|
-
if (attrs.method) otelAttrs["http.request.method"] = attrs.method;
|
|
17
|
-
if (attrs.url) otelAttrs["url.full"] = attrs.url;
|
|
18
|
-
if (attrs.path) otelAttrs["url.path"] = attrs.path;
|
|
19
|
-
if (attrs.route) otelAttrs["http.route"] = attrs.route;
|
|
20
|
-
if (attrs.host) otelAttrs["server.address"] = attrs.host;
|
|
21
|
-
if (attrs.scheme) otelAttrs["url.scheme"] = attrs.scheme;
|
|
22
|
-
if (attrs.userAgent) otelAttrs["user_agent.original"] = attrs.userAgent;
|
|
23
|
-
if (attrs.clientIp) otelAttrs["client.address"] = attrs.clientIp;
|
|
24
|
-
if (attrs.requestId) otelAttrs["http.request.id"] = attrs.requestId;
|
|
25
|
-
if (attrs.response?.statusCode) otelAttrs["http.response.status_code"] = attrs.response.statusCode;
|
|
26
|
-
if (attrs.response?.responseSize) otelAttrs["http.response.body.size"] = attrs.response.responseSize;
|
|
27
|
-
if (attrs.endpoint?.name) otelAttrs["endpoint.name"] = attrs.endpoint.name;
|
|
28
|
-
if (attrs.endpoint?.operationId) otelAttrs["endpoint.operation_id"] = attrs.endpoint.operationId;
|
|
29
|
-
if (attrs.endpoint?.tags?.length) otelAttrs["endpoint.tags"] = attrs.endpoint.tags;
|
|
30
|
-
if (attrs.user?.userId) otelAttrs["enduser.id"] = attrs.user.userId;
|
|
31
|
-
if (attrs.user?.sessionId) otelAttrs["session.id"] = attrs.user.sessionId;
|
|
32
|
-
if (attrs.user?.roles?.length) otelAttrs["enduser.role"] = attrs.user.roles.join(",");
|
|
33
|
-
if (attrs.custom) Object.assign(otelAttrs, attrs.custom);
|
|
34
|
-
return otelAttrs;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Extract trace context from HTTP headers
|
|
38
|
-
*/
|
|
39
|
-
function extractTraceContext(headers) {
|
|
40
|
-
const normalizedHeaders = {};
|
|
41
|
-
for (const [key, value] of Object.entries(headers)) if (value) {
|
|
42
|
-
const stringValue = Array.isArray(value) ? value[0] : value;
|
|
43
|
-
if (stringValue) normalizedHeaders[key.toLowerCase()] = stringValue;
|
|
44
|
-
}
|
|
45
|
-
return _opentelemetry_api.propagation.extract(_opentelemetry_api.context.active(), normalizedHeaders);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The trace a request's span belongs to.
|
|
49
|
-
*
|
|
50
|
-
* From a trusted caller (see `./trust`) its `traceparent` is continued, and
|
|
51
|
-
* the span is its child. From anyone else the span starts a new trace — no
|
|
52
|
-
* parent, no baggage — with a link to the context the caller claimed, so the
|
|
53
|
-
* hop can still be followed without the caller choosing this trace.
|
|
54
|
-
*/
|
|
55
|
-
function incomingTraceContext(headers, trusted) {
|
|
56
|
-
const extracted = extractTraceContext(headers);
|
|
57
|
-
if (trusted) return {
|
|
58
|
-
parent: extracted,
|
|
59
|
-
links: []
|
|
60
|
-
};
|
|
61
|
-
const claimed = _opentelemetry_api.trace.getSpanContext(extracted);
|
|
62
|
-
return {
|
|
63
|
-
parent: _opentelemetry_api.trace.deleteSpan(_opentelemetry_api.context.active()),
|
|
64
|
-
links: claimed && (0, _opentelemetry_api.isSpanContextValid)(claimed) ? [{
|
|
65
|
-
context: claimed,
|
|
66
|
-
attributes: { "gkm.trace.untrusted_parent": true }
|
|
67
|
-
}] : []
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Inject trace context into HTTP headers
|
|
72
|
-
*/
|
|
73
|
-
function injectTraceContext(headers, ctx) {
|
|
74
|
-
const result = { ...headers };
|
|
75
|
-
_opentelemetry_api.propagation.inject(ctx ?? _opentelemetry_api.context.active(), result);
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Create an HTTP server span for an incoming request
|
|
80
|
-
*/
|
|
81
|
-
function createHttpServerSpan(attrs, parentContext, links) {
|
|
82
|
-
const tracer = getConstructsTracer();
|
|
83
|
-
const spanName = attrs.route ? `${attrs.method} ${attrs.route}` : `${attrs.method} ${attrs.path || "/"}`;
|
|
84
|
-
const ctx = parentContext ?? _opentelemetry_api.context.active();
|
|
85
|
-
return tracer.startSpan(spanName, {
|
|
86
|
-
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
87
|
-
attributes: toOtelAttributes(attrs),
|
|
88
|
-
...links?.length ? { links } : {}
|
|
89
|
-
}, ctx);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* End an HTTP span with response data
|
|
93
|
-
*/
|
|
94
|
-
function endHttpSpan(span, response, error) {
|
|
95
|
-
span.setAttribute("http.response.status_code", response.statusCode);
|
|
96
|
-
if (response.responseSize) span.setAttribute("http.response.body.size", response.responseSize);
|
|
97
|
-
if (error) {
|
|
98
|
-
span.recordException(error);
|
|
99
|
-
span.setStatus({
|
|
100
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
101
|
-
message: error.message
|
|
102
|
-
});
|
|
103
|
-
} else if (response.statusCode >= 500) span.setStatus({
|
|
104
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
105
|
-
message: `HTTP ${response.statusCode}`
|
|
106
|
-
});
|
|
107
|
-
else if (response.statusCode < 400) span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
|
|
108
|
-
span.end();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Execute a function within an HTTP server span context
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* const result = await withHttpSpan(
|
|
116
|
-
* { method: 'GET', path: '/users', route: '/users' },
|
|
117
|
-
* async (span) => {
|
|
118
|
-
* const users = await getUsers();
|
|
119
|
-
* return { statusCode: 200, body: users };
|
|
120
|
-
* }
|
|
121
|
-
* );
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
async function withHttpSpan(attrs, fn, parentContext) {
|
|
125
|
-
const span = createHttpServerSpan(attrs, parentContext);
|
|
126
|
-
try {
|
|
127
|
-
const result = await _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(parentContext ?? _opentelemetry_api.context.active(), span), () => fn(span));
|
|
128
|
-
endHttpSpan(span, { statusCode: result.statusCode ?? 200 });
|
|
129
|
-
return result;
|
|
130
|
-
} catch (error) {
|
|
131
|
-
endHttpSpan(span, { statusCode: 500 }, error instanceof Error ? error : new Error(String(error)));
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Create a child span for internal operations (middleware, handlers, etc.)
|
|
137
|
-
*/
|
|
138
|
-
function createChildSpan(name, attributes) {
|
|
139
|
-
return getConstructsTracer().startSpan(name, {
|
|
140
|
-
kind: _opentelemetry_api.SpanKind.INTERNAL,
|
|
141
|
-
attributes
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Execute a function within a child span
|
|
146
|
-
*/
|
|
147
|
-
async function withChildSpan(name, fn, attributes) {
|
|
148
|
-
const span = createChildSpan(name, attributes);
|
|
149
|
-
try {
|
|
150
|
-
const result = await _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), () => fn(span));
|
|
151
|
-
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
|
|
152
|
-
return result;
|
|
153
|
-
} catch (error) {
|
|
154
|
-
span.setStatus({
|
|
155
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
156
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
157
|
-
});
|
|
158
|
-
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
159
|
-
throw error;
|
|
160
|
-
} finally {
|
|
161
|
-
span.end();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Check if tracing is enabled (OpenTelemetry API is available and configured)
|
|
166
|
-
*/
|
|
167
|
-
function isTracingEnabled() {
|
|
168
|
-
try {
|
|
169
|
-
const span = _opentelemetry_api.trace.getTracer(TRACER_NAME).startSpan("test");
|
|
170
|
-
const isReal = span.spanContext().traceId !== "00000000000000000000000000000000";
|
|
171
|
-
span.end();
|
|
172
|
-
return isReal;
|
|
173
|
-
} catch {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
exports.createChildSpan = createChildSpan;
|
|
179
|
-
exports.createHttpServerSpan = createHttpServerSpan;
|
|
180
|
-
exports.endHttpSpan = endHttpSpan;
|
|
181
|
-
exports.extractTraceContext = extractTraceContext;
|
|
182
|
-
exports.getConstructsTracer = getConstructsTracer;
|
|
183
|
-
exports.incomingTraceContext = incomingTraceContext;
|
|
184
|
-
exports.injectTraceContext = injectTraceContext;
|
|
185
|
-
exports.isTracingEnabled = isTracingEnabled;
|
|
186
|
-
exports.toOtelAttributes = toOtelAttributes;
|
|
187
|
-
exports.withChildSpan = withChildSpan;
|
|
188
|
-
exports.withHttpSpan = withHttpSpan;
|
|
1
|
+
const require_http = require('../http-D_Z8sYXZ.cjs');
|
|
189
2
|
|
|
190
|
-
|
|
3
|
+
exports.createChildSpan = require_http.createChildSpan;
|
|
4
|
+
exports.createHttpServerSpan = require_http.createHttpServerSpan;
|
|
5
|
+
exports.endHttpSpan = require_http.endHttpSpan;
|
|
6
|
+
exports.extractTraceContext = require_http.extractTraceContext;
|
|
7
|
+
exports.getConstructsTracer = require_http.getConstructsTracer;
|
|
8
|
+
exports.injectTraceContext = require_http.injectTraceContext;
|
|
9
|
+
exports.isTracingEnabled = require_http.isTracingEnabled;
|
|
10
|
+
exports.toOtelAttributes = require_http.toOtelAttributes;
|
|
11
|
+
exports.withChildSpan = require_http.withChildSpan;
|
|
12
|
+
exports.withHttpSpan = require_http.withHttpSpan;
|
|
@@ -1,119 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* HTTP request attributes following OpenTelemetry semantic conventions
|
|
5
|
-
*/
|
|
6
|
-
export interface HttpRequestAttributes {
|
|
7
|
-
method: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
path?: string;
|
|
10
|
-
route?: string;
|
|
11
|
-
host?: string;
|
|
12
|
-
scheme?: 'http' | 'https';
|
|
13
|
-
userAgent?: string;
|
|
14
|
-
clientIp?: string;
|
|
15
|
-
requestId?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* HTTP response attributes
|
|
19
|
-
*/
|
|
20
|
-
export interface HttpResponseAttributes {
|
|
21
|
-
statusCode: number;
|
|
22
|
-
responseSize?: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Endpoint-specific attributes
|
|
26
|
-
*/
|
|
27
|
-
export interface EndpointAttributes {
|
|
28
|
-
name?: string;
|
|
29
|
-
operationId?: string;
|
|
30
|
-
tags?: string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* User/session attributes
|
|
34
|
-
*/
|
|
35
|
-
export interface UserAttributes {
|
|
36
|
-
userId?: string;
|
|
37
|
-
sessionId?: string;
|
|
38
|
-
roles?: string[];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Full span attributes for HTTP requests
|
|
42
|
-
*/
|
|
43
|
-
export interface HttpSpanAttributes extends HttpRequestAttributes {
|
|
44
|
-
response?: HttpResponseAttributes;
|
|
45
|
-
endpoint?: EndpointAttributes;
|
|
46
|
-
user?: UserAttributes;
|
|
47
|
-
custom?: Attributes;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get or create a tracer for constructs instrumentation
|
|
51
|
-
*/
|
|
52
|
-
export declare function getConstructsTracer(): import("@opentelemetry/api").Tracer;
|
|
53
|
-
/**
|
|
54
|
-
* Convert HTTP attributes to OpenTelemetry semantic conventions
|
|
55
|
-
*/
|
|
56
|
-
export declare function toOtelAttributes(attrs: HttpSpanAttributes): Attributes;
|
|
57
|
-
/**
|
|
58
|
-
* Extract trace context from HTTP headers
|
|
59
|
-
*/
|
|
60
|
-
export declare function extractTraceContext(headers: Record<string, string | string[] | undefined>): Context;
|
|
61
|
-
/** Where a request's span goes: under a parent, or a new root with links. */
|
|
62
|
-
export interface IncomingTraceContext {
|
|
63
|
-
/** The context the request span starts in. */
|
|
64
|
-
parent: Context;
|
|
65
|
-
/** The untrusted caller's context, linked rather than continued. */
|
|
66
|
-
links: Link[];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* The trace a request's span belongs to.
|
|
70
|
-
*
|
|
71
|
-
* From a trusted caller (see `./trust`) its `traceparent` is continued, and
|
|
72
|
-
* the span is its child. From anyone else the span starts a new trace — no
|
|
73
|
-
* parent, no baggage — with a link to the context the caller claimed, so the
|
|
74
|
-
* hop can still be followed without the caller choosing this trace.
|
|
75
|
-
*/
|
|
76
|
-
export declare function incomingTraceContext(headers: Record<string, string | string[] | undefined>, trusted: boolean): IncomingTraceContext;
|
|
77
|
-
/**
|
|
78
|
-
* Inject trace context into HTTP headers
|
|
79
|
-
*/
|
|
80
|
-
export declare function injectTraceContext(headers: Record<string, string>, ctx?: Context): Record<string, string>;
|
|
81
|
-
/**
|
|
82
|
-
* Create an HTTP server span for an incoming request
|
|
83
|
-
*/
|
|
84
|
-
export declare function createHttpServerSpan(attrs: HttpSpanAttributes, parentContext?: Context, links?: Link[]): Span;
|
|
85
|
-
/**
|
|
86
|
-
* End an HTTP span with response data
|
|
87
|
-
*/
|
|
88
|
-
export declare function endHttpSpan(span: Span, response: HttpResponseAttributes, error?: Error): void;
|
|
89
|
-
/**
|
|
90
|
-
* Execute a function within an HTTP server span context
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* const result = await withHttpSpan(
|
|
95
|
-
* { method: 'GET', path: '/users', route: '/users' },
|
|
96
|
-
* async (span) => {
|
|
97
|
-
* const users = await getUsers();
|
|
98
|
-
* return { statusCode: 200, body: users };
|
|
99
|
-
* }
|
|
100
|
-
* );
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare function withHttpSpan<T>(attrs: HttpSpanAttributes, fn: (span: Span) => Promise<T & {
|
|
104
|
-
statusCode?: number;
|
|
105
|
-
}>, parentContext?: Context): Promise<T>;
|
|
106
|
-
/**
|
|
107
|
-
* Create a child span for internal operations (middleware, handlers, etc.)
|
|
108
|
-
*/
|
|
109
|
-
export declare function createChildSpan(name: string, attributes?: Attributes): Span;
|
|
110
|
-
/**
|
|
111
|
-
* Execute a function within a child span
|
|
112
|
-
*/
|
|
113
|
-
export declare function withChildSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Attributes): Promise<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Check if tracing is enabled (OpenTelemetry API is available and configured)
|
|
116
|
-
*/
|
|
117
|
-
export declare function isTracingEnabled(): boolean;
|
|
118
|
-
//#endregion
|
|
119
|
-
//# sourceMappingURL=http.d.cts.map
|
|
1
|
+
import { EndpointAttributes, HttpRequestAttributes, HttpResponseAttributes, HttpSpanAttributes, UserAttributes, createChildSpan, createHttpServerSpan, endHttpSpan, extractTraceContext, getConstructsTracer, injectTraceContext, isTracingEnabled, toOtelAttributes, withChildSpan, withHttpSpan } from "../http-Dvca6fC3.cjs";
|
|
2
|
+
export { EndpointAttributes, HttpRequestAttributes, HttpResponseAttributes, HttpSpanAttributes, UserAttributes, createChildSpan, createHttpServerSpan, endHttpSpan, extractTraceContext, getConstructsTracer, injectTraceContext, isTracingEnabled, toOtelAttributes, withChildSpan, withHttpSpan };
|