@sebspark/otel 2.0.6 → 2.0.8
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/dist/index.d.mts +74 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +740 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/index.d.ts +0 -69
- package/dist/index.js +0 -965
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as _opentelemetry_api0 from "@opentelemetry/api";
|
|
2
|
+
import { Context, Counter, Gauge, Histogram, Meter, ObservableCounter, ObservableGauge, ObservableUpDownCounter, Span, SpanOptions, SpanStatus, SpanStatusCode, UpDownCounter, context, trace } from "@opentelemetry/api";
|
|
3
|
+
import * as _opentelemetry_instrumentation0 from "@opentelemetry/instrumentation";
|
|
4
|
+
import { Instrumentation } from "@opentelemetry/instrumentation";
|
|
5
|
+
|
|
6
|
+
//#region src/instrumentations.d.ts
|
|
7
|
+
declare const instrumentations: {
|
|
8
|
+
readonly http: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
9
|
+
readonly express: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
10
|
+
readonly grpc: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
11
|
+
readonly redis: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
12
|
+
readonly dns: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
13
|
+
readonly net: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
14
|
+
readonly fs: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
15
|
+
readonly undici: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
16
|
+
readonly socketIo: Promise<Instrumentation<_opentelemetry_instrumentation0.InstrumentationConfig>>;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/logger.d.ts
|
|
20
|
+
type Attrs = Record<string, any>;
|
|
21
|
+
type Logger = ReturnType<typeof getLogger>;
|
|
22
|
+
declare function getLogger(serviceOverride?: string, extraAttrs?: Attrs): {
|
|
23
|
+
debug: (msg: string, attrs?: Attrs) => void;
|
|
24
|
+
info: (msg: string, attrs?: Attrs) => void;
|
|
25
|
+
notice: (msg: string, attrs?: Attrs) => void;
|
|
26
|
+
warn: (msg: string, attrs?: Attrs) => void;
|
|
27
|
+
error: (msg: string | Error, errOrAttrs?: Error | Attrs, maybeAttrs?: Attrs) => void;
|
|
28
|
+
critical: (msg: string, attrs?: Attrs) => void;
|
|
29
|
+
alert: (msg: string, attrs?: Attrs) => void;
|
|
30
|
+
emergency: (msg: string, attrs?: Attrs) => void;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/metrics.d.ts
|
|
34
|
+
declare function getMeter(componentNameOverride?: string): _opentelemetry_api0.Meter;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/otel.d.ts
|
|
37
|
+
declare function initialize(...instrumentations: Promise<Instrumentation>[]): Promise<void>;
|
|
38
|
+
declare function isInitialized(): boolean;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/tracer.d.ts
|
|
41
|
+
type OtelTracer = ReturnType<typeof trace.getTracer>;
|
|
42
|
+
type Span$1 = ReturnType<OtelTracer['startSpan']>;
|
|
43
|
+
type Func<T> = (span: Span$1) => Promise<T> | T;
|
|
44
|
+
type SyncFunc<T> = (span: Span$1) => T;
|
|
45
|
+
type WithTrace = {
|
|
46
|
+
<T>(name: string, fn: Func<T>): Promise<T>;
|
|
47
|
+
<T>(name: string, options: SpanOptions, fn: Func<T>): Promise<T>;
|
|
48
|
+
<T>(name: string, parent: Span$1, fn: Func<T>): Promise<T>;
|
|
49
|
+
<T>(name: string, options: SpanOptions, parent: Span$1, fn: Func<T>): Promise<T>;
|
|
50
|
+
};
|
|
51
|
+
type WithTraceSync = {
|
|
52
|
+
<T>(name: string, fn: SyncFunc<T>): T;
|
|
53
|
+
<T>(name: string, options: SpanOptions, fn: SyncFunc<T>): T;
|
|
54
|
+
<T>(name: string, parent: Span$1, fn: SyncFunc<T>): T;
|
|
55
|
+
<T>(name: string, options: SpanOptions, parent: Span$1, fn: SyncFunc<T>): T;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Extended tracer with helper methods for span-wrapped execution
|
|
59
|
+
*/
|
|
60
|
+
interface Tracer extends OtelTracer {
|
|
61
|
+
withTrace: WithTrace;
|
|
62
|
+
withTraceSync: WithTraceSync;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns an OpenTelemetry tracer bound to the current service.
|
|
66
|
+
* Includes `withTrace()` and `withTraceSync()` helpers for span-wrapped execution.
|
|
67
|
+
*
|
|
68
|
+
* @param serviceOverride - Optional override for service name
|
|
69
|
+
* @returns Tracer with helpers
|
|
70
|
+
*/
|
|
71
|
+
declare function getTracer(componentNameOverride?: string): Tracer;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { type Context, type Counter, type Gauge, type Histogram, Logger, type Meter, type ObservableCounter, type ObservableGauge, type ObservableUpDownCounter, type Span, type SpanStatus, SpanStatusCode, type UpDownCounter, context, getLogger, getMeter, getTracer, initialize, instrumentations, isInitialized };
|
|
74
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/instrumentations.ts","../src/logger.ts","../src/metrics.ts","../src/otel.ts","../src/tracer.ts"],"sourcesContent":[],"mappings":";;;;;;cAYa;yCAiFH,+BAAA,CAAA,qBAAA;;;;EAjFG,SAAA,GAAA,SAiFH,gBAAA,uDAAA,CAAA;EAAA,SAAA,GAAA,SAAA,gBAAA,uDAAA,CAAA;;;;;;;KCtFL,KAAA,GAAQ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