@geekmidas/telescope 9.0.2 → 10.0.0-alpha.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.
Files changed (128) hide show
  1. package/README.md +14 -4
  2. package/dist/{http-D5kn3_Mt.d.mts → http-DULM1u2L.d.cts} +3 -3
  3. package/dist/{http-Dvca6fC3.d.cts.map → http-DULM1u2L.d.cts.map} +1 -1
  4. package/dist/{http-Dvca6fC3.d.cts → http-GB-Nlvwc.d.mts} +3 -3
  5. package/dist/{http-D5kn3_Mt.d.mts.map → http-GB-Nlvwc.d.mts.map} +1 -1
  6. package/dist/instrumentation/http.d.cts +1 -1
  7. package/dist/instrumentation/http.d.mts +1 -1
  8. package/dist/instrumentation/index.cjs +2 -2
  9. package/dist/instrumentation/index.d.cts +3 -3
  10. package/dist/instrumentation/index.d.mts +3 -3
  11. package/dist/instrumentation/index.mjs +2 -2
  12. package/dist/instrumentation/middleware.cjs +1 -1
  13. package/dist/instrumentation/middleware.d.cts +1 -1
  14. package/dist/instrumentation/middleware.d.mts +1 -1
  15. package/dist/instrumentation/middleware.mjs +1 -1
  16. package/dist/instrumentation/otel.cjs +1 -1
  17. package/dist/instrumentation/otel.d.cts +1 -1
  18. package/dist/instrumentation/otel.d.mts +1 -1
  19. package/dist/instrumentation/otel.mjs +1 -1
  20. package/dist/logger/console.d.cts.map +1 -1
  21. package/dist/logger/console.d.mts.map +1 -1
  22. package/dist/logger/pino.d.cts +2 -2
  23. package/dist/{middleware-DqPQpcup.cjs → middleware-Bcq6XXGG.cjs} +2 -2
  24. package/dist/middleware-Bcq6XXGG.cjs.map +1 -0
  25. package/dist/{middleware-4-GrQlOT.mjs → middleware-D1XEHvyy.mjs} +2 -2
  26. package/dist/middleware-D1XEHvyy.mjs.map +1 -0
  27. package/dist/{middleware-CA84nsNN.d.cts → middleware-PeyS-9Ny.d.cts} +2 -2
  28. package/dist/{middleware-CA84nsNN.d.cts.map → middleware-PeyS-9Ny.d.cts.map} +1 -1
  29. package/dist/{middleware-DAceVpfw.d.mts → middleware-oHvo_ZgU.d.mts} +2 -2
  30. package/dist/{middleware-DAceVpfw.d.mts.map → middleware-oHvo_ZgU.d.mts.map} +1 -1
  31. package/dist/{otel-40udNP5g.mjs → otel-B9bNoeZ2.mjs} +3 -3
  32. package/dist/otel-B9bNoeZ2.mjs.map +1 -0
  33. package/dist/{otel-1bJPb2Z7.d.mts → otel-Bk89b1lX.d.cts} +3 -3
  34. package/dist/{otel-1bJPb2Z7.d.mts.map → otel-Bk89b1lX.d.cts.map} +1 -1
  35. package/dist/{otel-COrpz_GZ.cjs → otel-BzjOtVxZ.cjs} +3 -3
  36. package/dist/otel-BzjOtVxZ.cjs.map +1 -0
  37. package/dist/{otel-SBVoVEHr.d.cts → otel-lPMsM26e.d.mts} +3 -3
  38. package/dist/{otel-SBVoVEHr.d.cts.map → otel-lPMsM26e.d.mts.map} +1 -1
  39. package/dist/storage/kysely.cjs +48 -38
  40. package/dist/storage/kysely.cjs.map +1 -1
  41. package/dist/storage/kysely.d.cts +29 -9
  42. package/dist/storage/kysely.d.cts.map +1 -1
  43. package/dist/storage/kysely.d.mts +29 -9
  44. package/dist/storage/kysely.d.mts.map +1 -1
  45. package/dist/storage/kysely.mjs +48 -38
  46. package/dist/storage/kysely.mjs.map +1 -1
  47. package/dist/tracing-BX8uY2nR.d.cts.map +1 -1
  48. package/dist/types-B1EIa_cQ.d.mts.map +1 -1
  49. package/dist/types-l7Rlb5Mg.d.cts.map +1 -1
  50. package/package.json +6 -3
  51. package/CHANGELOG.md +0 -72
  52. package/dist/middleware-4-GrQlOT.mjs.map +0 -1
  53. package/dist/middleware-DqPQpcup.cjs.map +0 -1
  54. package/dist/otel-40udNP5g.mjs.map +0 -1
  55. package/dist/otel-COrpz_GZ.cjs.map +0 -1
  56. package/src/Telescope.ts +0 -561
  57. package/src/__tests__/Telescope.spec.ts +0 -438
  58. package/src/__tests__/pino-transport.spec.ts +0 -115
  59. package/src/__tests__/redact.spec.ts +0 -336
  60. package/src/adapters/__tests__/lambda.spec.ts +0 -318
  61. package/src/adapters/__tests__/middy.spec.ts +0 -741
  62. package/src/adapters/index.ts +0 -22
  63. package/src/adapters/lambda.ts +0 -432
  64. package/src/adapters/middy.ts +0 -402
  65. package/src/adapters/types.ts +0 -181
  66. package/src/core.ts +0 -51
  67. package/src/index.ts +0 -34
  68. package/src/instrumentation/__tests__/core.spec.ts +0 -248
  69. package/src/instrumentation/__tests__/hono.spec.ts +0 -348
  70. package/src/instrumentation/__tests__/middleware.spec.ts +0 -528
  71. package/src/instrumentation/__tests__/otel.spec.ts +0 -291
  72. package/src/instrumentation/__tests__/tracing.spec.ts +0 -208
  73. package/src/instrumentation/core.ts +0 -228
  74. package/src/instrumentation/hono.ts +0 -270
  75. package/src/instrumentation/http.ts +0 -306
  76. package/src/instrumentation/index.ts +0 -90
  77. package/src/instrumentation/middleware.ts +0 -297
  78. package/src/instrumentation/otel.ts +0 -271
  79. package/src/instrumentation/setup.ts +0 -246
  80. package/src/instrumentation/tracing.ts +0 -145
  81. package/src/logger/__tests__/console.spec.ts +0 -366
  82. package/src/logger/__tests__/pino.spec.ts +0 -217
  83. package/src/logger/console.ts +0 -230
  84. package/src/logger/pino.ts +0 -201
  85. package/src/metrics/MetricsAggregator.ts +0 -555
  86. package/src/metrics/__tests__/MetricsAggregator.spec.ts +0 -298
  87. package/src/metrics/index.ts +0 -2
  88. package/src/metrics/storage/InMemoryMetricsStorage.ts +0 -380
  89. package/src/metrics/storage/MetricsStorage.ts +0 -74
  90. package/src/metrics/storage/index.ts +0 -3
  91. package/src/metrics/storage/types.ts +0 -243
  92. package/src/otlp/__tests__/receiver.spec.ts +0 -367
  93. package/src/otlp/__tests__/transformer.spec.ts +0 -455
  94. package/src/otlp/hono.ts +0 -120
  95. package/src/otlp/index.ts +0 -22
  96. package/src/otlp/receiver.ts +0 -162
  97. package/src/otlp/transformer.ts +0 -367
  98. package/src/otlp/types.ts +0 -364
  99. package/src/redact.ts +0 -116
  100. package/src/server/__tests__/hono.spec.ts +0 -814
  101. package/src/server/hono.ts +0 -442
  102. package/src/storage/__tests__/kysely.spec.ts +0 -715
  103. package/src/storage/__tests__/memory.spec.ts +0 -694
  104. package/src/storage/kysely.ts +0 -599
  105. package/src/storage/memory.ts +0 -204
  106. package/src/types.ts +0 -447
  107. package/src/ui-assets.ts +0 -40
  108. package/tsconfig.json +0 -9
  109. package/ui/CHANGELOG.md +0 -7
  110. package/ui/index.html +0 -12
  111. package/ui/node_modules/.bin/tsc +0 -21
  112. package/ui/node_modules/.bin/tsserver +0 -21
  113. package/ui/node_modules/.bin/vite +0 -21
  114. package/ui/package.json +0 -24
  115. package/ui/src/App.tsx +0 -595
  116. package/ui/src/api.ts +0 -88
  117. package/ui/src/components/ExceptionDetail.tsx +0 -100
  118. package/ui/src/components/FilterBar.tsx +0 -162
  119. package/ui/src/components/LogDetail.tsx +0 -91
  120. package/ui/src/components/RequestDetail.tsx +0 -143
  121. package/ui/src/main.tsx +0 -10
  122. package/ui/src/styles.css +0 -11
  123. package/ui/src/types.ts +0 -63
  124. package/ui/src/vite-env.d.ts +0 -1
  125. package/ui/src/vite-plugin-gkm-config.ts +0 -54
  126. package/ui/tsconfig.json +0 -20
  127. package/ui/tsconfig.tsbuildinfo +0 -1
  128. package/ui/vite.config.ts +0 -13
