@elysia/opentelemetry 1.4.11 → 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/README.md +27 -2
- package/bun.lock +98 -246
- package/dist/index.d.ts +72 -56
- package/dist/index.js +511 -0
- package/dist/index.mjs +491 -595
- package/package.json +10 -13
- package/dist/cjs/index.d.ts +0 -70
- package/dist/cjs/index.js +0 -632
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysia/opentelemetry",
|
|
3
|
-
"
|
|
3
|
+
"description": "Elysia plugin to integrate OpenTelemetry",
|
|
4
|
+
"version": "2.0.0-exp.0",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"dev": "bun run --watch example/index.ts",
|
|
@@ -14,15 +15,11 @@
|
|
|
14
15
|
"url": "https://github.com/SaltyAom",
|
|
15
16
|
"email": "saltyaom@gmail.com"
|
|
16
17
|
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public",
|
|
19
|
-
"provenance": true
|
|
20
|
-
},
|
|
21
18
|
"repository": {
|
|
22
19
|
"type": "git",
|
|
23
20
|
"url": "https://github.com/elysiajs/opentelemetry"
|
|
24
21
|
},
|
|
25
|
-
"main": "./dist/
|
|
22
|
+
"main": "./dist/index.js",
|
|
26
23
|
"module": "./dist/index.mjs",
|
|
27
24
|
"types": "./dist/index.d.ts",
|
|
28
25
|
"exports": {
|
|
@@ -30,13 +27,13 @@
|
|
|
30
27
|
".": {
|
|
31
28
|
"types": "./dist/index.d.ts",
|
|
32
29
|
"import": "./dist/index.mjs",
|
|
33
|
-
"require": "./dist/
|
|
30
|
+
"require": "./dist/index.js"
|
|
34
31
|
}
|
|
35
32
|
},
|
|
36
33
|
"keywords": [
|
|
37
34
|
"elysia",
|
|
38
35
|
"opentelemetry",
|
|
39
|
-
"
|
|
36
|
+
"otel"
|
|
40
37
|
],
|
|
41
38
|
"dependencies": {
|
|
42
39
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -45,8 +42,8 @@
|
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
44
|
"@axiomhq/js": "^1.3.1",
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
45
|
+
"@elysia/eden": "^1.4.10",
|
|
46
|
+
"@elysia/graphql-yoga": "^1.4.1",
|
|
50
47
|
"@envelop/core": "^5.2.3",
|
|
51
48
|
"@envelop/opentelemetry": "^7.1.3",
|
|
52
49
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|
|
@@ -58,13 +55,13 @@
|
|
|
58
55
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
59
56
|
"@opentelemetry/sdk-trace-web": "^2.0.0",
|
|
60
57
|
"@types/bun": "^1.3.3",
|
|
61
|
-
"elysia": "
|
|
58
|
+
"elysia": "2.0.0-exp.14",
|
|
62
59
|
"eslint": "9.25.1",
|
|
63
|
-
"
|
|
60
|
+
"tsdown": "^0.22.3",
|
|
64
61
|
"typescript": "^5.8.3"
|
|
65
62
|
},
|
|
66
63
|
"peerDependencies": {
|
|
67
|
-
"elysia": ">=
|
|
64
|
+
"elysia": ">= 2.0.0-exp.14"
|
|
68
65
|
},
|
|
69
66
|
"peerDependenciesMeta": {
|
|
70
67
|
"graphql": {
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,70 +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
|
-
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];
|
|
22
|
-
export declare const shouldStartNodeSDK: (provider: TracerProvider) => boolean;
|
|
23
|
-
export type Tracer = ReturnType<TraceAPI['getTracer']>;
|
|
24
|
-
export type StartSpan = Tracer['startSpan'];
|
|
25
|
-
export type StartActiveSpan = Tracer['startActiveSpan'];
|
|
26
|
-
export declare const contextKeySpan: unique symbol;
|
|
27
|
-
export declare const getTracer: () => ReturnType<TraceAPI["getTracer"]>;
|
|
28
|
-
export declare const startSpan: (name: string, options?: SpanOptions, context?: Context) => Span;
|
|
29
|
-
export declare const startActiveSpan: StartActiveSpan;
|
|
30
|
-
export declare const record: {
|
|
31
|
-
<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
|
|
32
|
-
<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
|
|
33
|
-
<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
34
|
-
};
|
|
35
|
-
export declare const getCurrentSpan: () => Span | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Set attributes to the current span
|
|
38
|
-
*
|
|
39
|
-
* @returns boolean - whether the attributes are set or not
|
|
40
|
-
*/
|
|
41
|
-
export declare const setAttributes: (attributes: Attributes) => boolean;
|
|
42
|
-
export declare const opentelemetry: ({ serviceName, instrumentations, contextManager, checkIfShouldTrace, ...options }?: ElysiaOpenTelemetryOptions) => Elysia<"", {
|
|
43
|
-
decorator: {};
|
|
44
|
-
store: {};
|
|
45
|
-
derive: {};
|
|
46
|
-
resolve: {};
|
|
47
|
-
}, {
|
|
48
|
-
typebox: {};
|
|
49
|
-
error: {};
|
|
50
|
-
}, {
|
|
51
|
-
schema: {};
|
|
52
|
-
standaloneSchema: {};
|
|
53
|
-
macro: {};
|
|
54
|
-
macroFn: {};
|
|
55
|
-
parser: {};
|
|
56
|
-
response: {};
|
|
57
|
-
}, {}, {
|
|
58
|
-
derive: {};
|
|
59
|
-
resolve: {};
|
|
60
|
-
schema: {};
|
|
61
|
-
standaloneSchema: {};
|
|
62
|
-
response: {};
|
|
63
|
-
}, {
|
|
64
|
-
derive: {};
|
|
65
|
-
resolve: {};
|
|
66
|
-
schema: {};
|
|
67
|
-
standaloneSchema: {};
|
|
68
|
-
response: {};
|
|
69
|
-
}>;
|
|
70
|
-
export {};
|