@zerotal/telemetry 1.9.0 → 1.11.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/api-surface.md +14 -14
- package/package.json +2 -2
- package/src/Tracer.ts +4 -4
- package/src/config.ts +10 -8
- package/src/exporters/OtlpExporter.ts +4 -4
- package/src/middleware/TelemetryMiddleware.ts +1 -1
package/api-surface.md
CHANGED
|
@@ -81,10 +81,10 @@ function TelemetryConfig = (options?: Partial<TelemetryConfigShape>) => Telemetr
|
|
|
81
81
|
function withSpan = <T>(name: string, fn: (span: Span) => Promise<T>, options?: SpanOptions) => Promise<T>
|
|
82
82
|
|
|
83
83
|
interface OtlpExporterOptions = {
|
|
84
|
-
endpoint?: string
|
|
85
|
-
headers?: Record<string, string>
|
|
86
|
-
serviceName?: string
|
|
87
|
-
serviceVersion?: string
|
|
84
|
+
endpoint?: string | undefined
|
|
85
|
+
headers?: Record<string, string> | undefined
|
|
86
|
+
serviceName?: string | undefined
|
|
87
|
+
serviceVersion?: string | undefined
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
interface SpanData = {
|
|
@@ -112,8 +112,8 @@ interface SpanExporter = {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
interface SpanOptions = {
|
|
115
|
-
attributes?: Record<string, string | number | boolean>
|
|
116
|
-
kind?: SpanKind
|
|
115
|
+
attributes?: Record<string, string | number | boolean> | undefined
|
|
116
|
+
kind?: SpanKind | undefined
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
interface SpanStatus = {
|
|
@@ -122,21 +122,21 @@ interface SpanStatus = {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
interface TelemetryConfigShape = {
|
|
125
|
-
exporter?: 'console' | 'noop' | 'otlp'
|
|
126
|
-
minDurationMs?: number
|
|
127
|
-
otlp?: { endpoint?: string; headers?: Record<string, string>;}
|
|
128
|
-
serviceName?: string
|
|
129
|
-
serviceVersion?: string
|
|
125
|
+
exporter?: 'console' | 'noop' | 'otlp' | undefined
|
|
126
|
+
minDurationMs?: number | undefined
|
|
127
|
+
otlp?: { endpoint?: string; headers?: Record<string, string>;} | undefined
|
|
128
|
+
serviceName?: string | undefined
|
|
129
|
+
serviceVersion?: string | undefined
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
interface TelemetryOptions = {
|
|
133
|
-
spanName?: (ctx: HttpContext) => string
|
|
133
|
+
spanName?: ((ctx: HttpContext) => string) | undefined
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
interface TracerOptions = {
|
|
137
137
|
exporter: SpanExporter
|
|
138
|
-
minDurationMs?: number
|
|
139
|
-
rethrowExportErrors?: boolean
|
|
138
|
+
minDurationMs?: number | undefined
|
|
139
|
+
rethrowExportErrors?: boolean | undefined
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
type SpanKind = 'internal' | 'server' | 'client' | 'producer' | 'consumer'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerotal/telemetry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"maturity": "stable",
|
|
6
6
|
"private": false,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@zerotal/core": "1.
|
|
33
|
+
"@zerotal/core": "1.11.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"typescript": "^5.8.0"
|
package/src/Tracer.ts
CHANGED
|
@@ -6,14 +6,14 @@ import type { SpanExporter } from "./exporters/SpanExporter.ts";
|
|
|
6
6
|
export interface TracerOptions {
|
|
7
7
|
exporter: SpanExporter;
|
|
8
8
|
/** Drop spans in which the callback took less than this many ms. Default: 0 (keep all). */
|
|
9
|
-
minDurationMs?: number;
|
|
9
|
+
minDurationMs?: number | undefined;
|
|
10
10
|
/** When true, export() errors are surfaced rather than swallowed. Default: false. */
|
|
11
|
-
rethrowExportErrors?: boolean;
|
|
11
|
+
rethrowExportErrors?: boolean | undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface SpanOptions {
|
|
15
|
-
kind?: SpanKind;
|
|
16
|
-
attributes?: Record<string, string | number | boolean
|
|
15
|
+
kind?: SpanKind | undefined;
|
|
16
|
+
attributes?: Record<string, string | number | boolean> | undefined;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
package/src/config.ts
CHANGED
|
@@ -7,22 +7,24 @@ export interface TelemetryConfigShape {
|
|
|
7
7
|
* - `'console'` - prints to stdout, useful in development
|
|
8
8
|
* - `'otlp'` - sends to an OTLP HTTP endpoint
|
|
9
9
|
*/
|
|
10
|
-
exporter?: "noop" | "console" | "otlp";
|
|
10
|
+
exporter?: "noop" | "console" | "otlp" | undefined;
|
|
11
11
|
|
|
12
12
|
/** Only relevant when `exporter` is `'otlp'`. */
|
|
13
|
-
otlp?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
otlp?:
|
|
14
|
+
| {
|
|
15
|
+
endpoint?: string;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
| undefined;
|
|
17
19
|
|
|
18
20
|
/** Service name sent as a resource attribute. Defaults to `APP_NAME` env var or `'zerotal-app'`. */
|
|
19
|
-
serviceName?: string;
|
|
21
|
+
serviceName?: string | undefined;
|
|
20
22
|
|
|
21
23
|
/** Service version. Defaults to `APP_VERSION` env var or `'0.0.0'`. */
|
|
22
|
-
serviceVersion?: string;
|
|
24
|
+
serviceVersion?: string | undefined;
|
|
23
25
|
|
|
24
26
|
/** Drop spans shorter than this many milliseconds. Default: 0 (keep all). */
|
|
25
|
-
minDurationMs?: number;
|
|
27
|
+
minDurationMs?: number | undefined;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
const defaults: TelemetryConfigShape = {
|
|
@@ -3,13 +3,13 @@ import type { SpanData, SpanKind } from "../Span.ts";
|
|
|
3
3
|
|
|
4
4
|
export interface OtlpExporterOptions {
|
|
5
5
|
/** OTLP HTTP/JSON endpoint. Default: `'http://localhost:4318/v1/traces'`. */
|
|
6
|
-
endpoint?: string;
|
|
6
|
+
endpoint?: string | undefined;
|
|
7
7
|
/** Extra headers (e.g. `{ 'x-honeycomb-team': '<api-key>' }`). */
|
|
8
|
-
headers?: Record<string, string
|
|
8
|
+
headers?: Record<string, string> | undefined;
|
|
9
9
|
/** Service name sent as a resource attribute. */
|
|
10
|
-
serviceName?: string;
|
|
10
|
+
serviceName?: string | undefined;
|
|
11
11
|
/** Service version sent as a resource attribute. */
|
|
12
|
-
serviceVersion?: string;
|
|
12
|
+
serviceVersion?: string | undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const SPAN_KIND: Record<SpanKind, number> = {
|