@pingops/sdk 0.1.0 → 0.1.1
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 +3 -3
- package/dist/config.d.ts +0 -7
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -5
- package/dist/config.js.map +0 -1
- package/dist/initialize.d.ts +0 -20
- package/dist/initialize.d.ts.map +0 -1
- package/dist/initialize.js +0 -86
- package/dist/initialize.js.map +0 -1
- package/dist/instrumentation.d.ts +0 -14
- package/dist/instrumentation.d.ts.map +0 -1
- package/dist/instrumentation.js +0 -76
- package/dist/instrumentation.js.map +0 -1
- package/dist/logger.d.ts +0 -25
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -40
- package/dist/logger.js.map +0 -1
- package/dist/span-wrapper.d.ts +0 -60
- package/dist/span-wrapper.d.ts.map +0 -1
- package/dist/span-wrapper.js +0 -118
- package/dist/span-wrapper.js.map +0 -1
- package/dist/tracer-provider.d.ts +0 -175
- package/dist/tracer-provider.d.ts.map +0 -1
- package/dist/tracer-provider.js +0 -537
- package/dist/tracer-provider.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pingops/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "PingOps SDK for Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@opentelemetry/sdk-node": "^0.208.0",
|
|
27
27
|
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
|
28
28
|
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
29
|
-
"@pingops/otel": "
|
|
30
|
-
"@pingops/core": "
|
|
29
|
+
"@pingops/otel": "0.1.1",
|
|
30
|
+
"@pingops/core": "0.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20.11.0",
|
package/dist/config.d.ts
DELETED
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;CAAG"}
|
package/dist/config.js
DELETED
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/initialize.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initializes PingOps SDK with OpenTelemetry
|
|
3
|
-
*/
|
|
4
|
-
import type { PingopsProcessorConfig } from '@pingops/otel';
|
|
5
|
-
/**
|
|
6
|
-
* Initializes PingOps SDK
|
|
7
|
-
*
|
|
8
|
-
* This function:
|
|
9
|
-
* 1. Creates an OpenTelemetry NodeSDK instance
|
|
10
|
-
* 2. Configures Resource with service.name
|
|
11
|
-
* 3. Registers PingopsSpanProcessor
|
|
12
|
-
* 4. Enables HTTP/fetch/GenAI instrumentation
|
|
13
|
-
* 5. Starts the SDK
|
|
14
|
-
*/
|
|
15
|
-
export declare function initializePingops(config: PingopsProcessorConfig): void;
|
|
16
|
-
/**
|
|
17
|
-
* Shuts down the SDK and flushes remaining spans
|
|
18
|
-
*/
|
|
19
|
-
export declare function shutdownPingops(): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=initialize.d.ts.map
|
package/dist/initialize.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAe5D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CA4DtE;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAWrD"}
|
package/dist/initialize.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initializes PingOps SDK with OpenTelemetry
|
|
3
|
-
*/
|
|
4
|
-
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
5
|
-
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
6
|
-
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
7
|
-
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
8
|
-
import { getInstrumentations } from './instrumentation';
|
|
9
|
-
import { setPingopsTracerProvider, shutdownTracerProvider, PingopsSpanProcessor, } from '@pingops/otel';
|
|
10
|
-
import { createLogger } from '@pingops/core';
|
|
11
|
-
let sdkInstance = null;
|
|
12
|
-
let isInitialized = false;
|
|
13
|
-
const logger = createLogger('[PingOps Initialize]');
|
|
14
|
-
/**
|
|
15
|
-
* Initializes PingOps SDK
|
|
16
|
-
*
|
|
17
|
-
* This function:
|
|
18
|
-
* 1. Creates an OpenTelemetry NodeSDK instance
|
|
19
|
-
* 2. Configures Resource with service.name
|
|
20
|
-
* 3. Registers PingopsSpanProcessor
|
|
21
|
-
* 4. Enables HTTP/fetch/GenAI instrumentation
|
|
22
|
-
* 5. Starts the SDK
|
|
23
|
-
*/
|
|
24
|
-
export function initializePingops(config) {
|
|
25
|
-
if (isInitialized) {
|
|
26
|
-
if (config.debug) {
|
|
27
|
-
logger.warn('[PingOps] SDK already initialized, skipping');
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
// Create resource with service name
|
|
32
|
-
const resource = resourceFromAttributes({
|
|
33
|
-
[ATTR_SERVICE_NAME]: config.serviceName,
|
|
34
|
-
});
|
|
35
|
-
// Create PingopsSpanProcessor
|
|
36
|
-
const processor = new PingopsSpanProcessor(config);
|
|
37
|
-
// Get instrumentations only if autoInstrumentation is enabled (defaults to true)
|
|
38
|
-
const autoInstrumentation = config.autoInstrumentation !== false;
|
|
39
|
-
const instrumentations = autoInstrumentation ? getInstrumentations() : [];
|
|
40
|
-
// Node.js SDK
|
|
41
|
-
const nodeSdk = new NodeSDK({
|
|
42
|
-
resource,
|
|
43
|
-
spanProcessors: [processor],
|
|
44
|
-
instrumentations,
|
|
45
|
-
});
|
|
46
|
-
nodeSdk.start();
|
|
47
|
-
sdkInstance = nodeSdk;
|
|
48
|
-
// Initialize isolated TracerProvider for manual spans AFTER NodeSDK starts
|
|
49
|
-
// This ensures manual spans created via startSpan are processed by the same processor
|
|
50
|
-
// We register it after NodeSDK so it takes precedence as the global provider
|
|
51
|
-
try {
|
|
52
|
-
// In version 2.2.0, span processors are passed in the constructor
|
|
53
|
-
const isolatedProvider = new NodeTracerProvider({
|
|
54
|
-
resource,
|
|
55
|
-
spanProcessors: [processor],
|
|
56
|
-
});
|
|
57
|
-
// Register the provider globally
|
|
58
|
-
isolatedProvider.register();
|
|
59
|
-
// Set it in global state
|
|
60
|
-
setPingopsTracerProvider(isolatedProvider);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
if (config.debug) {
|
|
64
|
-
logger.error('[PingOps] Failed to create isolated TracerProvider:', error instanceof Error ? error.message : String(error));
|
|
65
|
-
}
|
|
66
|
-
// Continue without isolated provider - manual spans will use global provider
|
|
67
|
-
}
|
|
68
|
-
if (config.debug) {
|
|
69
|
-
logger.info('[PingOps] SDK initialized');
|
|
70
|
-
}
|
|
71
|
-
isInitialized = true;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Shuts down the SDK and flushes remaining spans
|
|
75
|
-
*/
|
|
76
|
-
export async function shutdownPingops() {
|
|
77
|
-
// Shutdown isolated TracerProvider first
|
|
78
|
-
await shutdownTracerProvider();
|
|
79
|
-
if (!sdkInstance) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
await sdkInstance.shutdown();
|
|
83
|
-
sdkInstance = null;
|
|
84
|
-
isInitialized = false;
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=initialize.js.map
|
package/dist/initialize.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,IAAI,WAAW,GAAmB,IAAI,CAAC;AACvC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,MAAM,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA8B;IAC9D,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO;IACT,CAAC;IAED,oCAAoC;IACpC,MAAM,QAAQ,GAAG,sBAAsB,CAAC;QACpC,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,WAAW;KACxC,CAAC,CAAC;IAEL,8BAA8B;IAC9B,MAAM,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AAsB,EAAE,CAAC;IAE/B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC7B,WAAW,GAAG,IAAI,CAAC;IACnB,aAAa,GAAG,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Instrumentation setup for HTTP, fetch, undici, and GenAI
|
|
3
|
-
*/
|
|
4
|
-
import type { Instrumentation } from '@opentelemetry/instrumentation';
|
|
5
|
-
/**
|
|
6
|
-
* Registers instrumentations for Node.js environment.
|
|
7
|
-
* This function is idempotent and can be called multiple times safely.
|
|
8
|
-
*
|
|
9
|
-
* Instrumentation behavior:
|
|
10
|
-
* - If global instrumentation is enabled: all HTTP requests are instrumented
|
|
11
|
-
* - If global instrumentation is NOT enabled: only requests within wrapHttp blocks are instrumented
|
|
12
|
-
*/
|
|
13
|
-
export declare function getInstrumentations(): Instrumentation[];
|
|
14
|
-
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAwEvD"}
|
package/dist/instrumentation.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Instrumentation setup for HTTP, fetch, undici, and GenAI
|
|
3
|
-
*/
|
|
4
|
-
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
|
5
|
-
import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
|
|
6
|
-
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
7
|
-
import { context } from '@opentelemetry/api';
|
|
8
|
-
import { PINGOPS_HTTP_ENABLED, normalizeHeaders } from '@pingops/core';
|
|
9
|
-
import { isGlobalInstrumentationEnabled } from './init-state';
|
|
10
|
-
let installed = false;
|
|
11
|
-
/**
|
|
12
|
-
* Registers instrumentations for Node.js environment.
|
|
13
|
-
* This function is idempotent and can be called multiple times safely.
|
|
14
|
-
*
|
|
15
|
-
* Instrumentation behavior:
|
|
16
|
-
* - If global instrumentation is enabled: all HTTP requests are instrumented
|
|
17
|
-
* - If global instrumentation is NOT enabled: only requests within wrapHttp blocks are instrumented
|
|
18
|
-
*/
|
|
19
|
-
export function getInstrumentations() {
|
|
20
|
-
if (installed) {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
registerInstrumentations({
|
|
24
|
-
instrumentations: [
|
|
25
|
-
new HttpInstrumentation({
|
|
26
|
-
ignoreIncomingRequestHook: () => true, // Only instrument outgoing requests
|
|
27
|
-
ignoreOutgoingRequestHook: () => {
|
|
28
|
-
// If global instrumentation is enabled, instrument all outgoing requests
|
|
29
|
-
if (isGlobalInstrumentationEnabled()) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
// If global instrumentation is NOT enabled, only instrument when PINGOPS_HTTP_ENABLED is true
|
|
33
|
-
return context.active().getValue(PINGOPS_HTTP_ENABLED) !== true;
|
|
34
|
-
},
|
|
35
|
-
requestHook: (span, request) => {
|
|
36
|
-
const headers = normalizeHeaders(request.headers);
|
|
37
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
38
|
-
span.setAttribute(`http.request.header.${key.toLowerCase()}`, Array.isArray(value) ? value.join(',') : String(value));
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
responseHook: (span, response) => {
|
|
42
|
-
const headers = normalizeHeaders(response.headers);
|
|
43
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
44
|
-
span.setAttribute(`http.response.header.${key.toLowerCase()}`, Array.isArray(value) ? value.join(',') : String(value));
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
new UndiciInstrumentation({
|
|
49
|
-
enabled: true,
|
|
50
|
-
ignoreRequestHook: () => {
|
|
51
|
-
// If global instrumentation is enabled, instrument all requests
|
|
52
|
-
if (isGlobalInstrumentationEnabled()) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
// If global instrumentation is NOT enabled, only instrument when PINGOPS_HTTP_ENABLED is true
|
|
56
|
-
return context.active().getValue(PINGOPS_HTTP_ENABLED) !== true;
|
|
57
|
-
},
|
|
58
|
-
requestHook: (span, request) => {
|
|
59
|
-
const headers = normalizeHeaders(request.headers);
|
|
60
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
61
|
-
span.setAttribute(`http.request.header.${key.toLowerCase()}`, Array.isArray(value) ? value.join(',') : String(value));
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
responseHook: (span, { response }) => {
|
|
65
|
-
const headers = normalizeHeaders(response.headers);
|
|
66
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
67
|
-
span.setAttribute(`http.response.header.${key.toLowerCase()}`, Array.isArray(value) ? value.join(',') : String(value));
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
71
|
-
],
|
|
72
|
-
});
|
|
73
|
-
installed = true;
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MA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KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;wBACnD,IAAI,CAAC,YAAY,CACf,wBAAwB,GAAG,CAAC,WAAW,EAAE,EAAE,EAC3C,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;oBACJ,CAAC;gBACH,CAAC;aACF,CAAC;SACH;KACF,CAAC,CAAC;IAEH,SAAS,GAAG,IAAI,CAAC;IACjB,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Global logger utility for PingOps SDK
|
|
3
|
-
*
|
|
4
|
-
* Provides consistent logging across all SDK components with support for
|
|
5
|
-
* different log levels and debug mode control via PINGOPS_DEBUG environment variable.
|
|
6
|
-
*/
|
|
7
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
8
|
-
export interface Logger {
|
|
9
|
-
debug(message: string, ...args: unknown[]): void;
|
|
10
|
-
info(message: string, ...args: unknown[]): void;
|
|
11
|
-
warn(message: string, ...args: unknown[]): void;
|
|
12
|
-
error(message: string, ...args: unknown[]): void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Creates a logger instance with a specific prefix
|
|
16
|
-
*
|
|
17
|
-
* @param prefix - Prefix to add to all log messages (e.g., '[PingOps TracerProvider]')
|
|
18
|
-
* @returns Logger instance
|
|
19
|
-
*/
|
|
20
|
-
export declare function createLogger(prefix: string): Logger;
|
|
21
|
-
/**
|
|
22
|
-
* Default logger instance for general SDK logging
|
|
23
|
-
*/
|
|
24
|
-
export declare const logger: Logger;
|
|
25
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAwBnD;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAgC,CAAC"}
|
package/dist/logger.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Global logger utility for PingOps SDK
|
|
3
|
-
*
|
|
4
|
-
* Provides consistent logging across all SDK components with support for
|
|
5
|
-
* different log levels and debug mode control via PINGOPS_DEBUG environment variable.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Creates a logger instance with a specific prefix
|
|
9
|
-
*
|
|
10
|
-
* @param prefix - Prefix to add to all log messages (e.g., '[PingOps TracerProvider]')
|
|
11
|
-
* @returns Logger instance
|
|
12
|
-
*/
|
|
13
|
-
export function createLogger(prefix) {
|
|
14
|
-
const isDebugEnabled = true;
|
|
15
|
-
const formatMessage = (level, message) => {
|
|
16
|
-
const timestamp = new Date().toISOString();
|
|
17
|
-
return `[${timestamp}] ${prefix} [${level.toUpperCase()}] ${message}`;
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
debug(message, ...args) {
|
|
21
|
-
if (isDebugEnabled) {
|
|
22
|
-
console.debug(formatMessage('debug', message), ...args);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
info(message, ...args) {
|
|
26
|
-
console.log(formatMessage('info', message), ...args);
|
|
27
|
-
},
|
|
28
|
-
warn(message, ...args) {
|
|
29
|
-
console.warn(formatMessage('warn', message), ...args);
|
|
30
|
-
},
|
|
31
|
-
error(message, ...args) {
|
|
32
|
-
console.error(formatMessage('error', message), ...args);
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Default logger instance for general SDK logging
|
|
38
|
-
*/
|
|
39
|
-
export const logger = createLogger('[PingOps SDK]');
|
|
40
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,cAAc,GAAG,IAAI,CAAC;IAE5B,MAAM,aAAa,GAAG,CAAC,KAAe,EAAE,OAAe,EAAU,EAAE;QACjE,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3C,OAAO,IAAI,SAAS,KAAK,MAAM,KAAK,KAAK,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE,CAAC;IACxE,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;YACvC,IAAI,cAAc,EAAE,CAAC;gBACnB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;YACtC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;YACtC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;YACvC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/span-wrapper.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Span wrapper for PingOps SDK
|
|
3
|
-
*
|
|
4
|
-
* Provides PingopsSpan class similar to LangfuseSpan for wrapping OpenTelemetry spans
|
|
5
|
-
* with PingOps-specific functionality.
|
|
6
|
-
*/
|
|
7
|
-
import { TimeInput, Span, SpanContext } from '@opentelemetry/api';
|
|
8
|
-
import type { Attributes } from '@opentelemetry/api';
|
|
9
|
-
import type { SpanAttributes } from './tracer-provider';
|
|
10
|
-
/**
|
|
11
|
-
* Base class for PingOps span wrappers
|
|
12
|
-
*
|
|
13
|
-
* Provides common functionality for wrapping OpenTelemetry spans with PingOps-specific features.
|
|
14
|
-
*/
|
|
15
|
-
declare abstract class PingopsBaseSpan {
|
|
16
|
-
/** The underlying OpenTelemetry span */
|
|
17
|
-
readonly otelSpan: Span;
|
|
18
|
-
/** The span ID from the OpenTelemetry span context */
|
|
19
|
-
id: string;
|
|
20
|
-
/** The trace ID from the OpenTelemetry span context */
|
|
21
|
-
traceId: string;
|
|
22
|
-
constructor(otelSpan: Span);
|
|
23
|
-
/**
|
|
24
|
-
* Ends the span, marking it as complete.
|
|
25
|
-
*
|
|
26
|
-
* @param endTime - Optional end time, defaults to current time
|
|
27
|
-
*/
|
|
28
|
-
end(endTime?: TimeInput): void;
|
|
29
|
-
/**
|
|
30
|
-
* Updates the span with new attributes.
|
|
31
|
-
*
|
|
32
|
-
* @param attributes - Span attributes to set
|
|
33
|
-
* @returns This span for method chaining
|
|
34
|
-
*/
|
|
35
|
-
update(attributes: SpanAttributes): PingopsSpan;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* PingOps span wrapper for tracking operations
|
|
39
|
-
*
|
|
40
|
-
* Provides a convenient wrapper around OpenTelemetry spans with PingOps-specific
|
|
41
|
-
* attribute handling and lifecycle management.
|
|
42
|
-
*/
|
|
43
|
-
export declare class PingopsSpan extends PingopsBaseSpan {
|
|
44
|
-
constructor(otelSpan: Span);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Creates an OpenTelemetry span with the PingOps tracer.
|
|
48
|
-
*
|
|
49
|
-
* @param params - Parameters for span creation
|
|
50
|
-
* @returns The created OpenTelemetry span
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
export declare function createOtelSpan(params: {
|
|
54
|
-
name: string;
|
|
55
|
-
startTime?: TimeInput;
|
|
56
|
-
parentSpanContext?: SpanContext;
|
|
57
|
-
attributes?: Attributes;
|
|
58
|
-
}): Span;
|
|
59
|
-
export {};
|
|
60
|
-
//# sourceMappingURL=span-wrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"span-wrapper.d.ts","sourceRoot":"","sources":["../src/span-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAkB,SAAS,EAAE,IAAI,EAAE,WAAW,EAAW,MAAM,oBAAoB,CAAC;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;GAIG;AACH,uBAAe,eAAe;IAC5B,wCAAwC;IACxC,SAAgB,QAAQ,EAAE,IAAI,CAAC;IAC/B,sDAAsD;IAC/C,EAAE,EAAE,MAAM,CAAC;IAClB,uDAAuD;IAChD,OAAO,EAAE,MAAM,CAAC;gBAEX,QAAQ,EAAE,IAAI;IAO1B;;;;OAIG;IACI,GAAG,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI;IAIrC;;;;;OAKG;IACI,MAAM,CAAC,UAAU,EAAE,cAAc,GAAG,WAAW;CA8CvD;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,eAAe;gBAClC,QAAQ,EAAE,IAAI;CAG3B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,GAAG,IAAI,CAYP"}
|
package/dist/span-wrapper.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Span wrapper for PingOps SDK
|
|
3
|
-
*
|
|
4
|
-
* Provides PingopsSpan class similar to LangfuseSpan for wrapping OpenTelemetry spans
|
|
5
|
-
* with PingOps-specific functionality.
|
|
6
|
-
*/
|
|
7
|
-
import { trace, context } from '@opentelemetry/api';
|
|
8
|
-
import { getPingopsTracerProvider } from './tracer-provider';
|
|
9
|
-
/**
|
|
10
|
-
* Base class for PingOps span wrappers
|
|
11
|
-
*
|
|
12
|
-
* Provides common functionality for wrapping OpenTelemetry spans with PingOps-specific features.
|
|
13
|
-
*/
|
|
14
|
-
class PingopsBaseSpan {
|
|
15
|
-
/** The underlying OpenTelemetry span */
|
|
16
|
-
otelSpan;
|
|
17
|
-
/** The span ID from the OpenTelemetry span context */
|
|
18
|
-
id;
|
|
19
|
-
/** The trace ID from the OpenTelemetry span context */
|
|
20
|
-
traceId;
|
|
21
|
-
constructor(otelSpan) {
|
|
22
|
-
this.otelSpan = otelSpan;
|
|
23
|
-
const spanContext = otelSpan.spanContext();
|
|
24
|
-
this.id = spanContext.spanId;
|
|
25
|
-
this.traceId = spanContext.traceId;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Ends the span, marking it as complete.
|
|
29
|
-
*
|
|
30
|
-
* @param endTime - Optional end time, defaults to current time
|
|
31
|
-
*/
|
|
32
|
-
end(endTime) {
|
|
33
|
-
this.otelSpan.end(endTime);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Updates the span with new attributes.
|
|
37
|
-
*
|
|
38
|
-
* @param attributes - Span attributes to set
|
|
39
|
-
* @returns This span for method chaining
|
|
40
|
-
*/
|
|
41
|
-
update(attributes) {
|
|
42
|
-
const otelAttributes = {};
|
|
43
|
-
// Handle nested attributes object
|
|
44
|
-
if (attributes.attributes) {
|
|
45
|
-
Object.assign(otelAttributes, attributes.attributes);
|
|
46
|
-
}
|
|
47
|
-
// Handle input/output
|
|
48
|
-
if (attributes.input !== undefined) {
|
|
49
|
-
otelAttributes['span.input'] =
|
|
50
|
-
typeof attributes.input === 'string'
|
|
51
|
-
? attributes.input
|
|
52
|
-
: JSON.stringify(attributes.input);
|
|
53
|
-
}
|
|
54
|
-
if (attributes.output !== undefined) {
|
|
55
|
-
otelAttributes['span.output'] =
|
|
56
|
-
typeof attributes.output === 'string'
|
|
57
|
-
? attributes.output
|
|
58
|
-
: JSON.stringify(attributes.output);
|
|
59
|
-
}
|
|
60
|
-
// Handle metadata
|
|
61
|
-
if (attributes.metadata !== undefined) {
|
|
62
|
-
for (const [key, value] of Object.entries(attributes.metadata)) {
|
|
63
|
-
otelAttributes[`span.metadata.${key}`] =
|
|
64
|
-
typeof value === 'string' ? value : JSON.stringify(value);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Add any other custom attributes (excluding the special keys)
|
|
68
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
69
|
-
if (key !== 'attributes' &&
|
|
70
|
-
key !== 'input' &&
|
|
71
|
-
key !== 'output' &&
|
|
72
|
-
key !== 'metadata') {
|
|
73
|
-
otelAttributes[key] = value;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
this.otelSpan.setAttributes(otelAttributes);
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* PingOps span wrapper for tracking operations
|
|
82
|
-
*
|
|
83
|
-
* Provides a convenient wrapper around OpenTelemetry spans with PingOps-specific
|
|
84
|
-
* attribute handling and lifecycle management.
|
|
85
|
-
*/
|
|
86
|
-
export class PingopsSpan extends PingopsBaseSpan {
|
|
87
|
-
constructor(otelSpan) {
|
|
88
|
-
super(otelSpan);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Creates an OpenTelemetry span with the PingOps tracer.
|
|
93
|
-
*
|
|
94
|
-
* @param params - Parameters for span creation
|
|
95
|
-
* @returns The created OpenTelemetry span
|
|
96
|
-
* @internal
|
|
97
|
-
*/
|
|
98
|
-
export function createOtelSpan(params) {
|
|
99
|
-
const provider = getPingopsTracerProvider();
|
|
100
|
-
const tracer = provider.getTracer('@pingops/sdk', '0.1.0');
|
|
101
|
-
return tracer.startSpan(params.name, {
|
|
102
|
-
startTime: params.startTime,
|
|
103
|
-
attributes: params.attributes,
|
|
104
|
-
}, createParentContext(params.parentSpanContext));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Creates a parent context from a span context.
|
|
108
|
-
*
|
|
109
|
-
* @param parentSpanContext - The span context to use as parent
|
|
110
|
-
* @returns The created context or undefined if no parent provided
|
|
111
|
-
* @internal
|
|
112
|
-
*/
|
|
113
|
-
function createParentContext(parentSpanContext) {
|
|
114
|
-
if (!parentSpanContext)
|
|
115
|
-
return undefined;
|
|
116
|
-
return trace.setSpanContext(context.active(), parentSpanContext);
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=span-wrapper.js.map
|
package/dist/span-wrapper.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"span-wrapper.js","sourceRoot":"","sources":["../src/span-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAyC,MAAM,oBAAoB,CAAC;AAE3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;GAIG;AACH,MAAe,eAAe;IAC5B,wCAAwC;IACxB,QAAQ,CAAO;IAC/B,sDAAsD;IAC/C,EAAE,CAAS;IAClB,uDAAuD;IAChD,OAAO,CAAS;IAEvB,YAAY,QAAc;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,OAAmB;QAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAA0B;QACtC,MAAM,cAAc,GAAe,EAAE,CAAC;QAEtC,kCAAkC;QAClC,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;YAC1B,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,sBAAsB;QACtB,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACnC,cAAc,CAAC,YAAY,CAAC;gBAC1B,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ;oBAClC,CAAC,CAAC,UAAU,C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CAAC;IAClB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAK9B;IACC,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAE3D,OAAO,MAAM,CAAC,SAAS,CACrB,MAAM,CAAC,IAAI,EACX;QACE,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,EACD,mBAAmB,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAC9C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAC1B,iBAA+B;IAE/B,IAAI,CAAC,iBAAiB;QAAE,OAAO,SAAS,CAAC;IAEzC,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracer Provider with global state and isolated TracerProvider architecture
|
|
3
|
-
*
|
|
4
|
-
* This module provides an isolated TracerProvider that shares the same
|
|
5
|
-
* span processors (like PingopsSpanProcessor) with the main OpenTelemetry SDK.
|
|
6
|
-
* This ensures manual spans created via startSpan are properly processed.
|
|
7
|
-
*
|
|
8
|
-
* Architecture follows Langfuse's pattern with global state management.
|
|
9
|
-
*/
|
|
10
|
-
import { TimeInput } from '@opentelemetry/api';
|
|
11
|
-
import type { Attributes, Span, TracerProvider } from '@opentelemetry/api';
|
|
12
|
-
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
13
|
-
import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
14
|
-
/**
|
|
15
|
-
* Options for starting a span
|
|
16
|
-
*/
|
|
17
|
-
export interface StartSpanOptions {
|
|
18
|
-
/** Span attributes */
|
|
19
|
-
attributes?: Attributes;
|
|
20
|
-
/** Custom start time for the span */
|
|
21
|
-
startTime?: TimeInput;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Attributes for updating trace-level information
|
|
25
|
-
*/
|
|
26
|
-
export interface TraceAttributes {
|
|
27
|
-
/** User ID associated with the trace */
|
|
28
|
-
userId?: string;
|
|
29
|
-
/** Session ID for grouping related traces */
|
|
30
|
-
sessionId?: string;
|
|
31
|
-
/** Tags for categorizing traces */
|
|
32
|
-
tags?: string[];
|
|
33
|
-
/** Additional metadata */
|
|
34
|
-
metadata?: Record<string, unknown>;
|
|
35
|
-
/** Custom attributes */
|
|
36
|
-
[key: string]: unknown;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Attributes for updating span-level information
|
|
40
|
-
*/
|
|
41
|
-
export interface SpanAttributes {
|
|
42
|
-
/** Input data for the operation */
|
|
43
|
-
input?: unknown;
|
|
44
|
-
/** Output data from the operation */
|
|
45
|
-
output?: unknown;
|
|
46
|
-
/** Additional metadata */
|
|
47
|
-
metadata?: Record<string, unknown>;
|
|
48
|
-
/** Custom attributes */
|
|
49
|
-
attributes?: Attributes;
|
|
50
|
-
/** Custom attributes */
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Sets an isolated TracerProvider for PingOps tracing operations.
|
|
55
|
-
*
|
|
56
|
-
* This allows PingOps to use its own TracerProvider instance, separate from
|
|
57
|
-
* the global OpenTelemetry TracerProvider. This is useful for avoiding conflicts
|
|
58
|
-
* with other OpenTelemetry instrumentation in the application.
|
|
59
|
-
*
|
|
60
|
-
* @param provider - The TracerProvider instance to use, or null to clear the isolated provider
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
export declare function setPingopsTracerProvider(provider: TracerProvider | null): void;
|
|
64
|
-
/**
|
|
65
|
-
* Gets the TracerProvider for PingOps tracing operations.
|
|
66
|
-
*
|
|
67
|
-
* Returns the isolated TracerProvider if one has been set via setPingopsTracerProvider(),
|
|
68
|
-
* otherwise falls back to the global OpenTelemetry TracerProvider.
|
|
69
|
-
*
|
|
70
|
-
* @returns The TracerProvider instance to use for PingOps tracing
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
export declare function getPingopsTracerProvider(): TracerProvider;
|
|
74
|
-
/**
|
|
75
|
-
* Initializes the isolated TracerProvider with the given span processors
|
|
76
|
-
*
|
|
77
|
-
* This creates a separate TracerProvider that shares the same span processors
|
|
78
|
-
* (like PingopsSpanProcessor) with the main SDK. This ensures manual spans
|
|
79
|
-
* are processed correctly.
|
|
80
|
-
*
|
|
81
|
-
* @param spanProcessors - Array of span processors to use (e.g., PingopsSpanProcessor)
|
|
82
|
-
* @param serviceName - Service name for resource attributes
|
|
83
|
-
* @deprecated Use setPingopsTracerProvider instead
|
|
84
|
-
*/
|
|
85
|
-
export declare function initializeTracerProvider(spanProcessors: SpanProcessor[], serviceName: string): void;
|
|
86
|
-
/**
|
|
87
|
-
* Gets the isolated TracerProvider instance
|
|
88
|
-
*
|
|
89
|
-
* @returns The TracerProvider instance, or null if not initialized
|
|
90
|
-
* @deprecated Use getPingopsTracerProvider instead
|
|
91
|
-
*/
|
|
92
|
-
export declare function getTracerProvider(): NodeTracerProvider | null;
|
|
93
|
-
/**
|
|
94
|
-
* Shuts down the TracerProvider and flushes remaining spans
|
|
95
|
-
*/
|
|
96
|
-
export declare function shutdownTracerProvider(): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* Starts a span, executes the function, and automatically ends the span
|
|
99
|
-
*
|
|
100
|
-
* This function uses the isolated TracerProvider to ensure spans are
|
|
101
|
-
* properly processed by PingopsSpanProcessor and other registered processors.
|
|
102
|
-
*
|
|
103
|
-
* The span is automatically set as active in the OpenTelemetry context, allowing
|
|
104
|
-
* child spans and updates to work correctly.
|
|
105
|
-
*
|
|
106
|
-
* @param name - Span name
|
|
107
|
-
* @param options - Span options including attributes
|
|
108
|
-
* @param fn - Function to execute within the span context (can be sync or async)
|
|
109
|
-
* @returns The result of the function
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
|
-
* import { startSpan } from '@pingops/sdk';
|
|
114
|
-
*
|
|
115
|
-
* const result = await startSpan('your-span-name', {
|
|
116
|
-
* attributes: {
|
|
117
|
-
* customer_id: 'cust_123',
|
|
118
|
-
* correlation_id: 'req_456',
|
|
119
|
-
* },
|
|
120
|
-
* }, async (span) => {
|
|
121
|
-
* const result = await fetch('https://api.example.com');
|
|
122
|
-
* return 'done';
|
|
123
|
-
* });
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare function startSpan<T>(name: string, options: StartSpanOptions, fn: (span: Span) => T | Promise<T>): T | Promise<T>;
|
|
127
|
-
/**
|
|
128
|
-
* Updates the currently active trace with new attributes.
|
|
129
|
-
*
|
|
130
|
-
* This function finds the currently active OpenTelemetry span and updates
|
|
131
|
-
* it with trace-level attributes. If no active span is found, a warning is logged.
|
|
132
|
-
*
|
|
133
|
-
* @param attributes - Trace attributes to set
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* ```typescript
|
|
137
|
-
* import { updateActiveTrace } from '@pingops/sdk';
|
|
138
|
-
*
|
|
139
|
-
* // Inside an active span context
|
|
140
|
-
* updateActiveTrace({
|
|
141
|
-
* userId: 'user-123',
|
|
142
|
-
* sessionId: 'session-456',
|
|
143
|
-
* tags: ['production', 'critical'],
|
|
144
|
-
* });
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
export declare function updateActiveTrace(attributes: TraceAttributes): void;
|
|
148
|
-
/**
|
|
149
|
-
* Updates the currently active span with new attributes.
|
|
150
|
-
*
|
|
151
|
-
* This function finds the currently active OpenTelemetry span in the execution context
|
|
152
|
-
* and updates it with span-level attributes. If no active span exists, the update is skipped.
|
|
153
|
-
*
|
|
154
|
-
* @param attributes - Span attributes to update
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```typescript
|
|
158
|
-
* import { startSpan, updateActiveSpan } from '@pingops/sdk';
|
|
159
|
-
*
|
|
160
|
-
* await startSpan('data-processing', {
|
|
161
|
-
* attributes: { step: 'initialization' },
|
|
162
|
-
* }, async (span) => {
|
|
163
|
-
* // Process data...
|
|
164
|
-
* const result = await processData(inputData);
|
|
165
|
-
*
|
|
166
|
-
* // Update with results
|
|
167
|
-
* updateActiveSpan({
|
|
168
|
-
* attributes: { processed_records: result.count },
|
|
169
|
-
* output: { success: true },
|
|
170
|
-
* });
|
|
171
|
-
* });
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
export declare function updateActiveSpan(attributes: SpanAttributes): void;
|
|
175
|
-
//# sourceMappingURL=tracer-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracer-provider.d.ts","sourceRoot":"","sources":["../src/tracer-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA4C,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA0EnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sBAAsB;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qCAAqC;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EA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;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAgHjE"}
|
package/dist/tracer-provider.js
DELETED
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracer Provider with global state and isolated TracerProvider architecture
|
|
3
|
-
*
|
|
4
|
-
* This module provides an isolated TracerProvider that shares the same
|
|
5
|
-
* span processors (like PingopsSpanProcessor) with the main OpenTelemetry SDK.
|
|
6
|
-
* This ensures manual spans created via startSpan are properly processed.
|
|
7
|
-
*
|
|
8
|
-
* Architecture follows Langfuse's pattern with global state management.
|
|
9
|
-
*/
|
|
10
|
-
import { context, SpanKind, SpanStatusCode, trace } from '@opentelemetry/api';
|
|
11
|
-
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
12
|
-
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
13
|
-
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
14
|
-
import { createLogger } from '@pingops/core';
|
|
15
|
-
import { PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY } from '@pingops/core';
|
|
16
|
-
/**
|
|
17
|
-
* Global symbol for PingOps state
|
|
18
|
-
*/
|
|
19
|
-
const PINGOPS_GLOBAL_SYMBOL = Symbol.for('pingops');
|
|
20
|
-
/**
|
|
21
|
-
* Logger instance for tracer provider
|
|
22
|
-
*/
|
|
23
|
-
const log = createLogger('[PingOps TracerProvider]');
|
|
24
|
-
/**
|
|
25
|
-
* Creates initial global state
|
|
26
|
-
*/
|
|
27
|
-
function createState() {
|
|
28
|
-
return {
|
|
29
|
-
isolatedTracerProvider: null,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Gets the global state, creating it if it doesn't exist
|
|
34
|
-
*/
|
|
35
|
-
function getGlobalState() {
|
|
36
|
-
const initialState = createState();
|
|
37
|
-
try {
|
|
38
|
-
const g = globalThis;
|
|
39
|
-
if (typeof g !== 'object' || g === null) {
|
|
40
|
-
// Fallback if globalThis is not available
|
|
41
|
-
log.warn('globalThis is not available, using fallback state');
|
|
42
|
-
return initialState;
|
|
43
|
-
}
|
|
44
|
-
if (!g[PINGOPS_GLOBAL_SYMBOL]) {
|
|
45
|
-
log.debug('Creating new global state');
|
|
46
|
-
Object.defineProperty(g, PINGOPS_GLOBAL_SYMBOL, {
|
|
47
|
-
value: initialState,
|
|
48
|
-
writable: false, // lock the slot (not the contents)
|
|
49
|
-
configurable: false,
|
|
50
|
-
enumerable: false,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
log.debug('Retrieved existing global state');
|
|
55
|
-
}
|
|
56
|
-
return g[PINGOPS_GLOBAL_SYMBOL];
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
log.error('Failed to access global state:', err instanceof Error ? err.message : String(err));
|
|
60
|
-
// Fallback on error
|
|
61
|
-
return initialState;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Sets an isolated TracerProvider for PingOps tracing operations.
|
|
66
|
-
*
|
|
67
|
-
* This allows PingOps to use its own TracerProvider instance, separate from
|
|
68
|
-
* the global OpenTelemetry TracerProvider. This is useful for avoiding conflicts
|
|
69
|
-
* with other OpenTelemetry instrumentation in the application.
|
|
70
|
-
*
|
|
71
|
-
* @param provider - The TracerProvider instance to use, or null to clear the isolated provider
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
export function setPingopsTracerProvider(provider) {
|
|
75
|
-
const state = getGlobalState();
|
|
76
|
-
const hadProvider = state.isolatedTracerProvider !== null;
|
|
77
|
-
state.isolatedTracerProvider = provider;
|
|
78
|
-
if (provider) {
|
|
79
|
-
log.info('Set isolated TracerProvider', {
|
|
80
|
-
hadPrevious: hadProvider,
|
|
81
|
-
providerType: provider.constructor.name,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
log.info('Cleared isolated TracerProvider', { hadPrevious: hadProvider });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Gets the TracerProvider for PingOps tracing operations.
|
|
90
|
-
*
|
|
91
|
-
* Returns the isolated TracerProvider if one has been set via setPingopsTracerProvider(),
|
|
92
|
-
* otherwise falls back to the global OpenTelemetry TracerProvider.
|
|
93
|
-
*
|
|
94
|
-
* @returns The TracerProvider instance to use for PingOps tracing
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
export function getPingopsTracerProvider() {
|
|
98
|
-
const { isolatedTracerProvider } = getGlobalState();
|
|
99
|
-
if (isolatedTracerProvider) {
|
|
100
|
-
log.debug('Using isolated TracerProvider', {
|
|
101
|
-
providerType: isolatedTracerProvider.constructor.name,
|
|
102
|
-
});
|
|
103
|
-
return isolatedTracerProvider;
|
|
104
|
-
}
|
|
105
|
-
const globalProvider = trace.getTracerProvider();
|
|
106
|
-
log.debug('Using global TracerProvider', {
|
|
107
|
-
providerType: globalProvider.constructor.name,
|
|
108
|
-
});
|
|
109
|
-
return globalProvider;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Gets the OpenTelemetry tracer instance for PingOps.
|
|
113
|
-
*
|
|
114
|
-
* This function returns a tracer specifically configured for PingOps
|
|
115
|
-
* with the correct tracer name and version.
|
|
116
|
-
*
|
|
117
|
-
* @returns The PingOps OpenTelemetry tracer instance
|
|
118
|
-
* @internal
|
|
119
|
-
*/
|
|
120
|
-
function getPingopsTracer() {
|
|
121
|
-
const provider = getPingopsTracerProvider();
|
|
122
|
-
const tracer = provider.getTracer('@pingops/sdk', '0.1.0');
|
|
123
|
-
log.debug('Retrieved PingOps tracer', {
|
|
124
|
-
tracerName: '@pingops/sdk',
|
|
125
|
-
version: '0.1.0',
|
|
126
|
-
});
|
|
127
|
-
return tracer;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Initializes the isolated TracerProvider with the given span processors
|
|
131
|
-
*
|
|
132
|
-
* This creates a separate TracerProvider that shares the same span processors
|
|
133
|
-
* (like PingopsSpanProcessor) with the main SDK. This ensures manual spans
|
|
134
|
-
* are processed correctly.
|
|
135
|
-
*
|
|
136
|
-
* @param spanProcessors - Array of span processors to use (e.g., PingopsSpanProcessor)
|
|
137
|
-
* @param serviceName - Service name for resource attributes
|
|
138
|
-
* @deprecated Use setPingopsTracerProvider instead
|
|
139
|
-
*/
|
|
140
|
-
export function initializeTracerProvider(spanProcessors, serviceName) {
|
|
141
|
-
log.info('Initializing TracerProvider', {
|
|
142
|
-
serviceName,
|
|
143
|
-
spanProcessorCount: spanProcessors.length,
|
|
144
|
-
});
|
|
145
|
-
// Create resource with service name
|
|
146
|
-
const resource = resourceFromAttributes({
|
|
147
|
-
[ATTR_SERVICE_NAME]: serviceName,
|
|
148
|
-
});
|
|
149
|
-
log.debug('Created resource', { serviceName });
|
|
150
|
-
// In version 2.2.0, span processors are passed in the constructor
|
|
151
|
-
const tracerProvider = new NodeTracerProvider({
|
|
152
|
-
resource,
|
|
153
|
-
spanProcessors,
|
|
154
|
-
});
|
|
155
|
-
log.debug('Created NodeTracerProvider', {
|
|
156
|
-
spanProcessorCount: spanProcessors.length,
|
|
157
|
-
});
|
|
158
|
-
// Register the provider globally
|
|
159
|
-
tracerProvider.register();
|
|
160
|
-
log.info('Registered TracerProvider globally');
|
|
161
|
-
// Set it in global state
|
|
162
|
-
setPingopsTracerProvider(tracerProvider);
|
|
163
|
-
log.info('TracerProvider initialization complete');
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Gets the isolated TracerProvider instance
|
|
167
|
-
*
|
|
168
|
-
* @returns The TracerProvider instance, or null if not initialized
|
|
169
|
-
* @deprecated Use getPingopsTracerProvider instead
|
|
170
|
-
*/
|
|
171
|
-
export function getTracerProvider() {
|
|
172
|
-
const provider = getPingopsTracerProvider();
|
|
173
|
-
return provider instanceof NodeTracerProvider ? provider : null;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Shuts down the TracerProvider and flushes remaining spans
|
|
177
|
-
*/
|
|
178
|
-
export async function shutdownTracerProvider() {
|
|
179
|
-
log.info('Shutting down TracerProvider');
|
|
180
|
-
const provider = getPingopsTracerProvider();
|
|
181
|
-
// Check if provider has shutdown method (NodeTracerProvider and compatible providers)
|
|
182
|
-
if (provider && typeof provider.shutdown === 'function') {
|
|
183
|
-
log.debug('Calling provider.shutdown()');
|
|
184
|
-
try {
|
|
185
|
-
await provider.shutdown();
|
|
186
|
-
log.info('TracerProvider shutdown complete');
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
log.error('Error during TracerProvider shutdown:', error instanceof Error ? error.message : String(error));
|
|
190
|
-
throw error;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
log.warn('TracerProvider does not have shutdown method, skipping');
|
|
195
|
-
}
|
|
196
|
-
setPingopsTracerProvider(null);
|
|
197
|
-
log.info('TracerProvider shutdown finished');
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Wraps a promise to automatically end the span when the promise resolves or rejects.
|
|
201
|
-
*
|
|
202
|
-
* @param promise - The promise to wrap
|
|
203
|
-
* @param span - The span to end when promise completes
|
|
204
|
-
* @param endOnExit - Whether to end the span on exit (default: true)
|
|
205
|
-
* @returns The wrapped promise
|
|
206
|
-
* @internal
|
|
207
|
-
*/
|
|
208
|
-
function wrapPromise(promise, span, endOnExit) {
|
|
209
|
-
const spanContext = span.spanContext();
|
|
210
|
-
log.debug('Wrapping promise for span', {
|
|
211
|
-
spanId: spanContext.spanId,
|
|
212
|
-
traceId: spanContext.traceId,
|
|
213
|
-
endOnExit: endOnExit !== false,
|
|
214
|
-
});
|
|
215
|
-
return promise.then((value) => {
|
|
216
|
-
log.debug('Promise resolved, ending span', {
|
|
217
|
-
spanId: spanContext.spanId,
|
|
218
|
-
traceId: spanContext.traceId,
|
|
219
|
-
spanAttributes: span.attributes || {},
|
|
220
|
-
});
|
|
221
|
-
if (endOnExit !== false) {
|
|
222
|
-
span.end();
|
|
223
|
-
}
|
|
224
|
-
return value;
|
|
225
|
-
}, (err) => {
|
|
226
|
-
const errorMessage = err instanceof Error ? err.message : 'Unknown error';
|
|
227
|
-
log.error('Promise rejected, marking span as error', {
|
|
228
|
-
spanId: spanContext.spanId,
|
|
229
|
-
traceId: spanContext.traceId,
|
|
230
|
-
error: errorMessage,
|
|
231
|
-
});
|
|
232
|
-
span.setStatus({
|
|
233
|
-
code: SpanStatusCode.ERROR,
|
|
234
|
-
message: errorMessage,
|
|
235
|
-
});
|
|
236
|
-
if (err instanceof Error) {
|
|
237
|
-
span.recordException(err);
|
|
238
|
-
}
|
|
239
|
-
if (endOnExit !== false) {
|
|
240
|
-
span.end();
|
|
241
|
-
}
|
|
242
|
-
throw err;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Starts a span, executes the function, and automatically ends the span
|
|
247
|
-
*
|
|
248
|
-
* This function uses the isolated TracerProvider to ensure spans are
|
|
249
|
-
* properly processed by PingopsSpanProcessor and other registered processors.
|
|
250
|
-
*
|
|
251
|
-
* The span is automatically set as active in the OpenTelemetry context, allowing
|
|
252
|
-
* child spans and updates to work correctly.
|
|
253
|
-
*
|
|
254
|
-
* @param name - Span name
|
|
255
|
-
* @param options - Span options including attributes
|
|
256
|
-
* @param fn - Function to execute within the span context (can be sync or async)
|
|
257
|
-
* @returns The result of the function
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* ```typescript
|
|
261
|
-
* import { startSpan } from '@pingops/sdk';
|
|
262
|
-
*
|
|
263
|
-
* const result = await startSpan('your-span-name', {
|
|
264
|
-
* attributes: {
|
|
265
|
-
* customer_id: 'cust_123',
|
|
266
|
-
* correlation_id: 'req_456',
|
|
267
|
-
* },
|
|
268
|
-
* }, async (span) => {
|
|
269
|
-
* const result = await fetch('https://api.example.com');
|
|
270
|
-
* return 'done';
|
|
271
|
-
* });
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
export function startSpan(name, options, fn) {
|
|
275
|
-
log.info('Starting span', {
|
|
276
|
-
name,
|
|
277
|
-
attributeCount: Object.keys(options.attributes || {}).length,
|
|
278
|
-
hasStartTime: options.startTime !== undefined,
|
|
279
|
-
});
|
|
280
|
-
const tracer = getPingopsTracer();
|
|
281
|
-
const { attributes = {}, startTime } = options;
|
|
282
|
-
// Store initial attributes in context so they propagate to child spans
|
|
283
|
-
const activeContext = context.active();
|
|
284
|
-
const contextWithAttributes = activeContext.setValue(PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY, attributes);
|
|
285
|
-
return context.with(contextWithAttributes, () => {
|
|
286
|
-
return tracer.startActiveSpan(name, {
|
|
287
|
-
kind: SpanKind.CLIENT,
|
|
288
|
-
attributes,
|
|
289
|
-
startTime,
|
|
290
|
-
}, context.active(), (span) => {
|
|
291
|
-
const spanContext = span.spanContext();
|
|
292
|
-
log.debug('Span started', {
|
|
293
|
-
name,
|
|
294
|
-
spanId: spanContext.spanId,
|
|
295
|
-
traceId: spanContext.traceId,
|
|
296
|
-
attributeCount: Object.keys(attributes).length,
|
|
297
|
-
});
|
|
298
|
-
try {
|
|
299
|
-
const result = fn(span);
|
|
300
|
-
if (result instanceof Promise) {
|
|
301
|
-
log.debug('Function returned Promise, wrapping', {
|
|
302
|
-
spanId: spanContext.spanId,
|
|
303
|
-
traceId: spanContext.traceId,
|
|
304
|
-
});
|
|
305
|
-
return wrapPromise(result, span, true);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
log.debug('Function returned sync value, ending span', {
|
|
309
|
-
spanId: spanContext.spanId,
|
|
310
|
-
traceId: spanContext.traceId,
|
|
311
|
-
});
|
|
312
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
313
|
-
span.end();
|
|
314
|
-
return result;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
catch (err) {
|
|
318
|
-
const errorMessage = err instanceof Error ? err.message : 'Unknown error';
|
|
319
|
-
log.error('Error in span execution', {
|
|
320
|
-
name,
|
|
321
|
-
spanId: spanContext.spanId,
|
|
322
|
-
traceId: spanContext.traceId,
|
|
323
|
-
error: errorMessage,
|
|
324
|
-
});
|
|
325
|
-
span.setStatus({
|
|
326
|
-
code: SpanStatusCode.ERROR,
|
|
327
|
-
message: errorMessage,
|
|
328
|
-
});
|
|
329
|
-
if (err instanceof Error) {
|
|
330
|
-
span.recordException(err);
|
|
331
|
-
}
|
|
332
|
-
span.end();
|
|
333
|
-
throw err;
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Updates the currently active trace with new attributes.
|
|
340
|
-
*
|
|
341
|
-
* This function finds the currently active OpenTelemetry span and updates
|
|
342
|
-
* it with trace-level attributes. If no active span is found, a warning is logged.
|
|
343
|
-
*
|
|
344
|
-
* @param attributes - Trace attributes to set
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```typescript
|
|
348
|
-
* import { updateActiveTrace } from '@pingops/sdk';
|
|
349
|
-
*
|
|
350
|
-
* // Inside an active span context
|
|
351
|
-
* updateActiveTrace({
|
|
352
|
-
* userId: 'user-123',
|
|
353
|
-
* sessionId: 'session-456',
|
|
354
|
-
* tags: ['production', 'critical'],
|
|
355
|
-
* });
|
|
356
|
-
* ```
|
|
357
|
-
*/
|
|
358
|
-
export function updateActiveTrace(attributes) {
|
|
359
|
-
log.debug('Updating active trace', {
|
|
360
|
-
hasUserId: attributes.userId !== undefined,
|
|
361
|
-
hasSessionId: attributes.sessionId !== undefined,
|
|
362
|
-
hasTags: attributes.tags !== undefined,
|
|
363
|
-
hasMetadata: attributes.metadata !== undefined,
|
|
364
|
-
customAttributeCount: Object.keys(attributes).filter(k => !['userId', 'sessionId', 'tags', 'metadata'].includes(k)).length,
|
|
365
|
-
});
|
|
366
|
-
const span = trace.getActiveSpan();
|
|
367
|
-
if (!span) {
|
|
368
|
-
log.warn('No active span found, skipping trace update');
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
const spanContext = span.spanContext();
|
|
372
|
-
log.debug('Found active span for trace update', {
|
|
373
|
-
spanId: spanContext.spanId,
|
|
374
|
-
traceId: spanContext.traceId,
|
|
375
|
-
});
|
|
376
|
-
// Convert trace attributes to OpenTelemetry attributes
|
|
377
|
-
const otelAttributes = {};
|
|
378
|
-
if (attributes.userId !== undefined) {
|
|
379
|
-
otelAttributes['user.id'] = attributes.userId;
|
|
380
|
-
log.debug('Setting user.id', { userId: attributes.userId });
|
|
381
|
-
}
|
|
382
|
-
if (attributes.sessionId !== undefined) {
|
|
383
|
-
otelAttributes['session.id'] = attributes.sessionId;
|
|
384
|
-
log.debug('Setting session.id', { sessionId: attributes.sessionId });
|
|
385
|
-
}
|
|
386
|
-
if (attributes.tags !== undefined) {
|
|
387
|
-
otelAttributes['trace.tags'] = attributes.tags;
|
|
388
|
-
log.debug('Setting trace.tags', { tags: attributes.tags });
|
|
389
|
-
}
|
|
390
|
-
if (attributes.metadata !== undefined) {
|
|
391
|
-
// Flatten metadata with dot notation
|
|
392
|
-
for (const [key, value] of Object.entries(attributes.metadata)) {
|
|
393
|
-
otelAttributes[`trace.metadata.${key}`] =
|
|
394
|
-
typeof value === 'string' ? value : JSON.stringify(value);
|
|
395
|
-
}
|
|
396
|
-
log.debug('Setting trace.metadata', {
|
|
397
|
-
metadataKeys: Object.keys(attributes.metadata),
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
// Add any other custom attributes
|
|
401
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
402
|
-
if (key !== 'userId' &&
|
|
403
|
-
key !== 'sessionId' &&
|
|
404
|
-
key !== 'tags' &&
|
|
405
|
-
key !== 'metadata') {
|
|
406
|
-
otelAttributes[key] = value;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
span.setAttributes(otelAttributes);
|
|
410
|
-
log.info('Updated active trace', {
|
|
411
|
-
spanId: spanContext.spanId,
|
|
412
|
-
traceId: spanContext.traceId,
|
|
413
|
-
attributeCount: Object.keys(otelAttributes).length,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Updates the currently active span with new attributes.
|
|
418
|
-
*
|
|
419
|
-
* This function finds the currently active OpenTelemetry span in the execution context
|
|
420
|
-
* and updates it with span-level attributes. If no active span exists, the update is skipped.
|
|
421
|
-
*
|
|
422
|
-
* @param attributes - Span attributes to update
|
|
423
|
-
*
|
|
424
|
-
* @example
|
|
425
|
-
* ```typescript
|
|
426
|
-
* import { startSpan, updateActiveSpan } from '@pingops/sdk';
|
|
427
|
-
*
|
|
428
|
-
* await startSpan('data-processing', {
|
|
429
|
-
* attributes: { step: 'initialization' },
|
|
430
|
-
* }, async (span) => {
|
|
431
|
-
* // Process data...
|
|
432
|
-
* const result = await processData(inputData);
|
|
433
|
-
*
|
|
434
|
-
* // Update with results
|
|
435
|
-
* updateActiveSpan({
|
|
436
|
-
* attributes: { processed_records: result.count },
|
|
437
|
-
* output: { success: true },
|
|
438
|
-
* });
|
|
439
|
-
* });
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
export function updateActiveSpan(attributes) {
|
|
443
|
-
log.debug('Updating active span', {
|
|
444
|
-
hasAttributes: attributes.attributes !== undefined,
|
|
445
|
-
hasInput: attributes.input !== undefined,
|
|
446
|
-
hasOutput: attributes.output !== undefined,
|
|
447
|
-
hasMetadata: attributes.metadata !== undefined,
|
|
448
|
-
customAttributeCount: Object.keys(attributes).filter(k => !['attributes', 'input', 'output', 'metadata'].includes(k)).length,
|
|
449
|
-
});
|
|
450
|
-
const span = trace.getActiveSpan();
|
|
451
|
-
if (!span) {
|
|
452
|
-
log.warn('No active span found, skipping span update');
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
const spanContext = span.spanContext();
|
|
456
|
-
log.debug('Found active span for update', {
|
|
457
|
-
spanId: spanContext.spanId,
|
|
458
|
-
traceId: spanContext.traceId,
|
|
459
|
-
});
|
|
460
|
-
const otelAttributes = {};
|
|
461
|
-
// Handle nested attributes object
|
|
462
|
-
if (attributes.attributes) {
|
|
463
|
-
Object.assign(otelAttributes, attributes.attributes);
|
|
464
|
-
log.debug('Added nested attributes', {
|
|
465
|
-
attributeCount: Object.keys(attributes.attributes).length,
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
// Handle input/output
|
|
469
|
-
if (attributes.input !== undefined) {
|
|
470
|
-
otelAttributes['span.input'] =
|
|
471
|
-
typeof attributes.input === 'string'
|
|
472
|
-
? attributes.input
|
|
473
|
-
: JSON.stringify(attributes.input);
|
|
474
|
-
log.debug('Setting span.input', {
|
|
475
|
-
inputType: typeof attributes.input,
|
|
476
|
-
inputLength: typeof attributes.input === 'string'
|
|
477
|
-
? attributes.input.length
|
|
478
|
-
: JSON.stringify(attributes.input).length,
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
if (attributes.output !== undefined) {
|
|
482
|
-
otelAttributes['span.output'] =
|
|
483
|
-
typeof attributes.output === 'string'
|
|
484
|
-
? attributes.output
|
|
485
|
-
: JSON.stringify(attributes.output);
|
|
486
|
-
log.debug('Setting span.output', {
|
|
487
|
-
outputType: typeof attributes.output,
|
|
488
|
-
outputLength: typeof attributes.output === 'string'
|
|
489
|
-
? attributes.output.length
|
|
490
|
-
: JSON.stringify(attributes.output).length,
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
// Handle metadata
|
|
494
|
-
if (attributes.metadata !== undefined) {
|
|
495
|
-
for (const [key, value] of Object.entries(attributes.metadata)) {
|
|
496
|
-
otelAttributes[`span.metadata.${key}`] =
|
|
497
|
-
typeof value === 'string' ? value : JSON.stringify(value);
|
|
498
|
-
}
|
|
499
|
-
log.debug('Setting span.metadata', {
|
|
500
|
-
metadataKeys: Object.keys(attributes.metadata),
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
// Add any other custom attributes (excluding the special keys)
|
|
504
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
505
|
-
if (key !== 'attributes' &&
|
|
506
|
-
key !== 'input' &&
|
|
507
|
-
key !== 'output' &&
|
|
508
|
-
key !== 'metadata') {
|
|
509
|
-
otelAttributes[key] = value;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
span.setAttributes(otelAttributes);
|
|
513
|
-
// Store attributes in context so they propagate to child spans
|
|
514
|
-
// This allows child spans (like HTTP spans) to inherit parent attributes
|
|
515
|
-
const activeContext = context.active();
|
|
516
|
-
const existingAttributes = activeContext.getValue(PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY);
|
|
517
|
-
const mergedAttributes = existingAttributes
|
|
518
|
-
? { ...existingAttributes, ...otelAttributes }
|
|
519
|
-
: otelAttributes;
|
|
520
|
-
// Update context with merged attributes
|
|
521
|
-
// Note: The context is immutable, so we create a new context with the merged attributes
|
|
522
|
-
// This new context will be used by child spans created after this point
|
|
523
|
-
const updatedContext = activeContext.setValue(PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY, mergedAttributes);
|
|
524
|
-
// Execute in the updated context so future child spans inherit the attributes
|
|
525
|
-
// This is a no-op for the current execution, but ensures the context is set for child spans
|
|
526
|
-
context.with(updatedContext, () => {
|
|
527
|
-
// Context is now updated - child spans created from this point will inherit attributes
|
|
528
|
-
});
|
|
529
|
-
log.info('Updated active span', {
|
|
530
|
-
spanId: spanContext.spanId,
|
|
531
|
-
traceId: spanContext.traceId,
|
|
532
|
-
spanAttributes: span.attributes || {},
|
|
533
|
-
attributes: otelAttributes,
|
|
534
|
-
contextAttributesStored: true,
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
//# sourceMappingURL=tracer-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracer-provider.js","sourceRoot":"","sources":["../src/tracer-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO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