package/src/otlp/types.ts DELETED
@@ -1,364 +0,0 @@
1
- /**
2
- * OTLP JSON types based on OpenTelemetry Protocol specification.
3
- * These types represent the JSON encoding of OTLP protobuf messages.
4
- * @see https://opentelemetry.io/docs/specs/otlp/
5
- */
6
-
7
- // ============================================
8
- // Common Types
9
- // ============================================
10
-
11
- /**
12
- * Key-value pair for attributes
13
- */
14
- export interface KeyValue {
15
- key: string;
16
- value: AnyValue;
17
- }
18
-
19
- /**
20
- * Any value type (string, bool, int, double, array, kvlist, bytes)
21
- */
22
- export interface AnyValue {
23
- stringValue?: string;
24
- boolValue?: boolean;
25
- intValue?: string; // int64 as string
26
- doubleValue?: number;
27
- arrayValue?: ArrayValue;
28
- kvlistValue?: KeyValueList;
29
- bytesValue?: string; // base64 encoded
30
- }
31
-
32
- export interface ArrayValue {
33
- values: AnyValue[];
34
- }
35
-
36
- export interface KeyValueList {
37
- values: KeyValue[];
38
- }
39
-
40
- /**
41
- * Resource represents the entity producing telemetry
42
- */
43
- export interface Resource {
44
- attributes?: KeyValue[];
45
- droppedAttributesCount?: number;
46
- }
47
-
48
- /**
49
- * InstrumentationScope represents the instrumentation library
50
- */
51
- export interface InstrumentationScope {
52
- name: string;
53
- version?: string;
54
- attributes?: KeyValue[];
55
- droppedAttributesCount?: number;
56
- }
57
-
58
- // ============================================
59
- // Trace Types
60
- // ============================================
61
-
62
- /**
63
- * Root message for trace export
64
- */
65
- export interface ExportTraceServiceRequest {
66
- resourceSpans?: ResourceSpans[];
67
- }
68
-
69
- export interface ResourceSpans {
70
- resource?: Resource;
71
- scopeSpans?: ScopeSpans[];
72
- schemaUrl?: string;
73
- }
74
-
75
- export interface ScopeSpans {
76
- scope?: InstrumentationScope;
77
- spans?: Span[];
78
- schemaUrl?: string;
79
- }
80
-
81
- export interface Span {
82
- traceId: string; // hex encoded 16 bytes
83
- spanId: string; // hex encoded 8 bytes
84
- traceState?: string;
85
- parentSpanId?: string; // hex encoded 8 bytes
86
- flags?: number;
87
- name: string;
88
- kind?: SpanKind;
89
- startTimeUnixNano: string; // uint64 as string
90
- endTimeUnixNano: string; // uint64 as string
91
- attributes?: KeyValue[];
92
- droppedAttributesCount?: number;
93
- events?: SpanEvent[];
94
- droppedEventsCount?: number;
95
- links?: SpanLink[];
96
- droppedLinksCount?: number;
97
- status?: SpanStatus;
98
- }
99
-
100
- export enum SpanKind {
101
- SPAN_KIND_UNSPECIFIED = 0,
102
- SPAN_KIND_INTERNAL = 1,
103
- SPAN_KIND_SERVER = 2,
104
- SPAN_KIND_CLIENT = 3,
105
- SPAN_KIND_PRODUCER = 4,
106
- SPAN_KIND_CONSUMER = 5,
107
- }
108
-
109
- export interface SpanEvent {
110
- timeUnixNano: string;
111
- name: string;
112
- attributes?: KeyValue[];
113
- droppedAttributesCount?: number;
114
- }
115
-
116
- export interface SpanLink {
117
- traceId: string;
118
- spanId: string;
119
- traceState?: string;
120
- attributes?: KeyValue[];
121
- droppedAttributesCount?: number;
122
- flags?: number;
123
- }
124
-
125
- export interface SpanStatus {
126
- message?: string;
127
- code?: SpanStatusCode;
128
- }
129
-
130
- export enum SpanStatusCode {
131
- STATUS_CODE_UNSET = 0,
132
- STATUS_CODE_OK = 1,
133
- STATUS_CODE_ERROR = 2,
134
- }
135
-
136
- // ============================================
137
- // Log Types
138
- // ============================================
139
-
140
- /**
141
- * Root message for log export
142
- */
143
- export interface ExportLogsServiceRequest {
144
- resourceLogs?: ResourceLogs[];
145
- }
146
-
147
- export interface ResourceLogs {
148
- resource?: Resource;
149
- scopeLogs?: ScopeLogs[];
150
- schemaUrl?: string;
151
- }
152
-
153
- export interface ScopeLogs {
154
- scope?: InstrumentationScope;
155
- logRecords?: LogRecord[];
156
- schemaUrl?: string;
157
- }
158
-
159
- export interface LogRecord {
160
- timeUnixNano?: string;
161
- observedTimeUnixNano: string;
162
- severityNumber?: SeverityNumber;
163
- severityText?: string;
164
- body?: AnyValue;
165
- attributes?: KeyValue[];
166
- droppedAttributesCount?: number;
167
- flags?: number;
168
- traceId?: string;
169
- spanId?: string;
170
- }
171
-
172
- export enum SeverityNumber {
173
- SEVERITY_NUMBER_UNSPECIFIED = 0,
174
- SEVERITY_NUMBER_TRACE = 1,
175
- SEVERITY_NUMBER_TRACE2 = 2,
176
- SEVERITY_NUMBER_TRACE3 = 3,
177
- SEVERITY_NUMBER_TRACE4 = 4,
178
- SEVERITY_NUMBER_DEBUG = 5,
179
- SEVERITY_NUMBER_DEBUG2 = 6,
180
- SEVERITY_NUMBER_DEBUG3 = 7,
181
- SEVERITY_NUMBER_DEBUG4 = 8,
182
- SEVERITY_NUMBER_INFO = 9,
183
- SEVERITY_NUMBER_INFO2 = 10,
184
- SEVERITY_NUMBER_INFO3 = 11,
185
- SEVERITY_NUMBER_INFO4 = 12,
186
- SEVERITY_NUMBER_WARN = 13,
187
- SEVERITY_NUMBER_WARN2 = 14,
188
- SEVERITY_NUMBER_WARN3 = 15,
189
- SEVERITY_NUMBER_WARN4 = 16,
190
- SEVERITY_NUMBER_ERROR = 17,
191
- SEVERITY_NUMBER_ERROR2 = 18,
192
- SEVERITY_NUMBER_ERROR3 = 19,
193
- SEVERITY_NUMBER_ERROR4 = 20,
194
- SEVERITY_NUMBER_FATAL = 21,
195
- SEVERITY_NUMBER_FATAL2 = 22,
196
- SEVERITY_NUMBER_FATAL3 = 23,
197
- SEVERITY_NUMBER_FATAL4 = 24,
198
- }
199
-
200
- // ============================================
201
- // Metrics Types
202
- // ============================================
203
-
204
- /**
205
- * Root message for metrics export
206
- */
207
- export interface ExportMetricsServiceRequest {
208
- resourceMetrics?: ResourceMetrics[];
209
- }
210
-
211
- export interface ResourceMetrics {
212
- resource?: Resource;
213
- scopeMetrics?: ScopeMetrics[];
214
- schemaUrl?: string;
215
- }
216
-
217
- export interface ScopeMetrics {
218
- scope?: InstrumentationScope;
219
- metrics?: Metric[];
220
- schemaUrl?: string;
221
- }
222
-
223
- export interface Metric {
224
- name: string;
225
- description?: string;
226
- unit?: string;
227
- metadata?: KeyValue[];
228
- gauge?: Gauge;
229
- sum?: Sum;
230
- histogram?: Histogram;
231
- exponentialHistogram?: ExponentialHistogram;
232
- summary?: Summary;
233
- }
234
-
235
- export interface Gauge {
236
- dataPoints: NumberDataPoint[];
237
- }
238
-
239
- export interface Sum {
240
- dataPoints: NumberDataPoint[];
241
- aggregationTemporality: AggregationTemporality;
242
- isMonotonic?: boolean;
243
- }
244
-
245
- export interface Histogram {
246
- dataPoints: HistogramDataPoint[];
247
- aggregationTemporality: AggregationTemporality;
248
- }
249
-
250
- export interface ExponentialHistogram {
251
- dataPoints: ExponentialHistogramDataPoint[];
252
- aggregationTemporality: AggregationTemporality;
253
- }
254
-
255
- export interface Summary {
256
- dataPoints: SummaryDataPoint[];
257
- }
258
-
259
- export enum AggregationTemporality {
260
- AGGREGATION_TEMPORALITY_UNSPECIFIED = 0,
261
- AGGREGATION_TEMPORALITY_DELTA = 1,
262
- AGGREGATION_TEMPORALITY_CUMULATIVE = 2,
263
- }
264
-
265
- export interface NumberDataPoint {
266
- attributes?: KeyValue[];
267
- startTimeUnixNano?: string;
268
- timeUnixNano: string;
269
- asDouble?: number;
270
- asInt?: string;
271
- exemplars?: Exemplar[];
272
- flags?: number;
273
- }
274
-
275
- export interface HistogramDataPoint {
276
- attributes?: KeyValue[];
277
- startTimeUnixNano?: string;
278
- timeUnixNano: string;
279
- count: string;
280
- sum?: number;
281
- bucketCounts?: string[];
282
- explicitBounds?: number[];
283
- exemplars?: Exemplar[];
284
- flags?: number;
285
- min?: number;
286
- max?: number;
287
- }
288
-
289
- export interface ExponentialHistogramDataPoint {
290
- attributes?: KeyValue[];
291
- startTimeUnixNano?: string;
292
- timeUnixNano: string;
293
- count: string;
294
- sum?: number;
295
- scale?: number;
296
- zeroCount?: string;
297
- positive?: Buckets;
298
- negative?: Buckets;
299
- flags?: number;
300
- exemplars?: Exemplar[];
301
- min?: number;
302
- max?: number;
303
- zeroThreshold?: number;
304
- }
305
-
306
- export interface Buckets {
307
- offset?: number;
308
- bucketCounts?: string[];
309
- }
310
-
311
- export interface SummaryDataPoint {
312
- attributes?: KeyValue[];
313
- startTimeUnixNano?: string;
314
- timeUnixNano: string;
315
- count: string;
316
- sum?: number;
317
- quantileValues?: ValueAtQuantile[];
318
- flags?: number;
319
- }
320
-
321
- export interface ValueAtQuantile {
322
- quantile: number;
323
- value: number;
324
- }
325
-
326
- export interface Exemplar {
327
- filteredAttributes?: KeyValue[];
328
- timeUnixNano: string;
329
- asDouble?: number;
330
- asInt?: string;
331
- spanId?: string;
332
- traceId?: string;
333
- }
334
-
335
- // ============================================
336
- // Response Types
337
- // ============================================
338
-
339
- export interface ExportTraceServiceResponse {
340
- partialSuccess?: ExportTracePartialSuccess;
341
- }
342
-
343
- export interface ExportTracePartialSuccess {
344
- rejectedSpans?: string;
345
- errorMessage?: string;
346
- }
347
-
348
- export interface ExportLogsServiceResponse {
349
- partialSuccess?: ExportLogsPartialSuccess;
350
- }
351
-
352
- export interface ExportLogsPartialSuccess {
353
- rejectedLogRecords?: string;
354
- errorMessage?: string;
355
- }
356
-
357
- export interface ExportMetricsServiceResponse {
358
- partialSuccess?: ExportMetricsPartialSuccess;
359
- }
360
-
361
- export interface ExportMetricsPartialSuccess {
362
- rejectedDataPoints?: string;
363
- errorMessage?: string;
364
- }
package/src/redact.ts DELETED
@@ -1,116 +0,0 @@
1
- import { DEFAULT_REDACT_PATHS as BASE_REDACT_PATHS } from '@geekmidas/logger/redact';
2
- import pinoRedact from '@pinojs/redact';
3
- import type { TelescopeRedactOptions } from './types';
4
-
5
- /**
6
- * Telescope-specific redaction paths for HTTP request/response data.
7
- * These extend the base paths from @geekmidas/logger.
8
- */
9
- const TELESCOPE_SPECIFIC_PATHS: string[] = [
10
- // Response headers (telescope-specific)
11
- 'responseHeaders.set-cookie',
12
- 'responseHeaders.Set-Cookie',
13
-
14
- // Request body fields
15
- 'body.password',
16
- 'body.token',
17
- 'body.accessToken',
18
- 'body.refreshToken',
19
- 'body.apiKey',
20
- 'body.secret',
21
- 'body.creditCard',
22
- 'body.cardNumber',
23
- 'body.cvv',
24
- 'body.ssn',
25
-
26
- // Nested body patterns (wildcards)
27
- 'body.*.password',
28
- 'body.*.token',
29
- 'body.*.secret',
30
- 'body.*.apiKey',
31
-
32
- // Response body fields
33
- 'responseBody.password',
34
- 'responseBody.token',
35
- 'responseBody.accessToken',
36
- 'responseBody.refreshToken',
37
- 'responseBody.secret',
38
- 'responseBody.*.password',
39
- 'responseBody.*.token',
40
- 'responseBody.*.secret',
41
-
42
- // Query parameters
43
- 'query.token',
44
- 'query.api_key',
45
- 'query.apiKey',
46
- 'query.access_token',
47
- 'query.secret',
48
-
49
- // Log context patterns
50
- 'context.password',
51
- 'context.token',
52
- 'context.secret',
53
- 'context.apiKey',
54
- 'context.*.password',
55
- 'context.*.token',
56
- 'context.*.secret',
57
- ];
58
-
59
- /**
60
- * Combined default paths for Telescope redaction.
61
- * Includes base paths from @geekmidas/logger plus telescope-specific HTTP paths.
62
- */
63
- export const DEFAULT_REDACT_PATHS: string[] = [
64
- ...BASE_REDACT_PATHS,
65
- ...TELESCOPE_SPECIFIC_PATHS,
66
- ];
67
-
68
- /**
69
- * Type for the redactor function returned by @pinojs/redact
70
- */
71
- export type Redactor = <T>(obj: T) => T;
72
-
73
- /**
74
- * Creates a redactor function based on the provided options.
75
- *
76
- * @param options - Redaction configuration
77
- * @returns A redactor function, or undefined if redaction is disabled
78
- *
79
- * @example
80
- * const redactor = createRedactor(true);
81
- * const safe = redactor({ headers: { authorization: 'Bearer secret' } });
82
- * // safe.headers.authorization === '[REDACTED]'
83
- */
84
- export function createRedactor(
85
- options: TelescopeRedactOptions | undefined,
86
- ): Redactor | undefined {
87
- if (options === undefined || options === false) {
88
- return undefined;
89
- }
90
-
91
- let paths: string[];
92
- let censor: string = '[REDACTED]';
93
-
94
- if (options === true) {
95
- // Use defaults only
96
- paths = DEFAULT_REDACT_PATHS;
97
- } else if (Array.isArray(options)) {
98
- // Merge custom paths with defaults
99
- paths = [...DEFAULT_REDACT_PATHS, ...options];
100
- } else {
101
- // Object configuration
102
- paths = [...DEFAULT_REDACT_PATHS, ...options.paths];
103
- if (options.censor !== undefined) {
104
- censor = options.censor;
105
- }
106
- }
107
-
108
- // Create the redactor with serialize: false to return objects
109
- const redact = pinoRedact({
110
- paths,
111
- censor,
112
- serialize: false,
113
- });
114
-
115
- return redact as Redactor;
116
- }