@sebspark/otel 1.1.4 → 2.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/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@sebspark/otel",
3
- "version": "1.1.4",
3
+ "version": "2.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
+ "type": "module",
7
8
  "types": "dist/index.d.ts",
8
9
  "files": [
9
10
  "dist"
10
11
  ],
11
12
  "scripts": {
12
- "build": "tsup-node src/index.ts --format esm,cjs --dts",
13
+ "build": "tsup-node src/index.ts --format esm --target node22 --dts",
13
14
  "dev": "tsc --watch --noEmit",
14
15
  "lint": "biome check .",
15
16
  "test": "vitest run --passWithNoTests --coverage",
package/dist/index.d.mts DELETED
@@ -1,76 +0,0 @@
1
- import * as _opentelemetry_api from '@opentelemetry/api';
2
- import { trace, SpanOptions } from '@opentelemetry/api';
3
- export { Context, Counter, Gauge, Histogram, Meter, ObservableCounter, ObservableGauge, ObservableUpDownCounter, Span, SpanStatus, SpanStatusCode, UpDownCounter, context } from '@opentelemetry/api';
4
- import { Instrumentation } from '@opentelemetry/instrumentation';
5
- import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns';
6
- import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
7
- import { FsInstrumentation } from '@opentelemetry/instrumentation-fs';
8
- import { GrpcInstrumentation } from '@opentelemetry/instrumentation-grpc';
9
- import { NetInstrumentation } from '@opentelemetry/instrumentation-net';
10
- import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';
11
- import { SocketIoInstrumentation } from '@opentelemetry/instrumentation-socket.io';
12
- import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
13
-
14
- declare const instrumentations: {
15
- readonly http: Instrumentation;
16
- readonly express: ExpressInstrumentation;
17
- readonly grpc: GrpcInstrumentation;
18
- readonly redis: RedisInstrumentation;
19
- readonly dns: DnsInstrumentation;
20
- readonly net: NetInstrumentation;
21
- readonly fs: FsInstrumentation;
22
- readonly undici: UndiciInstrumentation;
23
- readonly socketIo: SocketIoInstrumentation;
24
- };
25
-
26
- type Attrs = Record<string, any>;
27
- type Logger = ReturnType<typeof getLogger>;
28
- declare function getLogger(serviceOverride?: string, extraAttrs?: Attrs): {
29
- debug: (msg: string, attrs?: Attrs) => void;
30
- info: (msg: string, attrs?: Attrs) => void;
31
- notice: (msg: string, attrs?: Attrs) => void;
32
- warn: (msg: string, attrs?: Attrs) => void;
33
- error: (msg: string | Error, errOrAttrs?: Error | Attrs, maybeAttrs?: Attrs) => void;
34
- critical: (msg: string, attrs?: Attrs) => void;
35
- alert: (msg: string, attrs?: Attrs) => void;
36
- emergency: (msg: string, attrs?: Attrs) => void;
37
- };
38
-
39
- declare function getMeter(componentNameOverride?: string): _opentelemetry_api.Meter;
40
-
41
- declare function initialize(...instrumentations: Instrumentation[]): Promise<void>;
42
- declare function isInitialized(): boolean;
43
-
44
- type OtelTracer = ReturnType<typeof trace.getTracer>;
45
- type Span = ReturnType<OtelTracer['startSpan']>;
46
- type Func<T> = (span: Span) => Promise<T> | T;
47
- type SyncFunc<T> = (span: Span) => T;
48
- type WithTrace = {
49
- <T>(name: string, fn: Func<T>): Promise<T>;
50
- <T>(name: string, options: SpanOptions, fn: Func<T>): Promise<T>;
51
- <T>(name: string, parent: Span, fn: Func<T>): Promise<T>;
52
- <T>(name: string, options: SpanOptions, parent: Span, fn: Func<T>): Promise<T>;
53
- };
54
- type WithTraceSync = {
55
- <T>(name: string, fn: SyncFunc<T>): T;
56
- <T>(name: string, options: SpanOptions, fn: SyncFunc<T>): T;
57
- <T>(name: string, parent: Span, fn: SyncFunc<T>): T;
58
- <T>(name: string, options: SpanOptions, parent: Span, fn: SyncFunc<T>): T;
59
- };
60
- /**
61
- * Extended tracer with helper methods for span-wrapped execution
62
- */
63
- interface Tracer extends OtelTracer {
64
- withTrace: WithTrace;
65
- withTraceSync: WithTraceSync;
66
- }
67
- /**
68
- * Returns an OpenTelemetry tracer bound to the current service.
69
- * Includes `withTrace()` and `withTraceSync()` helpers for span-wrapped execution.
70
- *
71
- * @param serviceOverride - Optional override for service name
72
- * @returns Tracer with helpers
73
- */
74
- declare function getTracer(componentNameOverride?: string): Tracer;
75
-
76
- export { type Logger, getLogger, getMeter, getTracer, initialize, instrumentations, isInitialized };