@elysia/opentelemetry 1.4.12 → 2.0.0-exp.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/bun.lock +98 -246
- package/dist/index.d.ts +72 -84
- package/dist/index.js +511 -0
- package/dist/index.mjs +489 -663
- package/package.json +8 -12
- package/bunfig.toml +0 -2
- package/dist/cjs/index.d.ts +0 -98
- package/dist/cjs/index.js +0 -701
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysia/opentelemetry",
|
|
3
3
|
"description": "Elysia plugin to integrate OpenTelemetry",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-exp.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "bun run --watch example/index.ts",
|
|
@@ -15,15 +15,11 @@
|
|
|
15
15
|
"url": "https://github.com/SaltyAom",
|
|
16
16
|
"email": "saltyaom@gmail.com"
|
|
17
17
|
},
|
|
18
|
-
"publishConfig": {
|
|
19
|
-
"access": "public",
|
|
20
|
-
"provenance": true
|
|
21
|
-
},
|
|
22
18
|
"repository": {
|
|
23
19
|
"type": "git",
|
|
24
20
|
"url": "https://github.com/elysiajs/opentelemetry"
|
|
25
21
|
},
|
|
26
|
-
"main": "./dist/
|
|
22
|
+
"main": "./dist/index.js",
|
|
27
23
|
"module": "./dist/index.mjs",
|
|
28
24
|
"types": "./dist/index.d.ts",
|
|
29
25
|
"exports": {
|
|
@@ -31,7 +27,7 @@
|
|
|
31
27
|
".": {
|
|
32
28
|
"types": "./dist/index.d.ts",
|
|
33
29
|
"import": "./dist/index.mjs",
|
|
34
|
-
"require": "./dist/
|
|
30
|
+
"require": "./dist/index.js"
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
"keywords": [
|
|
@@ -46,8 +42,8 @@
|
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
44
|
"@axiomhq/js": "^1.3.1",
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
45
|
+
"@elysia/eden": "^1.4.10",
|
|
46
|
+
"@elysia/graphql-yoga": "^1.4.1",
|
|
51
47
|
"@envelop/core": "^5.2.3",
|
|
52
48
|
"@envelop/opentelemetry": "^7.1.3",
|
|
53
49
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|
|
@@ -59,13 +55,13 @@
|
|
|
59
55
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
60
56
|
"@opentelemetry/sdk-trace-web": "^2.0.0",
|
|
61
57
|
"@types/bun": "^1.3.3",
|
|
62
|
-
"elysia": "
|
|
58
|
+
"elysia": "2.0.0-exp.14",
|
|
63
59
|
"eslint": "9.25.1",
|
|
64
|
-
"
|
|
60
|
+
"tsdown": "^0.22.3",
|
|
65
61
|
"typescript": "^5.8.3"
|
|
66
62
|
},
|
|
67
63
|
"peerDependencies": {
|
|
68
|
-
"elysia": ">=
|
|
64
|
+
"elysia": ">= 2.0.0-exp.14"
|
|
69
65
|
},
|
|
70
66
|
"peerDependenciesMeta": {
|
|
71
67
|
"graphql": {
|
package/bunfig.toml
DELETED
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Elysia } from 'elysia';
|
|
2
|
-
import { type ContextManager, type Context, type SpanOptions, type Span, type Attributes, TraceAPI, TracerProvider } from '@opentelemetry/api';
|
|
3
|
-
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
4
|
-
type OpenTeleMetryOptions = NonNullable<ConstructorParameters<typeof NodeSDK>[0]>;
|
|
5
|
-
/**
|
|
6
|
-
* Initialize OpenTelemetry SDK
|
|
7
|
-
*
|
|
8
|
-
* For best practice, you should be using preload OpenTelemetry SDK if possible
|
|
9
|
-
* however, this is a simple way to initialize OpenTelemetry SDK
|
|
10
|
-
*/
|
|
11
|
-
export interface ElysiaOpenTelemetryOptions extends OpenTeleMetryOptions {
|
|
12
|
-
contextManager?: ContextManager;
|
|
13
|
-
/**
|
|
14
|
-
* Optional function to determine whether a given request should be traced.
|
|
15
|
-
*
|
|
16
|
-
* @param req - The incoming request object to evaluate.
|
|
17
|
-
* @returns A boolean indicating whether tracing should be enabled for this request.
|
|
18
|
-
*/
|
|
19
|
-
checkIfShouldTrace?: (req: Request) => boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Redact `userinfo` and sensitive query values in `url.full` / `url.query`.
|
|
22
|
-
* Omitted: default redaction. `false`: record raw URLs (may leak secrets in query or credentials).
|
|
23
|
-
*/
|
|
24
|
-
spanUrlRedaction?: false | {
|
|
25
|
-
stripCredentials?: boolean;
|
|
26
|
-
sensitiveQueryParams?: string[];
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Record full request/response body content on spans.
|
|
30
|
-
* `true`: record both request and response bodies.
|
|
31
|
-
* `{ request: true }` or `{ response: true }`: record only one side.
|
|
32
|
-
* Default: `false` (no body content recorded).
|
|
33
|
-
*/
|
|
34
|
-
recordBody?: boolean | {
|
|
35
|
-
request?: boolean;
|
|
36
|
-
response?: boolean;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* HTTP header names (case-insensitive) to capture as span attributes.
|
|
40
|
-
* Use `"*"` in either list to capture all headers (useful for dev/debugging; may include sensitive values).
|
|
41
|
-
* Including `"cookie"` in `requestHeaders` also emits `http.request.cookie` when `context.cookie` exists.
|
|
42
|
-
* Default: none (no headers recorded).
|
|
43
|
-
*/
|
|
44
|
-
headersToSpanAttributes?: {
|
|
45
|
-
request?: string[];
|
|
46
|
-
response?: string[];
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export type ActiveSpanArgs<F extends (span: Span) => unknown = (span: Span) => unknown> = [name: string, fn: F] | [name: string, options: SpanOptions, fn: F] | [name: string, options: SpanOptions, context: Context, fn: F];
|
|
50
|
-
export declare const shouldStartNodeSDK: (provider: TracerProvider) => boolean;
|
|
51
|
-
export type Tracer = ReturnType<TraceAPI['getTracer']>;
|
|
52
|
-
export type StartSpan = Tracer['startSpan'];
|
|
53
|
-
export type StartActiveSpan = Tracer['startActiveSpan'];
|
|
54
|
-
export declare const contextKeySpan: unique symbol;
|
|
55
|
-
export declare const getTracer: () => ReturnType<TraceAPI["getTracer"]>;
|
|
56
|
-
export declare const startSpan: (name: string, options?: SpanOptions, context?: Context) => Span;
|
|
57
|
-
export declare const startActiveSpan: StartActiveSpan;
|
|
58
|
-
export declare const record: {
|
|
59
|
-
<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
|
|
60
|
-
<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
|
|
61
|
-
<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
62
|
-
};
|
|
63
|
-
export declare const getCurrentSpan: () => Span | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Set attributes to the current span
|
|
66
|
-
*
|
|
67
|
-
* @returns boolean - whether the attributes are set or not
|
|
68
|
-
*/
|
|
69
|
-
export declare const setAttributes: (attributes: Attributes) => boolean;
|
|
70
|
-
export declare const opentelemetry: ({ serviceName, instrumentations, contextManager, checkIfShouldTrace, spanUrlRedaction, recordBody, headersToSpanAttributes, ...options }?: ElysiaOpenTelemetryOptions) => Elysia<"", {
|
|
71
|
-
decorator: {};
|
|
72
|
-
store: {};
|
|
73
|
-
derive: {};
|
|
74
|
-
resolve: {};
|
|
75
|
-
}, {
|
|
76
|
-
typebox: {};
|
|
77
|
-
error: {};
|
|
78
|
-
}, {
|
|
79
|
-
schema: {};
|
|
80
|
-
standaloneSchema: {};
|
|
81
|
-
macro: {};
|
|
82
|
-
macroFn: {};
|
|
83
|
-
parser: {};
|
|
84
|
-
response: {};
|
|
85
|
-
}, {}, {
|
|
86
|
-
derive: {};
|
|
87
|
-
resolve: {};
|
|
88
|
-
schema: {};
|
|
89
|
-
standaloneSchema: {};
|
|
90
|
-
response: {};
|
|
91
|
-
}, {
|
|
92
|
-
derive: {};
|
|
93
|
-
resolve: {};
|
|
94
|
-
schema: {};
|
|
95
|
-
standaloneSchema: {};
|
|
96
|
-
response: {};
|
|
97
|
-
}>;
|
|
98
|
-
export {};
|