@geekmidas/telescope 9.0.2 → 10.0.0-alpha.1

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 (122) hide show
  1. package/README.md +14 -4
  2. package/dist/{http-D5kn3_Mt.d.mts → http-BiNtg85L.d.mts} +3 -3
  3. package/dist/{http-D5kn3_Mt.d.mts.map → http-BiNtg85L.d.mts.map} +1 -1
  4. package/dist/instrumentation/http.d.mts +1 -1
  5. package/dist/instrumentation/index.cjs +2 -2
  6. package/dist/instrumentation/index.d.cts +2 -2
  7. package/dist/instrumentation/index.d.mts +3 -3
  8. package/dist/instrumentation/index.mjs +2 -2
  9. package/dist/instrumentation/middleware.cjs +1 -1
  10. package/dist/instrumentation/middleware.d.cts +1 -1
  11. package/dist/instrumentation/middleware.d.mts +1 -1
  12. package/dist/instrumentation/middleware.mjs +1 -1
  13. package/dist/instrumentation/otel.cjs +1 -1
  14. package/dist/instrumentation/otel.d.cts +1 -1
  15. package/dist/instrumentation/otel.d.mts +1 -1
  16. package/dist/instrumentation/otel.mjs +1 -1
  17. package/dist/logger/console.d.cts.map +1 -1
  18. package/dist/logger/pino.d.mts +2 -2
  19. package/dist/{middleware-DqPQpcup.cjs → middleware-Bcq6XXGG.cjs} +2 -2
  20. package/dist/middleware-Bcq6XXGG.cjs.map +1 -0
  21. package/dist/{middleware-4-GrQlOT.mjs → middleware-D1XEHvyy.mjs} +2 -2
  22. package/dist/middleware-D1XEHvyy.mjs.map +1 -0
  23. package/dist/{middleware-CA84nsNN.d.cts → middleware-PeyS-9Ny.d.cts} +2 -2
  24. package/dist/{middleware-CA84nsNN.d.cts.map → middleware-PeyS-9Ny.d.cts.map} +1 -1
  25. package/dist/{middleware-DAceVpfw.d.mts → middleware-oHvo_ZgU.d.mts} +2 -2
  26. package/dist/{middleware-DAceVpfw.d.mts.map → middleware-oHvo_ZgU.d.mts.map} +1 -1
  27. package/dist/{otel-40udNP5g.mjs → otel-B9bNoeZ2.mjs} +3 -3
  28. package/dist/otel-B9bNoeZ2.mjs.map +1 -0
  29. package/dist/{otel-SBVoVEHr.d.cts → otel-Bk89b1lX.d.cts} +3 -3
  30. package/dist/{otel-1bJPb2Z7.d.mts.map → otel-Bk89b1lX.d.cts.map} +1 -1
  31. package/dist/{otel-COrpz_GZ.cjs → otel-BzjOtVxZ.cjs} +3 -3
  32. package/dist/otel-BzjOtVxZ.cjs.map +1 -0
  33. package/dist/{otel-1bJPb2Z7.d.mts → otel-lPMsM26e.d.mts} +3 -3
  34. package/dist/{otel-SBVoVEHr.d.cts.map → otel-lPMsM26e.d.mts.map} +1 -1
  35. package/dist/storage/kysely.cjs +48 -38
  36. package/dist/storage/kysely.cjs.map +1 -1
  37. package/dist/storage/kysely.d.cts +29 -9
  38. package/dist/storage/kysely.d.cts.map +1 -1
  39. package/dist/storage/kysely.d.mts +29 -9
  40. package/dist/storage/kysely.d.mts.map +1 -1
  41. package/dist/storage/kysely.mjs +48 -38
  42. package/dist/storage/kysely.mjs.map +1 -1
  43. package/dist/tracing-PnECEbEu.d.mts.map +1 -1
  44. package/package.json +6 -3
  45. package/CHANGELOG.md +0 -72
  46. package/dist/middleware-4-GrQlOT.mjs.map +0 -1
  47. package/dist/middleware-DqPQpcup.cjs.map +0 -1
  48. package/dist/otel-40udNP5g.mjs.map +0 -1
  49. package/dist/otel-COrpz_GZ.cjs.map +0 -1
  50. package/src/Telescope.ts +0 -561
  51. package/src/__tests__/Telescope.spec.ts +0 -438
  52. package/src/__tests__/pino-transport.spec.ts +0 -115
  53. package/src/__tests__/redact.spec.ts +0 -336
  54. package/src/adapters/__tests__/lambda.spec.ts +0 -318
  55. package/src/adapters/__tests__/middy.spec.ts +0 -741
  56. package/src/adapters/index.ts +0 -22
  57. package/src/adapters/lambda.ts +0 -432
  58. package/src/adapters/middy.ts +0 -402
  59. package/src/adapters/types.ts +0 -181
  60. package/src/core.ts +0 -51
  61. package/src/index.ts +0 -34
  62. package/src/instrumentation/__tests__/core.spec.ts +0 -248
  63. package/src/instrumentation/__tests__/hono.spec.ts +0 -348
  64. package/src/instrumentation/__tests__/middleware.spec.ts +0 -528
  65. package/src/instrumentation/__tests__/otel.spec.ts +0 -291
  66. package/src/instrumentation/__tests__/tracing.spec.ts +0 -208
  67. package/src/instrumentation/core.ts +0 -228
  68. package/src/instrumentation/hono.ts +0 -270
  69. package/src/instrumentation/http.ts +0 -306
  70. package/src/instrumentation/index.ts +0 -90
  71. package/src/instrumentation/middleware.ts +0 -297
  72. package/src/instrumentation/otel.ts +0 -271
  73. package/src/instrumentation/setup.ts +0 -246
  74. package/src/instrumentation/tracing.ts +0 -145
  75. package/src/logger/__tests__/console.spec.ts +0 -366
  76. package/src/logger/__tests__/pino.spec.ts +0 -217
  77. package/src/logger/console.ts +0 -230
  78. package/src/logger/pino.ts +0 -201
  79. package/src/metrics/MetricsAggregator.ts +0 -555
  80. package/src/metrics/__tests__/MetricsAggregator.spec.ts +0 -298
  81. package/src/metrics/index.ts +0 -2
  82. package/src/metrics/storage/InMemoryMetricsStorage.ts +0 -380
  83. package/src/metrics/storage/MetricsStorage.ts +0 -74
  84. package/src/metrics/storage/index.ts +0 -3
  85. package/src/metrics/storage/types.ts +0 -243
  86. package/src/otlp/__tests__/receiver.spec.ts +0 -367
  87. package/src/otlp/__tests__/transformer.spec.ts +0 -455
  88. package/src/otlp/hono.ts +0 -120
  89. package/src/otlp/index.ts +0 -22
  90. package/src/otlp/receiver.ts +0 -162
  91. package/src/otlp/transformer.ts +0 -367
  92. package/src/otlp/types.ts +0 -364
  93. package/src/redact.ts +0 -116
  94. package/src/server/__tests__/hono.spec.ts +0 -814
  95. package/src/server/hono.ts +0 -442
  96. package/src/storage/__tests__/kysely.spec.ts +0 -715
  97. package/src/storage/__tests__/memory.spec.ts +0 -694
  98. package/src/storage/kysely.ts +0 -599
  99. package/src/storage/memory.ts +0 -204
  100. package/src/types.ts +0 -447
  101. package/src/ui-assets.ts +0 -40
  102. package/tsconfig.json +0 -9
  103. package/ui/CHANGELOG.md +0 -7
  104. package/ui/index.html +0 -12
  105. package/ui/node_modules/.bin/tsc +0 -21
  106. package/ui/node_modules/.bin/tsserver +0 -21
  107. package/ui/node_modules/.bin/vite +0 -21
  108. package/ui/package.json +0 -24
  109. package/ui/src/App.tsx +0 -595
  110. package/ui/src/api.ts +0 -88
  111. package/ui/src/components/ExceptionDetail.tsx +0 -100
  112. package/ui/src/components/FilterBar.tsx +0 -162
  113. package/ui/src/components/LogDetail.tsx +0 -91
  114. package/ui/src/components/RequestDetail.tsx +0 -143
  115. package/ui/src/main.tsx +0 -10
  116. package/ui/src/styles.css +0 -11
  117. package/ui/src/types.ts +0 -63
  118. package/ui/src/vite-env.d.ts +0 -1
  119. package/ui/src/vite-plugin-gkm-config.ts +0 -54
  120. package/ui/tsconfig.json +0 -20
  121. package/ui/tsconfig.tsbuildinfo +0 -1
  122. 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
- }