@pingops/otel 0.1.0 → 0.1.2

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.
Files changed (49) hide show
  1. package/dist/index.cjs +1018 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +342 -0
  4. package/dist/index.d.cts.map +1 -0
  5. package/dist/index.d.mts +342 -0
  6. package/dist/index.d.mts.map +1 -0
  7. package/dist/index.mjs +981 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +23 -11
  10. package/dist/config.d.ts +0 -75
  11. package/dist/config.d.ts.map +0 -1
  12. package/dist/config.js +0 -5
  13. package/dist/config.js.map +0 -1
  14. package/dist/index.d.ts +0 -10
  15. package/dist/index.d.ts.map +0 -1
  16. package/dist/index.js +0 -9
  17. package/dist/index.js.map +0 -1
  18. package/dist/instrumentations/body-extractor.d.ts +0 -48
  19. package/dist/instrumentations/body-extractor.d.ts.map +0 -1
  20. package/dist/instrumentations/body-extractor.js +0 -361
  21. package/dist/instrumentations/body-extractor.js.map +0 -1
  22. package/dist/instrumentations/http.d.ts +0 -12
  23. package/dist/instrumentations/http.d.ts.map +0 -1
  24. package/dist/instrumentations/http.js +0 -38
  25. package/dist/instrumentations/http.js.map +0 -1
  26. package/dist/instrumentations/index.d.ts +0 -17
  27. package/dist/instrumentations/index.d.ts.map +0 -1
  28. package/dist/instrumentations/index.js +0 -32
  29. package/dist/instrumentations/index.js.map +0 -1
  30. package/dist/instrumentations/undici.d.ts +0 -12
  31. package/dist/instrumentations/undici.d.ts.map +0 -1
  32. package/dist/instrumentations/undici.js +0 -38
  33. package/dist/instrumentations/undici.js.map +0 -1
  34. package/dist/processor.d.ts +0 -82
  35. package/dist/processor.d.ts.map +0 -1
  36. package/dist/processor.js +0 -264
  37. package/dist/processor.js.map +0 -1
  38. package/dist/span-processor.d.ts +0 -78
  39. package/dist/span-processor.d.ts.map +0 -1
  40. package/dist/span-processor.js +0 -272
  41. package/dist/span-processor.js.map +0 -1
  42. package/dist/span-wrapper.d.ts +0 -60
  43. package/dist/span-wrapper.d.ts.map +0 -1
  44. package/dist/span-wrapper.js +0 -118
  45. package/dist/span-wrapper.js.map +0 -1
  46. package/dist/tracer-provider.d.ts +0 -57
  47. package/dist/tracer-provider.d.ts.map +0 -1
  48. package/dist/tracer-provider.js +0 -182
  49. package/dist/tracer-provider.js.map +0 -1
