langwatch 0.7.4 → 0.8.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 +48 -0
- package/dist/{add-XLEUNNZI.mjs → add-TMFGG3SC.mjs} +4 -4
- package/dist/{add-Y543UEBX.js → add-VOEIH432.js} +7 -7
- package/dist/{add-Y543UEBX.js.map → add-VOEIH432.js.map} +1 -1
- package/dist/{chunk-BKVMRI32.js → chunk-B5K6DU6G.js} +2 -2
- package/dist/{chunk-BKVMRI32.js.map → chunk-B5K6DU6G.js.map} +1 -1
- package/dist/{chunk-VMI2XPCC.mjs → chunk-GMQHOSEU.mjs} +2 -2
- package/dist/{chunk-VMI2XPCC.mjs.map → chunk-GMQHOSEU.mjs.map} +1 -1
- package/dist/{chunk-QPHTXDJ5.mjs → chunk-SC4YBWRM.mjs} +2 -2
- package/dist/{chunk-HRPIRC67.mjs → chunk-VH7IIHFW.mjs} +109 -20
- package/dist/chunk-VH7IIHFW.mjs.map +1 -0
- package/dist/{chunk-MZ2O5ZJL.js → chunk-VWZCWYRH.js} +121 -32
- package/dist/chunk-VWZCWYRH.js.map +1 -0
- package/dist/{chunk-J4YLJUX5.js → chunk-XHNJY5BP.js} +9 -9
- package/dist/{chunk-J4YLJUX5.js.map → chunk-XHNJY5BP.js.map} +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/cli/index.mjs +5 -5
- package/dist/{implementation-JKO2kHPl.d.ts → implementation-TF91Gn0l.d.ts} +154 -20
- package/dist/{implementation-BhgBtqp4.d.mts → implementation-pq0g2B5y.d.mts} +154 -20
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +11 -11
- package/dist/index.mjs +3 -3
- package/dist/{list-LULA2BWM.js → list-42DGIFAC.js} +7 -7
- package/dist/{list-LULA2BWM.js.map → list-42DGIFAC.js.map} +1 -1
- package/dist/{list-5C6V2OEO.mjs → list-KDYBQLVU.mjs} +4 -4
- package/dist/{login-RUMQOHW4.js → login-IRO5FBZI.js} +3 -3
- package/dist/{login-RUMQOHW4.js.map → login-IRO5FBZI.js.map} +1 -1
- package/dist/{login-XY2RAXYR.mjs → login-RNWEYFQK.mjs} +2 -2
- package/dist/observability-sdk/index.d.mts +4 -3
- package/dist/observability-sdk/index.d.ts +4 -3
- package/dist/observability-sdk/index.js +3 -3
- package/dist/observability-sdk/index.mjs +2 -2
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
- package/dist/observability-sdk/setup/node/index.js +10 -10
- package/dist/observability-sdk/setup/node/index.mjs +2 -2
- package/dist/{remove-NIEHQCQN.js → remove-5EXAIGBX.js} +6 -6
- package/dist/{remove-NIEHQCQN.js.map → remove-5EXAIGBX.js.map} +1 -1
- package/dist/{remove-GA3OQ5AQ.mjs → remove-UWKI7GIJ.mjs} +4 -4
- package/dist/{sync-J2FH4OZC.js → sync-MOBSZVYV.js} +6 -6
- package/dist/{sync-J2FH4OZC.js.map → sync-MOBSZVYV.js.map} +1 -1
- package/dist/{sync-X3KE2DNE.mjs → sync-WJSJIKEW.mjs} +4 -4
- package/dist/{types-DOVKZCnN.d.ts → types-CAQOMGrf.d.ts} +141 -33
- package/dist/{types-DoNHhlm6.d.mts → types-DhEYjnRD.d.mts} +141 -33
- package/package.json +1 -1
- package/dist/chunk-HRPIRC67.mjs.map +0 -1
- package/dist/chunk-MZ2O5ZJL.js.map +0 -1
- /package/dist/{add-XLEUNNZI.mjs.map → add-TMFGG3SC.mjs.map} +0 -0
- /package/dist/{chunk-QPHTXDJ5.mjs.map → chunk-SC4YBWRM.mjs.map} +0 -0
- /package/dist/{list-5C6V2OEO.mjs.map → list-KDYBQLVU.mjs.map} +0 -0
- /package/dist/{login-XY2RAXYR.mjs.map → login-RNWEYFQK.mjs.map} +0 -0
- /package/dist/{remove-GA3OQ5AQ.mjs.map → remove-UWKI7GIJ.mjs.map} +0 -0
- /package/dist/{sync-X3KE2DNE.mjs.map → sync-WJSJIKEW.mjs.map} +0 -0
package/dist/cli/index.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import { config } from "dotenv";
|
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
config();
|
|
11
11
|
var addCommand = async (name, options) => {
|
|
12
|
-
const { addCommand: addCommandImpl } = await import("../add-
|
|
12
|
+
const { addCommand: addCommandImpl } = await import("../add-TMFGG3SC.mjs");
|
|
13
13
|
return addCommandImpl(name, options);
|
|
14
14
|
};
|
|
15
15
|
var removeCommand = async (name) => {
|
|
16
|
-
const { removeCommand: removeCommandImpl } = await import("../remove-
|
|
16
|
+
const { removeCommand: removeCommandImpl } = await import("../remove-UWKI7GIJ.mjs");
|
|
17
17
|
return removeCommandImpl(name);
|
|
18
18
|
};
|
|
19
19
|
var initCommand = async () => {
|
|
@@ -21,15 +21,15 @@ var initCommand = async () => {
|
|
|
21
21
|
return initCommandImpl();
|
|
22
22
|
};
|
|
23
23
|
var loginCommand = async () => {
|
|
24
|
-
const { loginCommand: loginCommandImpl } = await import("../login-
|
|
24
|
+
const { loginCommand: loginCommandImpl } = await import("../login-RNWEYFQK.mjs");
|
|
25
25
|
return loginCommandImpl();
|
|
26
26
|
};
|
|
27
27
|
var listCommand = async () => {
|
|
28
|
-
const { listCommand: listCommandImpl } = await import("../list-
|
|
28
|
+
const { listCommand: listCommandImpl } = await import("../list-KDYBQLVU.mjs");
|
|
29
29
|
return listCommandImpl();
|
|
30
30
|
};
|
|
31
31
|
var syncCommand = async () => {
|
|
32
|
-
const { syncCommand: syncCommandImpl } = await import("../sync-
|
|
32
|
+
const { syncCommand: syncCommandImpl } = await import("../sync-WJSJIKEW.mjs");
|
|
33
33
|
return syncCommandImpl();
|
|
34
34
|
};
|
|
35
35
|
var createCommand = async (name, options) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BatchSpanProcessor, SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
2
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
3
4
|
import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
|
|
4
5
|
import { a as SemConvLogRecordAttributes, S as SemConvAttributes } from './types-DRiQaKFG.js';
|
|
5
6
|
import { TracerProvider } from '@opentelemetry/api';
|
|
6
|
-
import { a as LangWatchTracer } from './types-
|
|
7
|
+
import { a as LangWatchTracer } from './types-CAQOMGrf.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Filterable Batch Span Exporter for OpenTelemetry
|
|
@@ -66,48 +67,181 @@ declare class FilterableBatchSpanProcessor extends BatchSpanProcessor {
|
|
|
66
67
|
onEnd(span: ReadableSpan): void;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
interface Criteria {
|
|
71
|
+
instrumentationScopeName?: Match[];
|
|
72
|
+
name?: Match[];
|
|
73
|
+
}
|
|
74
|
+
interface Match {
|
|
75
|
+
equals?: string;
|
|
76
|
+
startsWith?: string;
|
|
77
|
+
matches?: RegExp;
|
|
78
|
+
ignoreCase?: boolean;
|
|
79
|
+
}
|
|
80
|
+
type TraceFilter = {
|
|
81
|
+
preset: "vercelAIOnly" | "excludeHttpRequests";
|
|
82
|
+
} | {
|
|
83
|
+
include: Criteria;
|
|
84
|
+
} | {
|
|
85
|
+
exclude: Criteria;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Configuration options for the LangWatchTraceExporter.
|
|
90
|
+
*
|
|
91
|
+
* @property endpoint - Custom LangWatch endpoint URL. Falls back to LANGWATCH_ENDPOINT env var or default.
|
|
92
|
+
* @property apiKey - API key for authentication. Falls back to LANGWATCH_API_KEY env var.
|
|
93
|
+
* @property filters - Array of filters applied sequentially to spans before export.
|
|
94
|
+
* Default: `[{ preset: "excludeHttpRequests" }]` to reduce framework noise.
|
|
95
|
+
* Pass `null` or `[]` to disable all filtering.
|
|
96
|
+
*/
|
|
69
97
|
interface LangWatchTraceExporterOptions {
|
|
70
98
|
endpoint?: string;
|
|
71
99
|
apiKey?: string;
|
|
72
|
-
|
|
73
|
-
debug?: boolean;
|
|
100
|
+
filters?: TraceFilter[] | null;
|
|
74
101
|
}
|
|
102
|
+
|
|
75
103
|
/**
|
|
76
104
|
* LangWatchTraceExporter extends the OpenTelemetry OTLP HTTP trace exporter
|
|
77
105
|
* to send trace data to LangWatch with proper authentication and metadata headers.
|
|
78
106
|
*
|
|
79
|
-
*
|
|
80
|
-
* -
|
|
81
|
-
* - SDK version and
|
|
82
|
-
* - Proper endpoint
|
|
107
|
+
* ## Features
|
|
108
|
+
* - Automatic authorization header configuration via API key
|
|
109
|
+
* - SDK version and runtime identification headers
|
|
110
|
+
* - Proper endpoint URL construction for LangWatch ingestion
|
|
111
|
+
* - Intent-based span filtering with presets and custom criteria
|
|
83
112
|
*
|
|
84
|
-
*
|
|
113
|
+
* ## Filtering Behavior
|
|
114
|
+
* - **Default**: HTTP request spans are excluded to reduce framework noise
|
|
115
|
+
* - **Pipeline**: Filters are applied sequentially with AND semantics
|
|
116
|
+
* - **Matching**: All string comparisons are case-sensitive by default
|
|
117
|
+
* - **Array Syntax**: All criteria require arrays of Match objects for explicit filtering
|
|
118
|
+
*
|
|
119
|
+
* ## Filter Types
|
|
120
|
+
* - **Presets**: Pre-configured common filters (`vercelAIOnly`, `excludeHttpRequests`)
|
|
121
|
+
* - **Include**: Keep only spans matching criteria (OR within field, AND across fields)
|
|
122
|
+
* - **Exclude**: Remove spans matching criteria (OR within field, AND across fields)
|
|
123
|
+
*
|
|
124
|
+
* @example Basic usage with default filtering
|
|
85
125
|
* ```typescript
|
|
86
126
|
* import { LangWatchTraceExporter } from '@langwatch/observability';
|
|
87
127
|
*
|
|
88
|
-
* //
|
|
128
|
+
* // Default: excludes HTTP request spans
|
|
89
129
|
* const exporter = new LangWatchTraceExporter();
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example Using presets
|
|
133
|
+
* ```typescript
|
|
134
|
+
* // Keep only Vercel AI SDK spans
|
|
135
|
+
* const exporterAI = new LangWatchTraceExporter({
|
|
136
|
+
* filters: [{ preset: 'vercelAIOnly' }],
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* // Explicitly exclude HTTP requests (same as default)
|
|
140
|
+
* const exporterNoHttp = new LangWatchTraceExporter({
|
|
141
|
+
* filters: [{ preset: 'excludeHttpRequests' }],
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* // No filtering at all (send all spans)
|
|
145
|
+
* const exporterAll = new LangWatchTraceExporter({
|
|
146
|
+
* filters: null, // or filters: []
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example Custom filtering with criteria
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Include only spans with specific scope
|
|
153
|
+
* const exporter1 = new LangWatchTraceExporter({
|
|
154
|
+
* filters: [
|
|
155
|
+
* { include: { instrumentationScopeName: [{ equals: 'ai' }] } }
|
|
156
|
+
* ],
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* // Exclude spans by name pattern
|
|
160
|
+
* const exporter2 = new LangWatchTraceExporter({
|
|
161
|
+
* filters: [
|
|
162
|
+
* { exclude: { name: [{ startsWith: 'internal.' }] } }
|
|
163
|
+
* ],
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* // Case-insensitive matching
|
|
167
|
+
* const exporter3 = new LangWatchTraceExporter({
|
|
168
|
+
* filters: [
|
|
169
|
+
* { include: { name: [{ equals: 'chat.completion', ignoreCase: true }] } }
|
|
170
|
+
* ],
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @example Filter pipelines (AND semantics)
|
|
175
|
+
* ```typescript
|
|
176
|
+
* // Keep AI spans, then remove HTTP requests
|
|
177
|
+
* const exporter = new LangWatchTraceExporter({
|
|
178
|
+
* filters: [
|
|
179
|
+
* { include: { instrumentationScopeName: [{ equals: 'ai' }] } },
|
|
180
|
+
* { preset: 'excludeHttpRequests' },
|
|
181
|
+
* ],
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @example OR semantics within a field
|
|
186
|
+
* ```typescript
|
|
187
|
+
* // Include spans with name starting with 'chat.' OR 'llm.'
|
|
188
|
+
* const exporter = new LangWatchTraceExporter({
|
|
189
|
+
* filters: [
|
|
190
|
+
* {
|
|
191
|
+
* include: {
|
|
192
|
+
* name: [
|
|
193
|
+
* { startsWith: 'chat.' },
|
|
194
|
+
* { startsWith: 'llm.' }
|
|
195
|
+
* ]
|
|
196
|
+
* }
|
|
197
|
+
* }
|
|
198
|
+
* ],
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
90
201
|
*
|
|
91
|
-
*
|
|
202
|
+
* @example Using regex patterns
|
|
203
|
+
* ```typescript
|
|
92
204
|
* const exporter = new LangWatchTraceExporter({
|
|
93
|
-
*
|
|
94
|
-
*
|
|
205
|
+
* filters: [
|
|
206
|
+
* {
|
|
207
|
+
* include: {
|
|
208
|
+
* name: [{ matches: /^(chat|llm)\./i }]
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* ],
|
|
95
212
|
* });
|
|
96
213
|
* ```
|
|
97
214
|
*/
|
|
98
215
|
declare class LangWatchTraceExporter extends OTLPTraceExporter {
|
|
216
|
+
private readonly filters;
|
|
99
217
|
/**
|
|
100
|
-
* Creates a new
|
|
218
|
+
* Creates a new LangWatchTraceExporter instance.
|
|
219
|
+
*
|
|
220
|
+
* @param opts - Configuration options for the exporter
|
|
221
|
+
* @param opts.apiKey - API key for LangWatch authentication.
|
|
222
|
+
* Falls back to `LANGWATCH_API_KEY` environment variable, then empty string.
|
|
223
|
+
* @param opts.endpoint - Custom endpoint URL for LangWatch ingestion.
|
|
224
|
+
* Falls back to `LANGWATCH_ENDPOINT` environment variable, then default endpoint.
|
|
225
|
+
* @param opts.filters - Array of filters applied sequentially to spans before export (AND semantics).
|
|
226
|
+
* When omitted, defaults to `[{ preset: "excludeHttpRequests" }]`.
|
|
227
|
+
* Pass `null` or `[]` to disable all filtering and send all spans.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* // With API key and default filtering
|
|
232
|
+
* const exporter = new LangWatchTraceExporter({
|
|
233
|
+
* apiKey: 'your-api-key'
|
|
234
|
+
* });
|
|
101
235
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @param opts.debug - Deprecated: This option is deprecated and will be removed in a future version
|
|
236
|
+
* // With custom endpoint and no filtering
|
|
237
|
+
* const exporter = new LangWatchTraceExporter({
|
|
238
|
+
* endpoint: 'https://custom.langwatch.ai',
|
|
239
|
+
* filters: null
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
109
242
|
*/
|
|
110
243
|
constructor(opts?: LangWatchTraceExporterOptions);
|
|
244
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
111
245
|
}
|
|
112
246
|
|
|
113
247
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BatchSpanProcessor, SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
2
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
3
4
|
import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
|
|
4
5
|
import { a as SemConvLogRecordAttributes, S as SemConvAttributes } from './types-DRiQaKFG.mjs';
|
|
5
6
|
import { TracerProvider } from '@opentelemetry/api';
|
|
6
|
-
import { a as LangWatchTracer } from './types-
|
|
7
|
+
import { a as LangWatchTracer } from './types-DhEYjnRD.mjs';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Filterable Batch Span Exporter for OpenTelemetry
|
|
@@ -66,48 +67,181 @@ declare class FilterableBatchSpanProcessor extends BatchSpanProcessor {
|
|
|
66
67
|
onEnd(span: ReadableSpan): void;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
interface Criteria {
|
|
71
|
+
instrumentationScopeName?: Match[];
|
|
72
|
+
name?: Match[];
|
|
73
|
+
}
|
|
74
|
+
interface Match {
|
|
75
|
+
equals?: string;
|
|
76
|
+
startsWith?: string;
|
|
77
|
+
matches?: RegExp;
|
|
78
|
+
ignoreCase?: boolean;
|
|
79
|
+
}
|
|
80
|
+
type TraceFilter = {
|
|
81
|
+
preset: "vercelAIOnly" | "excludeHttpRequests";
|
|
82
|
+
} | {
|
|
83
|
+
include: Criteria;
|
|
84
|
+
} | {
|
|
85
|
+
exclude: Criteria;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Configuration options for the LangWatchTraceExporter.
|
|
90
|
+
*
|
|
91
|
+
* @property endpoint - Custom LangWatch endpoint URL. Falls back to LANGWATCH_ENDPOINT env var or default.
|
|
92
|
+
* @property apiKey - API key for authentication. Falls back to LANGWATCH_API_KEY env var.
|
|
93
|
+
* @property filters - Array of filters applied sequentially to spans before export.
|
|
94
|
+
* Default: `[{ preset: "excludeHttpRequests" }]` to reduce framework noise.
|
|
95
|
+
* Pass `null` or `[]` to disable all filtering.
|
|
96
|
+
*/
|
|
69
97
|
interface LangWatchTraceExporterOptions {
|
|
70
98
|
endpoint?: string;
|
|
71
99
|
apiKey?: string;
|
|
72
|
-
|
|
73
|
-
debug?: boolean;
|
|
100
|
+
filters?: TraceFilter[] | null;
|
|
74
101
|
}
|
|
102
|
+
|
|
75
103
|
/**
|
|
76
104
|
* LangWatchTraceExporter extends the OpenTelemetry OTLP HTTP trace exporter
|
|
77
105
|
* to send trace data to LangWatch with proper authentication and metadata headers.
|
|
78
106
|
*
|
|
79
|
-
*
|
|
80
|
-
* -
|
|
81
|
-
* - SDK version and
|
|
82
|
-
* - Proper endpoint
|
|
107
|
+
* ## Features
|
|
108
|
+
* - Automatic authorization header configuration via API key
|
|
109
|
+
* - SDK version and runtime identification headers
|
|
110
|
+
* - Proper endpoint URL construction for LangWatch ingestion
|
|
111
|
+
* - Intent-based span filtering with presets and custom criteria
|
|
83
112
|
*
|
|
84
|
-
*
|
|
113
|
+
* ## Filtering Behavior
|
|
114
|
+
* - **Default**: HTTP request spans are excluded to reduce framework noise
|
|
115
|
+
* - **Pipeline**: Filters are applied sequentially with AND semantics
|
|
116
|
+
* - **Matching**: All string comparisons are case-sensitive by default
|
|
117
|
+
* - **Array Syntax**: All criteria require arrays of Match objects for explicit filtering
|
|
118
|
+
*
|
|
119
|
+
* ## Filter Types
|
|
120
|
+
* - **Presets**: Pre-configured common filters (`vercelAIOnly`, `excludeHttpRequests`)
|
|
121
|
+
* - **Include**: Keep only spans matching criteria (OR within field, AND across fields)
|
|
122
|
+
* - **Exclude**: Remove spans matching criteria (OR within field, AND across fields)
|
|
123
|
+
*
|
|
124
|
+
* @example Basic usage with default filtering
|
|
85
125
|
* ```typescript
|
|
86
126
|
* import { LangWatchTraceExporter } from '@langwatch/observability';
|
|
87
127
|
*
|
|
88
|
-
* //
|
|
128
|
+
* // Default: excludes HTTP request spans
|
|
89
129
|
* const exporter = new LangWatchTraceExporter();
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example Using presets
|
|
133
|
+
* ```typescript
|
|
134
|
+
* // Keep only Vercel AI SDK spans
|
|
135
|
+
* const exporterAI = new LangWatchTraceExporter({
|
|
136
|
+
* filters: [{ preset: 'vercelAIOnly' }],
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* // Explicitly exclude HTTP requests (same as default)
|
|
140
|
+
* const exporterNoHttp = new LangWatchTraceExporter({
|
|
141
|
+
* filters: [{ preset: 'excludeHttpRequests' }],
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* // No filtering at all (send all spans)
|
|
145
|
+
* const exporterAll = new LangWatchTraceExporter({
|
|
146
|
+
* filters: null, // or filters: []
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example Custom filtering with criteria
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Include only spans with specific scope
|
|
153
|
+
* const exporter1 = new LangWatchTraceExporter({
|
|
154
|
+
* filters: [
|
|
155
|
+
* { include: { instrumentationScopeName: [{ equals: 'ai' }] } }
|
|
156
|
+
* ],
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* // Exclude spans by name pattern
|
|
160
|
+
* const exporter2 = new LangWatchTraceExporter({
|
|
161
|
+
* filters: [
|
|
162
|
+
* { exclude: { name: [{ startsWith: 'internal.' }] } }
|
|
163
|
+
* ],
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* // Case-insensitive matching
|
|
167
|
+
* const exporter3 = new LangWatchTraceExporter({
|
|
168
|
+
* filters: [
|
|
169
|
+
* { include: { name: [{ equals: 'chat.completion', ignoreCase: true }] } }
|
|
170
|
+
* ],
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @example Filter pipelines (AND semantics)
|
|
175
|
+
* ```typescript
|
|
176
|
+
* // Keep AI spans, then remove HTTP requests
|
|
177
|
+
* const exporter = new LangWatchTraceExporter({
|
|
178
|
+
* filters: [
|
|
179
|
+
* { include: { instrumentationScopeName: [{ equals: 'ai' }] } },
|
|
180
|
+
* { preset: 'excludeHttpRequests' },
|
|
181
|
+
* ],
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @example OR semantics within a field
|
|
186
|
+
* ```typescript
|
|
187
|
+
* // Include spans with name starting with 'chat.' OR 'llm.'
|
|
188
|
+
* const exporter = new LangWatchTraceExporter({
|
|
189
|
+
* filters: [
|
|
190
|
+
* {
|
|
191
|
+
* include: {
|
|
192
|
+
* name: [
|
|
193
|
+
* { startsWith: 'chat.' },
|
|
194
|
+
* { startsWith: 'llm.' }
|
|
195
|
+
* ]
|
|
196
|
+
* }
|
|
197
|
+
* }
|
|
198
|
+
* ],
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
90
201
|
*
|
|
91
|
-
*
|
|
202
|
+
* @example Using regex patterns
|
|
203
|
+
* ```typescript
|
|
92
204
|
* const exporter = new LangWatchTraceExporter({
|
|
93
|
-
*
|
|
94
|
-
*
|
|
205
|
+
* filters: [
|
|
206
|
+
* {
|
|
207
|
+
* include: {
|
|
208
|
+
* name: [{ matches: /^(chat|llm)\./i }]
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* ],
|
|
95
212
|
* });
|
|
96
213
|
* ```
|
|
97
214
|
*/
|
|
98
215
|
declare class LangWatchTraceExporter extends OTLPTraceExporter {
|
|
216
|
+
private readonly filters;
|
|
99
217
|
/**
|
|
100
|
-
* Creates a new
|
|
218
|
+
* Creates a new LangWatchTraceExporter instance.
|
|
219
|
+
*
|
|
220
|
+
* @param opts - Configuration options for the exporter
|
|
221
|
+
* @param opts.apiKey - API key for LangWatch authentication.
|
|
222
|
+
* Falls back to `LANGWATCH_API_KEY` environment variable, then empty string.
|
|
223
|
+
* @param opts.endpoint - Custom endpoint URL for LangWatch ingestion.
|
|
224
|
+
* Falls back to `LANGWATCH_ENDPOINT` environment variable, then default endpoint.
|
|
225
|
+
* @param opts.filters - Array of filters applied sequentially to spans before export (AND semantics).
|
|
226
|
+
* When omitted, defaults to `[{ preset: "excludeHttpRequests" }]`.
|
|
227
|
+
* Pass `null` or `[]` to disable all filtering and send all spans.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* // With API key and default filtering
|
|
232
|
+
* const exporter = new LangWatchTraceExporter({
|
|
233
|
+
* apiKey: 'your-api-key'
|
|
234
|
+
* });
|
|
101
235
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @param opts.debug - Deprecated: This option is deprecated and will be removed in a future version
|
|
236
|
+
* // With custom endpoint and no filtering
|
|
237
|
+
* const exporter = new LangWatchTraceExporter({
|
|
238
|
+
* endpoint: 'https://custom.langwatch.ai',
|
|
239
|
+
* filters: null
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
109
242
|
*/
|
|
110
243
|
constructor(opts?: LangWatchTraceExporterOptions);
|
|
244
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
111
245
|
}
|
|
112
246
|
|
|
113
247
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.mjs';
|
|
2
|
-
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchTracer } from './implementation-
|
|
2
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchTracer } from './implementation-pq0g2B5y.mjs';
|
|
3
3
|
export { l as attributes } from './types-DRiQaKFG.mjs';
|
|
4
|
-
import { p as paths, P as PromptResponse, g as CreatePromptBody, U as UpdatePromptBody, h as PromptData, i as Prompt } from './types-
|
|
4
|
+
import { p as paths, P as PromptResponse, g as CreatePromptBody, U as UpdatePromptBody, h as PromptData, i as Prompt } from './types-DhEYjnRD.mjs';
|
|
5
5
|
import openApiCreateClient from 'openapi-fetch';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import '@opentelemetry/sdk-trace-base';
|
|
8
8
|
import '@opentelemetry/exporter-trace-otlp-http';
|
|
9
|
+
import '@opentelemetry/core';
|
|
9
10
|
import '@opentelemetry/api-logs';
|
|
10
11
|
import '@opentelemetry/api';
|
|
11
12
|
import '@opentelemetry/semantic-conventions';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.js';
|
|
2
|
-
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchTracer } from './implementation-
|
|
2
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchTracer } from './implementation-TF91Gn0l.js';
|
|
3
3
|
export { l as attributes } from './types-DRiQaKFG.js';
|
|
4
|
-
import { p as paths, P as PromptResponse, g as CreatePromptBody, U as UpdatePromptBody, h as PromptData, i as Prompt } from './types-
|
|
4
|
+
import { p as paths, P as PromptResponse, g as CreatePromptBody, U as UpdatePromptBody, h as PromptData, i as Prompt } from './types-CAQOMGrf.js';
|
|
5
5
|
import openApiCreateClient from 'openapi-fetch';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import '@opentelemetry/sdk-trace-base';
|
|
8
8
|
import '@opentelemetry/exporter-trace-otlp-http';
|
|
9
|
+
import '@opentelemetry/core';
|
|
9
10
|
import '@opentelemetry/api-logs';
|
|
10
11
|
import '@opentelemetry/api';
|
|
11
12
|
import '@opentelemetry/semantic-conventions';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkXHNJY5BPjs = require('./chunk-XHNJY5BP.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkSNDTNU3Tjs = require('./chunk-SNDTNU3T.js');
|
|
@@ -14,12 +14,12 @@ var _chunkBP2WGNIVjs = require('./chunk-BP2WGNIV.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkVWZCWYRHjs = require('./chunk-VWZCWYRH.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkB5K6DU6Gjs = require('./chunk-B5K6DU6G.js');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -46,13 +46,13 @@ var TracesError = class extends Error {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// src/client-sdk/services/traces/tracing/tracer.ts
|
|
49
|
-
var tracer = _chunkBP2WGNIVjs.getLangWatchTracer.call(void 0, `${
|
|
49
|
+
var tracer = _chunkBP2WGNIVjs.getLangWatchTracer.call(void 0, `${_chunkB5K6DU6Gjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunkB5K6DU6Gjs.LANGWATCH_SDK_VERSION);
|
|
50
50
|
|
|
51
51
|
// src/client-sdk/services/traces/service.ts
|
|
52
52
|
var TracesService = class {
|
|
53
53
|
constructor(config) {
|
|
54
54
|
this.config = config;
|
|
55
|
-
return
|
|
55
|
+
return _chunkXHNJY5BPjs.createTracingProxy.call(void 0,
|
|
56
56
|
this,
|
|
57
57
|
tracer
|
|
58
58
|
);
|
|
@@ -115,15 +115,15 @@ var LangWatch = class {
|
|
|
115
115
|
_chunkOHM7JUMRjs.__privateAdd.call(void 0, this, _LangWatch_instances);
|
|
116
116
|
var _a, _b, _c, _d;
|
|
117
117
|
const apiKey = (_b = (_a = options.apiKey) != null ? _a : process.env.LANGWATCH_API_KEY) != null ? _b : "";
|
|
118
|
-
const endpoint = (_d = (_c = options.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d :
|
|
118
|
+
const endpoint = (_d = (_c = options.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d : _chunkB5K6DU6Gjs.DEFAULT_ENDPOINT;
|
|
119
119
|
this.config = _chunkOHM7JUMRjs.__privateMethod.call(void 0, this, _LangWatch_instances, createInternalConfig_fn).call(this, {
|
|
120
120
|
apiKey,
|
|
121
121
|
endpoint,
|
|
122
122
|
options: options.options
|
|
123
123
|
});
|
|
124
|
-
this.prompts = new (0,
|
|
125
|
-
promptsApiService: new (0,
|
|
126
|
-
localPromptsService: new (0,
|
|
124
|
+
this.prompts = new (0, _chunkXHNJY5BPjs.PromptsFacade)(_chunkOHM7JUMRjs.__spreadValues.call(void 0, {
|
|
125
|
+
promptsApiService: new (0, _chunkXHNJY5BPjs.PromptsApiService)(this.config),
|
|
126
|
+
localPromptsService: new (0, _chunkXHNJY5BPjs.LocalPromptsService)()
|
|
127
127
|
}, this.config));
|
|
128
128
|
this.traces = new TracesFacade(this.config);
|
|
129
129
|
}
|
|
@@ -140,7 +140,7 @@ createInternalConfig_fn = function({
|
|
|
140
140
|
var _a;
|
|
141
141
|
return {
|
|
142
142
|
logger: (_a = options == null ? void 0 : options.logger) != null ? _a : new (0, _chunkCKIZDPIJjs.NoOpLogger)(),
|
|
143
|
-
langwatchApiClient:
|
|
143
|
+
langwatchApiClient: _chunkXHNJY5BPjs.createLangWatchApiClient.call(void 0, apiKey, endpoint)
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
146
|
|
|
@@ -157,5 +157,5 @@ var logger = {
|
|
|
157
157
|
|
|
158
158
|
|
|
159
159
|
|
|
160
|
-
exports.FilterableBatchSpanProcessor = _chunkSNDTNU3Tjs.FilterableBatchSpanProcessor; exports.LangWatch = LangWatch; exports.LangWatchExporter =
|
|
160
|
+
exports.FilterableBatchSpanProcessor = _chunkSNDTNU3Tjs.FilterableBatchSpanProcessor; exports.LangWatch = LangWatch; exports.LangWatchExporter = _chunkVWZCWYRHjs.LangWatchTraceExporter; exports.attributes = _chunkCKIZDPIJjs.attributes_exports; exports.getLangWatchLogger = _chunkVWZCWYRHjs.getLangWatchLogger; exports.getLangWatchTracer = _chunkBP2WGNIVjs.getLangWatchTracer; exports.logger = logger;
|
|
161
161
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PromptsFacade,
|
|
5
5
|
createLangWatchApiClient,
|
|
6
6
|
createTracingProxy
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SC4YBWRM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FilterableBatchSpanProcessor
|
|
10
10
|
} from "./chunk-FEL5FLHA.mjs";
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
LangWatchTraceExporter,
|
|
16
16
|
getLangWatchLogger
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VH7IIHFW.mjs";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_ENDPOINT,
|
|
20
20
|
LANGWATCH_SDK_NAME_CLIENT,
|
|
21
21
|
LANGWATCH_SDK_VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GMQHOSEU.mjs";
|
|
23
23
|
import {
|
|
24
24
|
ConsoleLogger,
|
|
25
25
|
NoOpLogger,
|
|
@@ -4,11 +4,11 @@ var _chunkF6E4XQQUjs = require('./chunk-F6E4XQQU.js');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkXHNJY5BPjs = require('./chunk-XHNJY5BP.js');
|
|
8
8
|
require('./chunk-SNDTNU3T.js');
|
|
9
9
|
require('./chunk-BP2WGNIV.js');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-VWZCWYRH.js');
|
|
11
|
+
require('./chunk-B5K6DU6G.js');
|
|
12
12
|
require('./chunk-CKIZDPIJ.js');
|
|
13
13
|
require('./chunk-WAAQLJ67.js');
|
|
14
14
|
require('./chunk-AZHZ4NB4.js');
|
|
@@ -79,7 +79,7 @@ var formatRelativeTime = (dateString) => {
|
|
|
79
79
|
var listCommand = async () => {
|
|
80
80
|
try {
|
|
81
81
|
_chunkF6E4XQQUjs.checkApiKey.call(void 0, );
|
|
82
|
-
const promptsApiService = new (0,
|
|
82
|
+
const promptsApiService = new (0, _chunkXHNJY5BPjs.PromptsApiService)();
|
|
83
83
|
const spinner = _ora2.default.call(void 0, "Fetching prompts from server...").start();
|
|
84
84
|
try {
|
|
85
85
|
const allPrompts = await promptsApiService.getAll();
|
|
@@ -118,7 +118,7 @@ var listCommand = async () => {
|
|
|
118
118
|
);
|
|
119
119
|
} catch (error) {
|
|
120
120
|
spinner.fail();
|
|
121
|
-
if (error instanceof
|
|
121
|
+
if (error instanceof _chunkXHNJY5BPjs.PromptsError) {
|
|
122
122
|
console.error(_chalk2.default.red(`Error: ${error.message}`));
|
|
123
123
|
} else {
|
|
124
124
|
console.error(
|
|
@@ -130,7 +130,7 @@ var listCommand = async () => {
|
|
|
130
130
|
process.exit(1);
|
|
131
131
|
}
|
|
132
132
|
} catch (error) {
|
|
133
|
-
if (error instanceof
|
|
133
|
+
if (error instanceof _chunkXHNJY5BPjs.PromptsError) {
|
|
134
134
|
console.error(_chalk2.default.red(`Error: ${error.message}`));
|
|
135
135
|
} else {
|
|
136
136
|
console.error(
|
|
@@ -145,4 +145,4 @@ var listCommand = async () => {
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
exports.listCommand = listCommand;
|
|
148
|
-
//# sourceMappingURL=list-
|
|
148
|
+
//# sourceMappingURL=list-42DGIFAC.js.map
|