@pingops/otel 0.2.6 → 0.4.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 -4
- package/dist/index.cjs +645 -246
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -71
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +34 -71
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +646 -247
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ReadableSpan, Span, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
2
|
import { Attributes, Context, Span as Span$1, TracerProvider } from "@opentelemetry/api";
|
|
3
|
-
import { DomainRule,
|
|
3
|
+
import { DomainRule, HttpTransformConfig } from "@pingops/core";
|
|
4
4
|
import "@opentelemetry/sdk-trace-node";
|
|
5
5
|
import { Instrumentation, InstrumentationBase, InstrumentationConfig } from "@opentelemetry/instrumentation";
|
|
6
6
|
import { HttpInstrumentation, HttpInstrumentationConfig } from "@opentelemetry/instrumentation-http";
|
|
7
7
|
|
|
8
|
+
//#region src/llm/types.d.ts
|
|
9
|
+
type LlmProvider = "openai" | "anthropic" | "gemini" | "xai";
|
|
10
|
+
interface LlmMonitoringConfig {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
streaming?: boolean;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
8
15
|
//#region src/config.d.ts
|
|
9
|
-
|
|
10
16
|
/**
|
|
11
17
|
* Span export mode to use.
|
|
12
18
|
*
|
|
@@ -22,6 +28,11 @@ type PingopsExportMode = "immediate" | "batched";
|
|
|
22
28
|
* Configuration parameters for the PingopsSpanProcessor.
|
|
23
29
|
*/
|
|
24
30
|
interface PingopsProcessorConfig {
|
|
31
|
+
/**
|
|
32
|
+
* PingOps SDK version to attach on exported spans.
|
|
33
|
+
* Intended to be set by @pingops/sdk.
|
|
34
|
+
*/
|
|
35
|
+
sdkVersion?: string;
|
|
25
36
|
/**
|
|
26
37
|
* API key for authentication. Can also be set via PINGOPS_API_KEY environment variable.
|
|
27
38
|
*/
|
|
@@ -39,14 +50,6 @@ interface PingopsProcessorConfig {
|
|
|
39
50
|
* Service name for resource identification (required).
|
|
40
51
|
*/
|
|
41
52
|
serviceName: string;
|
|
42
|
-
/**
|
|
43
|
-
* List of headers to include (case-insensitive).
|
|
44
|
-
*/
|
|
45
|
-
headersAllowList?: string[];
|
|
46
|
-
/**
|
|
47
|
-
* List of headers to exclude (case-insensitive, takes precedence over allow list).
|
|
48
|
-
*/
|
|
49
|
-
headersDenyList?: string[];
|
|
50
53
|
/**
|
|
51
54
|
* Capture request body.
|
|
52
55
|
*/
|
|
@@ -55,26 +58,6 @@ interface PingopsProcessorConfig {
|
|
|
55
58
|
* Capture response body.
|
|
56
59
|
*/
|
|
57
60
|
captureResponseBody?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Maximum size of request body to capture (bytes).
|
|
60
|
-
* Applies to both `http` and `undici` instrumentations.
|
|
61
|
-
*
|
|
62
|
-
* Note: this is the number of raw bytes observed at the instrumentation layer.
|
|
63
|
-
* For compressed bodies, this is the compressed size.
|
|
64
|
-
*
|
|
65
|
-
* @defaultValue 4096 (4 KB)
|
|
66
|
-
*/
|
|
67
|
-
maxRequestBodySize?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Maximum size of response body to capture (bytes).
|
|
70
|
-
* Applies to both `http` and `undici` instrumentations.
|
|
71
|
-
*
|
|
72
|
-
* Note: this is the number of raw bytes observed at the instrumentation layer.
|
|
73
|
-
* For compressed bodies, this is the compressed size.
|
|
74
|
-
*
|
|
75
|
-
* @defaultValue 4096 (4 KB)
|
|
76
|
-
*/
|
|
77
|
-
maxResponseBodySize?: number;
|
|
78
61
|
/**
|
|
79
62
|
* Domain allow list rules.
|
|
80
63
|
*/
|
|
@@ -84,10 +67,14 @@ interface PingopsProcessorConfig {
|
|
|
84
67
|
*/
|
|
85
68
|
domainDenyList?: DomainRule[];
|
|
86
69
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
70
|
+
* LLM monitoring configuration for GenAI semantic attributes and token usage.
|
|
71
|
+
* Disabled by default.
|
|
72
|
+
*/
|
|
73
|
+
llmMonitoring?: LlmMonitoringConfig;
|
|
74
|
+
/**
|
|
75
|
+
* Outbound HTTP transform rules for headers, bodies, and query params.
|
|
89
76
|
*/
|
|
90
|
-
|
|
77
|
+
transforms?: HttpTransformConfig;
|
|
91
78
|
/**
|
|
92
79
|
* Number of spans to batch before flushing (only used in batched mode).
|
|
93
80
|
* @defaultValue 50
|
|
@@ -198,25 +185,19 @@ declare function getInstrumentations(): Instrumentation[];
|
|
|
198
185
|
declare const PingopsSemanticAttributes: {
|
|
199
186
|
HTTP_REQUEST_BODY: string;
|
|
200
187
|
HTTP_RESPONSE_BODY: string;
|
|
188
|
+
HTTP_REQUEST_BODY_SIZE: string;
|
|
189
|
+
HTTP_RESPONSE_BODY_SIZE: string;
|
|
201
190
|
};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Maximum size of request body to capture in bytes
|
|
205
|
-
* @defaultValue 4096 (4 KB)
|
|
206
|
-
*/
|
|
207
|
-
maxRequestBodySize?: number;
|
|
208
|
-
/**
|
|
209
|
-
* Maximum size of response body to capture in bytes
|
|
210
|
-
* @defaultValue 4096 (4 KB)
|
|
211
|
-
*/
|
|
212
|
-
maxResponseBodySize?: number;
|
|
213
|
-
}
|
|
191
|
+
type PingopsInstrumentationConfig = {};
|
|
214
192
|
declare const PingopsHttpSemanticAttributes: {
|
|
215
193
|
HTTP_REQUEST_BODY: string;
|
|
216
194
|
HTTP_RESPONSE_BODY: string;
|
|
195
|
+
HTTP_REQUEST_BODY_SIZE: string;
|
|
196
|
+
HTTP_RESPONSE_BODY_SIZE: string;
|
|
217
197
|
};
|
|
218
198
|
interface PingopsHttpInstrumentationConfig extends HttpInstrumentationConfig, PingopsInstrumentationConfig {}
|
|
219
199
|
declare class PingopsHttpInstrumentation extends HttpInstrumentation {
|
|
200
|
+
private _llmStateByRequest;
|
|
220
201
|
constructor(config?: PingopsHttpInstrumentationConfig);
|
|
221
202
|
/**
|
|
222
203
|
* HttpInstrumentation's span creation is private, so we wrap the instance method
|
|
@@ -266,21 +247,13 @@ interface UndiciResponse {
|
|
|
266
247
|
statusCode: number;
|
|
267
248
|
statusText: string;
|
|
268
249
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
(span: Span$1, info: {
|
|
277
|
-
request: RequestType;
|
|
278
|
-
response: ResponseType;
|
|
279
|
-
}): void;
|
|
280
|
-
}
|
|
281
|
-
interface StartSpanHookFunction<T = UndiciRequest> {
|
|
282
|
-
(request: T): Attributes;
|
|
283
|
-
}
|
|
250
|
+
type IgnoreRequestFunction<T = UndiciRequest> = (request: T) => boolean;
|
|
251
|
+
type RequestHookFunction<T = UndiciRequest> = (span: Span$1, request: T) => void;
|
|
252
|
+
type ResponseHookFunction<RequestType = UndiciRequest, ResponseType = UndiciResponse> = (span: Span$1, info: {
|
|
253
|
+
request: RequestType;
|
|
254
|
+
response: ResponseType;
|
|
255
|
+
}) => void;
|
|
256
|
+
type StartSpanHookFunction<T = UndiciRequest> = (request: T) => Attributes;
|
|
284
257
|
interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType = UndiciResponse> extends InstrumentationConfig {
|
|
285
258
|
/** Not trace all outgoing requests that matched with custom function */
|
|
286
259
|
ignoreRequestHook?: IgnoreRequestFunction<RequestType>;
|
|
@@ -297,16 +270,6 @@ interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType
|
|
|
297
270
|
requestHeaders?: string[];
|
|
298
271
|
responseHeaders?: string[];
|
|
299
272
|
};
|
|
300
|
-
/**
|
|
301
|
-
* Maximum size of request body to capture in bytes
|
|
302
|
-
* @defaultValue 4096 (4 KB)
|
|
303
|
-
*/
|
|
304
|
-
maxRequestBodySize?: number;
|
|
305
|
-
/**
|
|
306
|
-
* Maximum size of response body to capture in bytes
|
|
307
|
-
* @defaultValue 4096 (4 KB)
|
|
308
|
-
*/
|
|
309
|
-
maxResponseBodySize?: number;
|
|
310
273
|
}
|
|
311
274
|
//#endregion
|
|
312
275
|
//#region src/instrumentations/undici/pingops-undici.d.ts
|
|
@@ -342,5 +305,5 @@ declare class UndiciInstrumentation extends InstrumentationBase<UndiciInstrument
|
|
|
342
305
|
*/
|
|
343
306
|
declare function createUndiciInstrumentation(): UndiciInstrumentation;
|
|
344
307
|
//#endregion
|
|
345
|
-
export { PingopsHttpInstrumentation, type PingopsHttpInstrumentationConfig, PingopsHttpSemanticAttributes, type PingopsInstrumentationConfig, type PingopsProcessorConfig, PingopsSemanticAttributes, PingopsSpanProcessor, createHttpInstrumentation, createUndiciInstrumentation, getInstrumentations, getPingopsTracerProvider, setPingopsTracerProvider, shutdownTracerProvider };
|
|
308
|
+
export { type LlmMonitoringConfig, type LlmProvider, PingopsHttpInstrumentation, type PingopsHttpInstrumentationConfig, PingopsHttpSemanticAttributes, type PingopsInstrumentationConfig, type PingopsProcessorConfig, PingopsSemanticAttributes, PingopsSpanProcessor, createHttpInstrumentation, createUndiciInstrumentation, getInstrumentations, getPingopsTracerProvider, setPingopsTracerProvider, shutdownTracerProvider };
|
|
346
309
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/config.ts","../src/span-processor.ts","../src/tracer-provider.ts","../src/instrumentations/index.ts","../src/instrumentations/http/pingops-http.ts","../src/instrumentations/http/http.ts","../src/instrumentations/undici/types.ts","../src/instrumentations/undici/pingops-undici.ts","../src/instrumentations/undici/undici.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/llm/types.ts","../src/config.ts","../src/span-processor.ts","../src/tracer-provider.ts","../src/instrumentations/index.ts","../src/instrumentations/http/pingops-http.ts","../src/instrumentations/http/http.ts","../src/instrumentations/undici/types.ts","../src/instrumentations/undici/pingops-undici.ts","../src/instrumentations/undici/undici.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAEY,WAAA;UAEK,mBAAA;;;;;;;;;AAFjB;AAEA;;;;ACaA;AAKA;AAyCoB,KA9CR,iBAAA,GA8CQ,WAAA,GAAA,SAAA;;;;AAwCL,UAjFE,sBAAA,CAiFF;EAAiB;;;;ECsCnB,UAAA,CAAA,EAAA,MAAA;EAkBS;;;EAsGR,MAAA,CAAA,EAAA,MAAA;EAgGe;;;EAxN6B,OAAA,EAAA,MAAA;;;;AC1C1D;EA6BgB,KAAA,CAAA,EAAA,OAAA;EA2EM;;;;EC1LN;;;;ECgCH;AAMb;AAiUA;EAEiB,mBAAA,CAAA,EAAA,OAAA;EAIJ;;;oBJ/TO;EKRJ;;;EAEb,cAAA,CAAA,ELWgB,UKXhB,EAAA;EAA0B;;;;ECtDZ,aAAA,CAAA,ENuEC,mBMvEY;EAuBb;AAMjB;AAEA;EAAoC,UAAA,CAAA,EN6CrB,mBM7CqB;EAC5B;;;AAIR;EACgB,SAAA,CAAA,EAAA,MAAA;EACC;;;;EAGqC,YAAA,CAAA,EAAA,MAAA;EAG1C;;;;;AAMZ;;;;;EAOoC,UAAA,CAAA,EN2CrB,iBM3CqB;;;;;;AJuCpC;AA6BA;AA2EA;;;cD9Da,oBAAA,YAAgC;EE5H7B,QAAA,SAAA;;;;ACgChB;AAMA;AAiUA;AAEA;EAIa,WAAA,CAAA,MAAA,EH/NS,sBGkOC;;;;EC1UP,OAAA,CAAA,IAAA,EJuKA,IIvKA,EAAA,aAAyB,EJuKJ,OIvKI,CAAA,EAAA,IAAA;EACtB;;;;;;;ACrDnB;AAuBA;EAMY,KAAA,CAAA,IAAA,ELqOE,YKrOmB,CAAA,EAAA,IAAA;EAErB;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|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ReadableSpan, Span, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
|
-
import { DomainRule,
|
|
2
|
+
import { DomainRule, HttpTransformConfig } from "@pingops/core";
|
|
3
3
|
import { Attributes, Context, Span as Span$1, TracerProvider } from "@opentelemetry/api";
|
|
4
4
|
import "@opentelemetry/sdk-trace-node";
|
|
5
5
|
import { HttpInstrumentation, HttpInstrumentationConfig } from "@opentelemetry/instrumentation-http";
|
|
6
6
|
import { Instrumentation, InstrumentationBase, InstrumentationConfig } from "@opentelemetry/instrumentation";
|
|
7
7
|
|
|
8
|
+
//#region src/llm/types.d.ts
|
|
9
|
+
type LlmProvider = "openai" | "anthropic" | "gemini" | "xai";
|
|
10
|
+
interface LlmMonitoringConfig {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
streaming?: boolean;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
8
15
|
//#region src/config.d.ts
|
|
9
|
-
|
|
10
16
|
/**
|
|
11
17
|
* Span export mode to use.
|
|
12
18
|
*
|
|
@@ -22,6 +28,11 @@ type PingopsExportMode = "immediate" | "batched";
|
|
|
22
28
|
* Configuration parameters for the PingopsSpanProcessor.
|
|
23
29
|
*/
|
|
24
30
|
interface PingopsProcessorConfig {
|
|
31
|
+
/**
|
|
32
|
+
* PingOps SDK version to attach on exported spans.
|
|
33
|
+
* Intended to be set by @pingops/sdk.
|
|
34
|
+
*/
|
|
35
|
+
sdkVersion?: string;
|
|
25
36
|
/**
|
|
26
37
|
* API key for authentication. Can also be set via PINGOPS_API_KEY environment variable.
|
|
27
38
|
*/
|
|
@@ -39,14 +50,6 @@ interface PingopsProcessorConfig {
|
|
|
39
50
|
* Service name for resource identification (required).
|
|
40
51
|
*/
|
|
41
52
|
serviceName: string;
|
|
42
|
-
/**
|
|
43
|
-
* List of headers to include (case-insensitive).
|
|
44
|
-
*/
|
|
45
|
-
headersAllowList?: string[];
|
|
46
|
-
/**
|
|
47
|
-
* List of headers to exclude (case-insensitive, takes precedence over allow list).
|
|
48
|
-
*/
|
|
49
|
-
headersDenyList?: string[];
|
|
50
53
|
/**
|
|
51
54
|
* Capture request body.
|
|
52
55
|
*/
|
|
@@ -55,26 +58,6 @@ interface PingopsProcessorConfig {
|
|
|
55
58
|
* Capture response body.
|
|
56
59
|
*/
|
|
57
60
|
captureResponseBody?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Maximum size of request body to capture (bytes).
|
|
60
|
-
* Applies to both `http` and `undici` instrumentations.
|
|
61
|
-
*
|
|
62
|
-
* Note: this is the number of raw bytes observed at the instrumentation layer.
|
|
63
|
-
* For compressed bodies, this is the compressed size.
|
|
64
|
-
*
|
|
65
|
-
* @defaultValue 4096 (4 KB)
|
|
66
|
-
*/
|
|
67
|
-
maxRequestBodySize?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Maximum size of response body to capture (bytes).
|
|
70
|
-
* Applies to both `http` and `undici` instrumentations.
|
|
71
|
-
*
|
|
72
|
-
* Note: this is the number of raw bytes observed at the instrumentation layer.
|
|
73
|
-
* For compressed bodies, this is the compressed size.
|
|
74
|
-
*
|
|
75
|
-
* @defaultValue 4096 (4 KB)
|
|
76
|
-
*/
|
|
77
|
-
maxResponseBodySize?: number;
|
|
78
61
|
/**
|
|
79
62
|
* Domain allow list rules.
|
|
80
63
|
*/
|
|
@@ -84,10 +67,14 @@ interface PingopsProcessorConfig {
|
|
|
84
67
|
*/
|
|
85
68
|
domainDenyList?: DomainRule[];
|
|
86
69
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
70
|
+
* LLM monitoring configuration for GenAI semantic attributes and token usage.
|
|
71
|
+
* Disabled by default.
|
|
72
|
+
*/
|
|
73
|
+
llmMonitoring?: LlmMonitoringConfig;
|
|
74
|
+
/**
|
|
75
|
+
* Outbound HTTP transform rules for headers, bodies, and query params.
|
|
89
76
|
*/
|
|
90
|
-
|
|
77
|
+
transforms?: HttpTransformConfig;
|
|
91
78
|
/**
|
|
92
79
|
* Number of spans to batch before flushing (only used in batched mode).
|
|
93
80
|
* @defaultValue 50
|
|
@@ -198,25 +185,19 @@ declare function getInstrumentations(): Instrumentation[];
|
|
|
198
185
|
declare const PingopsSemanticAttributes: {
|
|
199
186
|
HTTP_REQUEST_BODY: string;
|
|
200
187
|
HTTP_RESPONSE_BODY: string;
|
|
188
|
+
HTTP_REQUEST_BODY_SIZE: string;
|
|
189
|
+
HTTP_RESPONSE_BODY_SIZE: string;
|
|
201
190
|
};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Maximum size of request body to capture in bytes
|
|
205
|
-
* @defaultValue 4096 (4 KB)
|
|
206
|
-
*/
|
|
207
|
-
maxRequestBodySize?: number;
|
|
208
|
-
/**
|
|
209
|
-
* Maximum size of response body to capture in bytes
|
|
210
|
-
* @defaultValue 4096 (4 KB)
|
|
211
|
-
*/
|
|
212
|
-
maxResponseBodySize?: number;
|
|
213
|
-
}
|
|
191
|
+
type PingopsInstrumentationConfig = {};
|
|
214
192
|
declare const PingopsHttpSemanticAttributes: {
|
|
215
193
|
HTTP_REQUEST_BODY: string;
|
|
216
194
|
HTTP_RESPONSE_BODY: string;
|
|
195
|
+
HTTP_REQUEST_BODY_SIZE: string;
|
|
196
|
+
HTTP_RESPONSE_BODY_SIZE: string;
|
|
217
197
|
};
|
|
218
198
|
interface PingopsHttpInstrumentationConfig extends HttpInstrumentationConfig, PingopsInstrumentationConfig {}
|
|
219
199
|
declare class PingopsHttpInstrumentation extends HttpInstrumentation {
|
|
200
|
+
private _llmStateByRequest;
|
|
220
201
|
constructor(config?: PingopsHttpInstrumentationConfig);
|
|
221
202
|
/**
|
|
222
203
|
* HttpInstrumentation's span creation is private, so we wrap the instance method
|
|
@@ -266,21 +247,13 @@ interface UndiciResponse {
|
|
|
266
247
|
statusCode: number;
|
|
267
248
|
statusText: string;
|
|
268
249
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
(span: Span$1, info: {
|
|
277
|
-
request: RequestType;
|
|
278
|
-
response: ResponseType;
|
|
279
|
-
}): void;
|
|
280
|
-
}
|
|
281
|
-
interface StartSpanHookFunction<T = UndiciRequest> {
|
|
282
|
-
(request: T): Attributes;
|
|
283
|
-
}
|
|
250
|
+
type IgnoreRequestFunction<T = UndiciRequest> = (request: T) => boolean;
|
|
251
|
+
type RequestHookFunction<T = UndiciRequest> = (span: Span$1, request: T) => void;
|
|
252
|
+
type ResponseHookFunction<RequestType = UndiciRequest, ResponseType = UndiciResponse> = (span: Span$1, info: {
|
|
253
|
+
request: RequestType;
|
|
254
|
+
response: ResponseType;
|
|
255
|
+
}) => void;
|
|
256
|
+
type StartSpanHookFunction<T = UndiciRequest> = (request: T) => Attributes;
|
|
284
257
|
interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType = UndiciResponse> extends InstrumentationConfig {
|
|
285
258
|
/** Not trace all outgoing requests that matched with custom function */
|
|
286
259
|
ignoreRequestHook?: IgnoreRequestFunction<RequestType>;
|
|
@@ -297,16 +270,6 @@ interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType
|
|
|
297
270
|
requestHeaders?: string[];
|
|
298
271
|
responseHeaders?: string[];
|
|
299
272
|
};
|
|
300
|
-
/**
|
|
301
|
-
* Maximum size of request body to capture in bytes
|
|
302
|
-
* @defaultValue 4096 (4 KB)
|
|
303
|
-
*/
|
|
304
|
-
maxRequestBodySize?: number;
|
|
305
|
-
/**
|
|
306
|
-
* Maximum size of response body to capture in bytes
|
|
307
|
-
* @defaultValue 4096 (4 KB)
|
|
308
|
-
*/
|
|
309
|
-
maxResponseBodySize?: number;
|
|
310
273
|
}
|
|
311
274
|
//#endregion
|
|
312
275
|
//#region src/instrumentations/undici/pingops-undici.d.ts
|
|
@@ -342,5 +305,5 @@ declare class UndiciInstrumentation extends InstrumentationBase<UndiciInstrument
|
|
|
342
305
|
*/
|
|
343
306
|
declare function createUndiciInstrumentation(): UndiciInstrumentation;
|
|
344
307
|
//#endregion
|
|
345
|
-
export { PingopsHttpInstrumentation, type PingopsHttpInstrumentationConfig, PingopsHttpSemanticAttributes, type PingopsInstrumentationConfig, type PingopsProcessorConfig, PingopsSemanticAttributes, PingopsSpanProcessor, createHttpInstrumentation, createUndiciInstrumentation, getInstrumentations, getPingopsTracerProvider, setPingopsTracerProvider, shutdownTracerProvider };
|
|
308
|
+
export { type LlmMonitoringConfig, type LlmProvider, PingopsHttpInstrumentation, type PingopsHttpInstrumentationConfig, PingopsHttpSemanticAttributes, type PingopsInstrumentationConfig, type PingopsProcessorConfig, PingopsSemanticAttributes, PingopsSpanProcessor, createHttpInstrumentation, createUndiciInstrumentation, getInstrumentations, getPingopsTracerProvider, setPingopsTracerProvider, shutdownTracerProvider };
|
|
346
309
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/config.ts","../src/span-processor.ts","../src/tracer-provider.ts","../src/instrumentations/index.ts","../src/instrumentations/http/pingops-http.ts","../src/instrumentations/http/http.ts","../src/instrumentations/undici/types.ts","../src/instrumentations/undici/pingops-undici.ts","../src/instrumentations/undici/undici.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/llm/types.ts","../src/config.ts","../src/span-processor.ts","../src/tracer-provider.ts","../src/instrumentations/index.ts","../src/instrumentations/http/pingops-http.ts","../src/instrumentations/http/http.ts","../src/instrumentations/undici/types.ts","../src/instrumentations/undici/pingops-undici.ts","../src/instrumentations/undici/undici.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAEY,WAAA;UAEK,mBAAA;;;;;;;;;AAFjB;AAEA;;;;ACaA;AAKA;AAyCoB,KA9CR,iBAAA,GA8CQ,WAAA,GAAA,SAAA;;;;AAwCL,UAjFE,sBAA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