package/dist/processor.js DELETED
@@ -1,264 +0,0 @@
1
- /**
2
- * PingopsSpanProcessor - OpenTelemetry SpanProcessor implementation
3
- * Observes finished spans and sends eligible ones to PingOps backend
4
- *
5
- * This processor provides:
6
- * - Automatic filtering of spans (CLIENT spans with HTTP/GenAI attributes only)
7
- * - Domain and header filtering based on configuration
8
- * - Batched or immediate export modes using OTLP exporters
9
- * - Fire-and-forget transport (never blocks application)
10
- *
11
- * @example
12
- * ```typescript
13
- * import { NodeSDK } from '@opentelemetry/sdk-node';
14
- * import { PingopsSpanProcessor } from '@pingops/otel';
15
- *
16
- * const sdk = new NodeSDK({
17
- * spanProcessors: [
18
- * new PingopsSpanProcessor({
19
- * apiKey: 'your-api-key',
20
- * baseUrl: 'https://api.pingops.com',
21
- * serviceName: 'my-service',
22
- * exportMode: 'batched', // or 'immediate'
23
- * domainAllowList: [
24
- * { domain: 'api.example.com' }
25
- * ]
26
- * })
27
- * ]
28
- * });
29
- *
30
- * sdk.start();
31
- * ```
32
- */
33
- import { BatchSpanProcessor, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
34
- import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
35
- import { isSpanEligible, shouldCaptureSpan, createLogger, } from '@pingops/core';
36
- import { PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY } from '@pingops/core';
37
- const log = createLogger('[PingOps Processor]');
38
- /**
39
- * OpenTelemetry span processor for sending spans to PingOps backend.
40
- *
41
- * This processor wraps OpenTelemetry's built-in processors (BatchSpanProcessor or SimpleSpanProcessor)
42
- * and applies filtering before passing spans to the OTLP exporter.
43
- */
44
- export class PingopsSpanProcessor {
45
- processor;
46
- config;
47
- /**
48
- * Creates a new PingopsSpanProcessor instance.
49
- *
50
- * @param config - Configuration parameters for the processor
51
- */
52
- constructor(config) {
53
- const exportMode = config.exportMode ?? 'batched';
54
- // Get API key from config or environment
55
- const apiKey = config.apiKey || process.env.PINGOPS_API_KEY || '';
56
- // Create OTLP exporter pointing to PingOps backend
57
- const exporter = new OTLPTraceExporter({
58
- url: `${config.baseUrl}/v1/traces`,
59
- headers: {
60
- 'Authorization': apiKey ? `Bearer ${apiKey}` : '',
61
- 'Content-Type': 'application/json',
62
- },
63
- timeoutMillis: 5000,
64
- });
65
- // Create underlying processor based on export mode
66
- if (exportMode === 'immediate') {
67
- this.processor = new SimpleSpanProcessor(exporter);
68
- }
69
- else {
70
- this.processor = new BatchSpanProcessor(exporter, {
71
- maxExportBatchSize: config.batchSize ?? 50,
72
- scheduledDelayMillis: config.batchTimeout ?? 5000,
73
- });
74
- }
75
- this.config = {
76
- debug: config.debug ?? false,
77
- headersAllowList: config.headersAllowList,
78
- headersDenyList: config.headersDenyList,
79
- domainAllowList: config.domainAllowList,
80
- domainDenyList: config.domainDenyList,
81
- };
82
- log.info('Initialized PingopsSpanProcessor', {
83
- baseUrl: config.baseUrl,
84
- exportMode,
85
- batchSize: config.batchSize,
86
- batchTimeout: config.batchTimeout,
87
- hasDomainAllowList: !!config.domainAllowList && config.domainAllowList.length > 0,
88
- hasDomainDenyList: !!config.domainDenyList && config.domainDenyList.length > 0,
89
- hasHeadersAllowList: !!config.headersAllowList && config.headersAllowList.length > 0,
90
- hasHeadersDenyList: !!config.headersDenyList && config.headersDenyList.length > 0,
91
- });
92
- }
93
- /**
94
- * Called when a span starts - extracts parent attributes from context and adds them to the span
95
- */
96
- onStart(span, parentContext) {
97
- const spanContext = span.spanContext();
98
- log.debug('Span started', {
99
- spanName: span.name,
100
- spanId: spanContext.spanId,
101
- traceId: spanContext.traceId,
102
- });
103
- // Extract parent span attributes from context and add them to this span
104
- // This allows child spans (like HTTP spans) to inherit custom attributes from parent spans
105
- const parentAttributes = parentContext.getValue(PINGOPS_PARENT_SPAN_ATTRIBUTES_KEY);
106
- if (parentAttributes && Object.keys(parentAttributes).length > 0) {
107
- // Filter out HTTP/GenAI attributes - we only want custom attributes
108
- const customAttributes = this.extractCustomAttributes(parentAttributes);
109
- if (Object.keys(customAttributes).length > 0) {
110
- // Convert to Attributes type (string | number | boolean | string[] | undefined)
111
- const attributesToSet = {};
112
- for (const [key, value] of Object.entries(customAttributes)) {
113
- // Only set valid attribute types
114
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || Array.isArray(value)) {
115
- attributesToSet[key] = value;
116
- }
117
- else if (value !== null && value !== undefined) {
118
- // Convert other types to string
119
- attributesToSet[key] = String(value);
120
- }
121
- }
122
- span.setAttributes(attributesToSet);
123
- log.debug('Added parent span attributes to child span', {
124
- spanName: span.name,
125
- spanId: spanContext.spanId,
126
- attributeCount: Object.keys(attributesToSet).length,
127
- attributes: Object.keys(attributesToSet),
128
- });
129
- }
130
- }
131
- this.processor.onStart(span, parentContext);
132
- }
133
- /**
134
- * Extracts custom attributes (non-HTTP, non-GenAI) from attributes.
135
- * These are attributes that were added manually via updateActiveSpan.
136
- */
137
- extractCustomAttributes(attributes) {
138
- const customAttributes = {};
139
- // List of HTTP attribute prefixes to exclude
140
- const httpPrefixes = ['http.', 'url.', 'server.', 'network.', 'user_agent.'];
141
- // List of GenAI attribute prefixes to exclude
142
- const genAiPrefixes = ['gen_ai.', 'genai.'];
143
- for (const [key, value] of Object.entries(attributes)) {
144
- // Skip HTTP and GenAI attributes
145
- const isHttpAttribute = httpPrefixes.some(prefix => key.startsWith(prefix));
146
- const isGenAiAttribute = genAiPrefixes.some(prefix => key.startsWith(prefix));
147
- if (!isHttpAttribute && !isGenAiAttribute) {
148
- customAttributes[key] = value;
149
- }
150
- }
151
- return customAttributes;
152
- }
153
- /**
154
- * Called when a span ends. Filters the span and passes it to the underlying processor if eligible.
155
- *
156
- * This method:
157
- * 1. Checks if the span is eligible (CLIENT + HTTP/GenAI attributes)
158
- * 2. Applies domain filtering
159
- * 3. If eligible, passes span to underlying OTLP processor for export
160
- */
161
- onEnd(span) {
162
- const spanContext = span.spanContext();
163
- log.debug('Span ended, processing', {
164
- spanName: span.name,
165
- spanId: spanContext.spanId,
166
- traceId: spanContext.traceId,
167
- spanKind: span.kind,
168
- });
169
- try {
170
- // Step 1: Check if span is eligible (CLIENT + HTTP/GenAI attributes)
171
- if (!isSpanEligible(span)) {
172
- log.debug('Span not eligible, skipping', {
173
- spanName: span.name,
174
- spanId: spanContext.spanId,
175
- reason: 'not CLIENT or missing HTTP/GenAI attributes',
176
- });
177
- return;
178
- }
179
- // Step 2: Extract URL for domain filtering
180
- const attributes = span.attributes;
181
- const url = attributes['http.url'] ||
182
- attributes['url.full'] ||
183
- (attributes['server.address'] ? `https://${attributes['server.address']}` : '');
184
- log.debug('Extracted URL for domain filtering', {
185
- spanName: span.name,
186
- url,
187
- hasHttpUrl: !!attributes['http.url'],
188
- hasUrlFull: !!attributes['url.full'],
189
- hasServerAddress: !!attributes['server.address'],
190
- });
191
- // Step 3: Apply domain filtering
192
- if (url) {
193
- const shouldCapture = shouldCaptureSpan(url, this.config.domainAllowList, this.config.domainDenyList);
194
- if (!shouldCapture) {
195
- log.info('Span filtered out by domain rules', {
196
- spanName: span.name,
197
- spanId: spanContext.spanId,
198
- url,
199
- });
200
- return;
201
- }
202
- }
203
- else {
204
- log.debug('No URL found for domain filtering, proceeding', {
205
- spanName: span.name,
206
- });
207
- }
208
- // Step 4: Span passed all filters, pass to underlying processor for export
209
- this.processor.onEnd(span);
210
- log.info('Span passed all filters and queued for export', {
211
- spanName: span.name,
212
- spanId: spanContext.spanId,
213
- traceId: spanContext.traceId,
214
- attributes: span.attributes,
215
- url,
216
- });
217
- }
218
- catch (error) {
219
- // Defensive error handling - never crash the app
220
- log.error('Error processing span', {
221
- spanName: span.name,
222
- spanId: spanContext.spanId,
223
- error: error instanceof Error ? error.message : String(error),
224
- });
225
- }
226
- }
227
- /**
228
- * Forces an immediate flush of all pending spans.
229
- *
230
- * @returns Promise that resolves when all pending operations are complete
231
- */
232
- async forceFlush() {
233
- log.info('Force flushing spans');
234
- try {
235
- await this.processor.forceFlush();
236
- log.info('Force flush complete');
237
- }
238
- catch (error) {
239
- log.error('Error during force flush', {
240
- error: error instanceof Error ? error.message : String(error),
241
- });
242
- throw error;
243
- }
244
- }
245
- /**
246
- * Gracefully shuts down the processor, ensuring all pending operations are completed.
247
- *
248
- * @returns Promise that resolves when shutdown is complete
249
- */
250
- async shutdown() {
251
- log.info('Shutting down processor');
252
- try {
253
- await this.processor.shutdown();
254
- log.info('Processor shutdown complete');
255
- }
256
- catch (error) {
257
- log.error('Error during processor shutdown', {
258
- error: error instanceof Error ? error.message : String(error),
259
- });
260
- throw error;
261
- }
262
- }
263
- }
264
- //# sourceMappingURL=processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processor.js","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,iBAAiB,EAEjB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kCAAkC,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IACvB,SAAS,CAAgB;IACzB,MAAM,CAMZ;IAEF;;;;OAIG;IACH,YAAY,MAA8B;QACxC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC;QAElD,yCAAyC;QACzC,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AAM;gBAC1B,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAU;QACrB,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;YAClC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE;gBACpC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAQ;QACnB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YAChC,GAAG,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE;gBAC3C,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -1,78 +0,0 @@
1
- /**
2
- * PingopsSpanProcessor - OpenTelemetry SpanProcessor implementation
3
- * Observes finished spans and sends eligible ones to PingOps backend
4
- *
5
- * This processor provides:
6
- * - Automatic filtering of spans (CLIENT spans with HTTP/GenAI attributes only)
7
- * - Domain and header filtering based on configuration
8
- * - Batched or immediate export modes using OTLP exporters
9
- * - Fire-and-forget transport (never blocks application)
10
- *
11
- * @example
12
- * ```typescript
13
- * import { NodeSDK } from '@opentelemetry/sdk-node';
14
- * import { PingopsSpanProcessor } from '@pingops/otel';
15
- *
16
- * const sdk = new NodeSDK({
17
- * spanProcessors: [
18
- * new PingopsSpanProcessor({
19
- * apiKey: 'your-api-key',
20
- * baseUrl: 'https://api.pingops.com',
21
- * serviceName: 'my-service',
22
- * exportMode: 'batched', // or 'immediate'
23
- * domainAllowList: [
24
- * { domain: 'api.example.com' }
25
- * ]
26
- * })
27
- * ]
28
- * });
29
- *
30
- * sdk.start();
31
- * ```
32
- */
33
- import type { SpanProcessor, ReadableSpan, Span } from "@opentelemetry/sdk-trace-base";
34
- import type { Context } from "@opentelemetry/api";
35
- import type { PingopsProcessorConfig } from "./config";
36
- /**
37
- * OpenTelemetry span processor for sending spans to PingOps backend.
38
- *
39
- * This processor wraps OpenTelemetry's built-in processors (BatchSpanProcessor or SimpleSpanProcessor)
40
- * and applies filtering before passing spans to the OTLP exporter.
41
- */
42
- export declare class PingopsSpanProcessor implements SpanProcessor {
43
- private processor;
44
- private config;
45
- /**
46
- * Creates a new PingopsSpanProcessor instance.
47
- *
48
- * @param config - Configuration parameters for the processor
49
- */
50
- constructor(config: PingopsProcessorConfig);
51
- /**
52
- * Called when a span starts - extracts parent attributes from context and adds them to the span
53
- */
54
- onStart(span: Span, parentContext: Context): void;
55
- /**
56
- * Called when a span ends. Filters the span and passes it to the underlying processor if eligible.
57
- *
58
- * This method:
59
- * 1. Checks if the span is eligible (CLIENT + HTTP/GenAI attributes)
60
- * 2. Applies domain filtering (determines if span should be exported)
61
- * 3. Applies header filtering via FilteredSpan wrapper (domain-specific and global rules)
62
- * 4. If eligible, passes filtered span to underlying OTLP processor for export
63
- */
64
- onEnd(span: ReadableSpan): void;
65
- /**
66
- * Forces an immediate flush of all pending spans.
67
- *
68
- * @returns Promise that resolves when all pending operations are complete
69
- */
70
- forceFlush(): Promise<void>;
71
- /**
72
- * Gracefully shuts down the processor, ensuring all pending operations are completed.
73
- *
74
- * @returns Promise that resolves when shutdown is complete
75
- */
76
- shutdown(): Promise<void>;
77
- }
78
- //# sourceMappingURL=span-processor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"span-processor.d.ts","sourceRoot":"","sources":["../src/span-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,IAAI,EACL,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAS9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAwDvD;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,MAAM,CAMZ;IAEF;;;;OAIG;gBACS,MAAM,EAAE,sBAAsB;IAkD1C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IA0BjD;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAyF/B;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxC;;;;OAIG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAYvC"}
@@ -1,272 +0,0 @@
1
- /**
2
- * PingopsSpanProcessor - OpenTelemetry SpanProcessor implementation
3
- * Observes finished spans and sends eligible ones to PingOps backend
4
- *
5
- * This processor provides:
6
- * - Automatic filtering of spans (CLIENT spans with HTTP/GenAI attributes only)
7
- * - Domain and header filtering based on configuration
8
- * - Batched or immediate export modes using OTLP exporters
9
- * - Fire-and-forget transport (never blocks application)
10
- *
11
- * @example
12
- * ```typescript
13
- * import { NodeSDK } from '@opentelemetry/sdk-node';
14
- * import { PingopsSpanProcessor } from '@pingops/otel';
15
- *
16
- * const sdk = new NodeSDK({
17
- * spanProcessors: [
18
- * new PingopsSpanProcessor({
19
- * apiKey: 'your-api-key',
20
- * baseUrl: 'https://api.pingops.com',
21
- * serviceName: 'my-service',
22
- * exportMode: 'batched', // or 'immediate'
23
- * domainAllowList: [
24
- * { domain: 'api.example.com' }
25
- * ]
26
- * })
27
- * ]
28
- * });
29
- *
30
- * sdk.start();
31
- * ```
32
- */
33
- import { BatchSpanProcessor, SimpleSpanProcessor, } from "@opentelemetry/sdk-trace-base";
34
- import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
35
- import { isSpanEligible, shouldCaptureSpan, createLogger, getPropagatedAttributesFromContext, extractSpanPayload, } from "@pingops/core";
36
- const log = createLogger("[PingOps Processor]");
37
- /**
38
- * Creates a filtered span wrapper that applies header filtering to attributes
39
- *
40
- * This wrapper applies both domain-specific and global header filtering:
41
- * - Uses domain allow list to determine domain-specific header rules
42
- * - Applies global header allow/deny lists
43
- * - Filters headers from http.request.header and http.response.header attributes
44
- *
45
- * Uses a Proxy to automatically forward all properties and methods to the original span,
46
- * except for 'attributes' which returns the filtered version. This approach is future-proof
47
- * and will work with any new methods or properties added to ReadableSpan.
48
- *
49
- * This allows us to filter headers before the span is serialized by OTLP exporter
50
- */
51
- function createFilteredSpan(span, domainAllowList, globalHeadersAllowList, globalHeadersDenyList) {
52
- // Use extractSpanPayload to get filtered attributes
53
- // This handles both domain-specific header rules and global header filtering
54
- const payload = extractSpanPayload(span, domainAllowList, globalHeadersAllowList, globalHeadersDenyList);
55
- const filteredAttributes = (payload?.attributes ??
56
- span.attributes);
57
- log.debug("Payload", { payload });
58
- // Create a Proxy that intercepts 'attributes' access and forwards everything else
59
- return new Proxy(span, {
60
- get(target, prop) {
61
- // Intercept 'attributes' to return filtered version
62
- if (prop === "attributes") {
63
- return filteredAttributes;
64
- }
65
- // Forward all other property/method access to the original span
66
- const value = target[prop];
67
- // If it's a function, bind it to the original target to preserve 'this' context
68
- if (typeof value === "function") {
69
- return value.bind(target);
70
- }
71
- return value;
72
- },
73
- });
74
- }
75
- /**
76
- * OpenTelemetry span processor for sending spans to PingOps backend.
77
- *
78
- * This processor wraps OpenTelemetry's built-in processors (BatchSpanProcessor or SimpleSpanProcessor)
79
- * and applies filtering before passing spans to the OTLP exporter.
80
- */
81
- export class PingopsSpanProcessor {
82
- processor;
83
- config;
84
- /**
85
- * Creates a new PingopsSpanProcessor instance.
86
- *
87
- * @param config - Configuration parameters for the processor
88
- */
89
- constructor(config) {
90
- const exportMode = config.exportMode ?? "batched";
91
- // Get API key from config or environment
92
- const apiKey = config.apiKey || process.env.PINGOPS_API_KEY || "";
93
- // Create OTLP exporter pointing to PingOps backend
94
- const exporter = new OTLPTraceExporter({
95
- url: `${config.baseUrl}/v1/traces`,
96
- headers: {
97
- Authorization: apiKey ? `Bearer ${apiKey}` : "",
98
- "Content-Type": "application/json",
99
- },
100
- timeoutMillis: 5000,
101
- });
102
- // Create underlying processor based on export mode
103
- if (exportMode === "immediate") {
104
- this.processor = new SimpleSpanProcessor(exporter);
105
- }
106
- else {
107
- this.processor = new BatchSpanProcessor(exporter, {
108
- maxExportBatchSize: config.batchSize ?? 50,
109
- scheduledDelayMillis: config.batchTimeout ?? 5000,
110
- });
111
- }
112
- this.config = {
113
- debug: config.debug ?? false,
114
- headersAllowList: config.headersAllowList,
115
- headersDenyList: config.headersDenyList,
116
- domainAllowList: config.domainAllowList,
117
- domainDenyList: config.domainDenyList,
118
- };
119
- log.info("Initialized PingopsSpanProcessor", {
120
- baseUrl: config.baseUrl,
121
- exportMode,
122
- batchSize: config.batchSize,
123
- batchTimeout: config.batchTimeout,
124
- hasDomainAllowList: !!config.domainAllowList && config.domainAllowList.length > 0,
125
- hasDomainDenyList: !!config.domainDenyList && config.domainDenyList.length > 0,
126
- hasHeadersAllowList: !!config.headersAllowList && config.headersAllowList.length > 0,
127
- hasHeadersDenyList: !!config.headersDenyList && config.headersDenyList.length > 0,
128
- });
129
- }
130
- /**
131
- * Called when a span starts - extracts parent attributes from context and adds them to the span
132
- */
133
- onStart(span, parentContext) {
134
- const spanContext = span.spanContext();
135
- log.debug("Span started", {
136
- spanName: span.name,
137
- spanId: spanContext.spanId,
138
- traceId: spanContext.traceId,
139
- });
140
- // Extract propagated attributes from context and set them on the span
141
- const propagatedAttributes = getPropagatedAttributesFromContext(parentContext);
142
- if (Object.keys(propagatedAttributes).length > 0) {
143
- for (const [key, value] of Object.entries(propagatedAttributes)) {
144
- // Type guard: value must be string or string[] for OpenTelemetry attributes
145
- if (typeof value === "string" || Array.isArray(value)) {
146
- span.setAttribute(key, value);
147
- }
148
- }
149
- log.debug("Set propagated attributes on span", {
150
- spanName: span.name,
151
- attributeKeys: Object.keys(propagatedAttributes),
152
- });
153
- }
154
- this.processor.onStart(span, parentContext);
155
- }
156
- /**
157
- * Called when a span ends. Filters the span and passes it to the underlying processor if eligible.
158
- *
159
- * This method:
160
- * 1. Checks if the span is eligible (CLIENT + HTTP/GenAI attributes)
161
- * 2. Applies domain filtering (determines if span should be exported)
162
- * 3. Applies header filtering via FilteredSpan wrapper (domain-specific and global rules)
163
- * 4. If eligible, passes filtered span to underlying OTLP processor for export
164
- */
165
- onEnd(span) {
166
- const spanContext = span.spanContext();
167
- log.debug("Span ended, processing", {
168
- spanName: span.name,
169
- spanId: spanContext.spanId,
170
- traceId: spanContext.traceId,
171
- spanKind: span.kind,
172
- });
173
- try {
174
- // Step 1: Check if span is eligible (CLIENT + HTTP/GenAI attributes)
175
- if (!isSpanEligible(span)) {
176
- log.debug("Span not eligible, skipping", {
177
- spanName: span.name,
178
- spanId: spanContext.spanId,
179
- reason: "not CLIENT or missing HTTP/GenAI attributes",
180
- });
181
- return;
182
- }
183
- // Step 2: Extract URL for domain filtering
184
- const attributes = span.attributes;
185
- const url = attributes["http.url"] ||
186
- attributes["url.full"] ||
187
- (attributes["server.address"]
188
- ? `https://${String(attributes["server.address"])}`
189
- : "");
190
- log.debug("Extracted URL for domain filtering", {
191
- spanName: span.name,
192
- url,
193
- hasHttpUrl: !!attributes["http.url"],
194
- hasUrlFull: !!attributes["url.full"],
195
- hasServerAddress: !!attributes["server.address"],
196
- });
197
- // Step 3: Apply domain filtering
198
- if (url) {
199
- const shouldCapture = shouldCaptureSpan(url, this.config.domainAllowList, this.config.domainDenyList);
200
- if (!shouldCapture) {
201
- log.info("Span filtered out by domain rules", {
202
- spanName: span.name,
203
- spanId: spanContext.spanId,
204
- url,
205
- });
206
- return;
207
- }
208
- }
209
- else {
210
- log.debug("No URL found for domain filtering, proceeding", {
211
- spanName: span.name,
212
- });
213
- }
214
- // Step 4: Apply filtering (header filtering with domain-specific rules) by wrapping the span
215
- const filteredSpan = createFilteredSpan(span, this.config.domainAllowList, this.config.headersAllowList, this.config.headersDenyList);
216
- // Step 5: Span passed all filters, pass filtered span to underlying processor for export
217
- this.processor.onEnd(filteredSpan);
218
- log.info("Span passed all filters and queued for export", {
219
- spanName: span.name,
220
- spanId: spanContext.spanId,
221
- traceId: spanContext.traceId,
222
- url,
223
- hasHeaderFiltering: !!(this.config.headersAllowList || this.config.headersDenyList),
224
- });
225
- }
226
- catch (error) {
227
- // Defensive error handling - never crash the app
228
- log.error("Error processing span", {
229
- spanName: span.name,
230
- spanId: spanContext.spanId,
231
- error: error instanceof Error ? error.message : String(error),
232
- });
233
- }
234
- }
235
- /**
236
- * Forces an immediate flush of all pending spans.
237
- *
238
- * @returns Promise that resolves when all pending operations are complete
239
- */
240
- async forceFlush() {
241
- log.info("Force flushing spans");
242
- try {
243
- await this.processor.forceFlush();
244
- log.info("Force flush complete");
245
- }
246
- catch (error) {
247
- log.error("Error during force flush", {
248
- error: error instanceof Error ? error.message : String(error),
249
- });
250
- throw error;
251
- }
252
- }
253
- /**
254
- * Gracefully shuts down the processor, ensuring all pending operations are completed.
255
- *
256
- * @returns Promise that resolves when shutdown is complete
257
- */
258
- async shutdown() {
259
- log.info("Shutting down processor");
260
- try {
261
- await this.processor.shutdown();
262
- log.info("Processor shutdown complete");
263
- }
264
- catch (error) {
265
- log.error("Error during processor shutdown", {
266
- error: error instanceof Error ? error.message : String(error),
267
- });
268
- throw error;
269
- }
270
- }
271
- }
272
- //# sourceMappingURL=span-processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"span-processor.js","sourceRoot":"","sources":["../src/span-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAOH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,iBAAiB,EAEjB,YAAY,EACZ,kCAAkC,EAClC,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAGvB,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,SAAS,kBAAkB,CACzB,IAAkB,EAClB,eAA8B,EAC9B,sBAAiC,EACjC,qBAAgC;IAEhC,oDAAoD;IACpD,6EAA6E;IAC7E,MAAM,OAAO,GAAG,kBAAkB,CAChC,IAAI,EACJ,eAAe,EACf,sBAAsB,EACtB,qBAAqB,CACtB,CAAC;IACF,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,UAAU;QAC7C,IAAI,CAAC,UAAU,CAAe,CAAC;IACjC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAElC,kFAAkF;IAClF,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;QACrB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,oDAAoD;YACpD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC1B,OAAO,kBAAkB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