langwatch 0.7.4 → 0.8.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.
Files changed (68) hide show
  1. package/README.md +48 -0
  2. package/dist/{add-XLEUNNZI.mjs → add-3MRUJN46.mjs} +5 -5
  3. package/dist/{add-Y543UEBX.js → add-S6GXVJE5.js} +10 -10
  4. package/dist/{add-Y543UEBX.js.map → add-S6GXVJE5.js.map} +1 -1
  5. package/dist/{chunk-VMI2XPCC.mjs → chunk-2BFLRROK.mjs} +2 -2
  6. package/dist/{chunk-VMI2XPCC.mjs.map → chunk-2BFLRROK.mjs.map} +1 -1
  7. package/dist/{chunk-BKVMRI32.js → chunk-4NB5C6GH.js} +2 -2
  8. package/dist/{chunk-BKVMRI32.js.map → chunk-4NB5C6GH.js.map} +1 -1
  9. package/dist/{chunk-MZ2O5ZJL.js → chunk-4XNHIYPE.js} +121 -32
  10. package/dist/chunk-4XNHIYPE.js.map +1 -0
  11. package/dist/{chunk-GC7VHCU5.js → chunk-BYG3QS2X.js} +35 -72
  12. package/dist/chunk-BYG3QS2X.js.map +1 -0
  13. package/dist/{chunk-HRPIRC67.mjs → chunk-LW62ZSAR.mjs} +109 -20
  14. package/dist/chunk-LW62ZSAR.mjs.map +1 -0
  15. package/dist/{chunk-QPHTXDJ5.mjs → chunk-M57C3BU5.mjs} +2 -2
  16. package/dist/{chunk-J4YLJUX5.js → chunk-PQZCGMWT.js} +9 -9
  17. package/dist/{chunk-J4YLJUX5.js.map → chunk-PQZCGMWT.js.map} +1 -1
  18. package/dist/{chunk-MBXENFRR.mjs → chunk-W3V3NX7P.mjs} +34 -71
  19. package/dist/chunk-W3V3NX7P.mjs.map +1 -0
  20. package/dist/cli/index.js +7 -7
  21. package/dist/cli/index.mjs +7 -7
  22. package/dist/{create-YUOTG2TS.mjs → create-KEEZMNMH.mjs} +2 -2
  23. package/dist/{create-ACGBGFVO.js → create-SWMCGN2Y.js} +3 -3
  24. package/dist/{create-ACGBGFVO.js.map → create-SWMCGN2Y.js.map} +1 -1
  25. package/dist/{implementation-JKO2kHPl.d.ts → implementation-TF91Gn0l.d.ts} +154 -20
  26. package/dist/{implementation-BhgBtqp4.d.mts → implementation-pq0g2B5y.d.mts} +154 -20
  27. package/dist/index.d.mts +3 -2
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.js +11 -11
  30. package/dist/index.mjs +3 -3
  31. package/dist/{init-UFZF26SF.js → init-DWQKRJV4.js} +3 -3
  32. package/dist/{init-UFZF26SF.js.map → init-DWQKRJV4.js.map} +1 -1
  33. package/dist/{init-ED3OW3TK.mjs → init-EHVUZ7TR.mjs} +2 -2
  34. package/dist/{list-LULA2BWM.js → list-HV2QUNQG.js} +7 -7
  35. package/dist/{list-LULA2BWM.js.map → list-HV2QUNQG.js.map} +1 -1
  36. package/dist/{list-5C6V2OEO.mjs → list-XDVFYGVF.mjs} +4 -4
  37. package/dist/{login-XY2RAXYR.mjs → login-AVTZS3NG.mjs} +2 -2
  38. package/dist/{login-RUMQOHW4.js → login-CHJE7P5F.js} +3 -3
  39. package/dist/{login-RUMQOHW4.js.map → login-CHJE7P5F.js.map} +1 -1
  40. package/dist/observability-sdk/index.d.mts +4 -3
  41. package/dist/observability-sdk/index.d.ts +4 -3
  42. package/dist/observability-sdk/index.js +3 -3
  43. package/dist/observability-sdk/index.mjs +2 -2
  44. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  45. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  46. package/dist/observability-sdk/setup/node/index.js +10 -10
  47. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  48. package/dist/{remove-GA3OQ5AQ.mjs → remove-5W3I5SID.mjs} +4 -4
  49. package/dist/{remove-NIEHQCQN.js → remove-XUWNNMPS.js} +6 -6
  50. package/dist/{remove-NIEHQCQN.js.map → remove-XUWNNMPS.js.map} +1 -1
  51. package/dist/{sync-J2FH4OZC.js → sync-DK52GMDG.js} +8 -8
  52. package/dist/{sync-J2FH4OZC.js.map → sync-DK52GMDG.js.map} +1 -1
  53. package/dist/{sync-X3KE2DNE.mjs → sync-DRZDUADJ.mjs} +5 -5
  54. package/dist/{types-DOVKZCnN.d.ts → types-CAQOMGrf.d.ts} +141 -33
  55. package/dist/{types-DoNHhlm6.d.mts → types-DhEYjnRD.d.mts} +141 -33
  56. package/package.json +1 -1
  57. package/dist/chunk-GC7VHCU5.js.map +0 -1
  58. package/dist/chunk-HRPIRC67.mjs.map +0 -1
  59. package/dist/chunk-MBXENFRR.mjs.map +0 -1
  60. package/dist/chunk-MZ2O5ZJL.js.map +0 -1
  61. /package/dist/{add-XLEUNNZI.mjs.map → add-3MRUJN46.mjs.map} +0 -0
  62. /package/dist/{chunk-QPHTXDJ5.mjs.map → chunk-M57C3BU5.mjs.map} +0 -0
  63. /package/dist/{create-YUOTG2TS.mjs.map → create-KEEZMNMH.mjs.map} +0 -0
  64. /package/dist/{init-ED3OW3TK.mjs.map → init-EHVUZ7TR.mjs.map} +0 -0
  65. /package/dist/{list-5C6V2OEO.mjs.map → list-XDVFYGVF.mjs.map} +0 -0
  66. /package/dist/{login-XY2RAXYR.mjs.map → login-AVTZS3NG.mjs.map} +0 -0
  67. /package/dist/{remove-GA3OQ5AQ.mjs.map → remove-5W3I5SID.mjs.map} +0 -0
  68. /package/dist/{sync-X3KE2DNE.mjs.map → sync-DRZDUADJ.mjs.map} +0 -0
@@ -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-DOVKZCnN.js';
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
- includeAllSpans?: boolean;
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
- * This exporter automatically configures:
80
- * - Authorization headers using the provided API key or environment variables/fallback
81
- * - SDK version and language identification headers
82
- * - Proper endpoint configuration for LangWatch ingestion using provided URL or environment variables/fallback
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
- * @example
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
- * // Using environment variables/fallback configuration
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
- * // Using custom options
202
+ * @example Using regex patterns
203
+ * ```typescript
92
204
  * const exporter = new LangWatchTraceExporter({
93
- * apiKey: 'your-api-key',
94
- * endpoint: 'https://custom.langwatch.com'
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 LangWatchExporter instance.
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
- * @param opts - Optional configuration options for the exporter
103
- * @param opts.apiKey - Optional API key for LangWatch authentication. If not provided,
104
- * will use environment variables or fallback configuration.
105
- * @param opts.endpoint - Optional custom endpoint URL for LangWatch ingestion.
106
- * If not provided, will use environment variables or fallback configuration.
107
- * @param opts.includeAllSpans - Deprecated: This option is deprecated and will be removed in a future version
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-DoNHhlm6.mjs';
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
- includeAllSpans?: boolean;
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
- * This exporter automatically configures:
80
- * - Authorization headers using the provided API key or environment variables/fallback
81
- * - SDK version and language identification headers
82
- * - Proper endpoint configuration for LangWatch ingestion using provided URL or environment variables/fallback
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
- * @example
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
- * // Using environment variables/fallback configuration
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
- * // Using custom options
202
+ * @example Using regex patterns
203
+ * ```typescript
92
204
  * const exporter = new LangWatchTraceExporter({
93
- * apiKey: 'your-api-key',
94
- * endpoint: 'https://custom.langwatch.com'
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 LangWatchExporter instance.
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
- * @param opts - Optional configuration options for the exporter
103
- * @param opts.apiKey - Optional API key for LangWatch authentication. If not provided,
104
- * will use environment variables or fallback configuration.
105
- * @param opts.endpoint - Optional custom endpoint URL for LangWatch ingestion.
106
- * If not provided, will use environment variables or fallback configuration.
107
- * @param opts.includeAllSpans - Deprecated: This option is deprecated and will be removed in a future version
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-BhgBtqp4.mjs';
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-DoNHhlm6.mjs';
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-JKO2kHPl.js';
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-DOVKZCnN.js';
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 _chunkJ4YLJUX5js = require('./chunk-J4YLJUX5.js');
7
+ var _chunkPQZCGMWTjs = require('./chunk-PQZCGMWT.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 _chunkMZ2O5ZJLjs = require('./chunk-MZ2O5ZJL.js');
17
+ var _chunk4XNHIYPEjs = require('./chunk-4XNHIYPE.js');
18
18
 
19
19
 
20
20
 
21
21
 
22
- var _chunkBKVMRI32js = require('./chunk-BKVMRI32.js');
22
+ var _chunk4NB5C6GHjs = require('./chunk-4NB5C6GH.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, `${_chunkBKVMRI32js.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunkBKVMRI32js.LANGWATCH_SDK_VERSION);
49
+ var tracer = _chunkBP2WGNIVjs.getLangWatchTracer.call(void 0, `${_chunk4NB5C6GHjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunk4NB5C6GHjs.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 _chunkJ4YLJUX5js.createTracingProxy.call(void 0,
55
+ return _chunkPQZCGMWTjs.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 : _chunkBKVMRI32js.DEFAULT_ENDPOINT;
118
+ const endpoint = (_d = (_c = options.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d : _chunk4NB5C6GHjs.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, _chunkJ4YLJUX5js.PromptsFacade)(_chunkOHM7JUMRjs.__spreadValues.call(void 0, {
125
- promptsApiService: new (0, _chunkJ4YLJUX5js.PromptsApiService)(this.config),
126
- localPromptsService: new (0, _chunkJ4YLJUX5js.LocalPromptsService)()
124
+ this.prompts = new (0, _chunkPQZCGMWTjs.PromptsFacade)(_chunkOHM7JUMRjs.__spreadValues.call(void 0, {
125
+ promptsApiService: new (0, _chunkPQZCGMWTjs.PromptsApiService)(this.config),
126
+ localPromptsService: new (0, _chunkPQZCGMWTjs.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: _chunkJ4YLJUX5js.createLangWatchApiClient.call(void 0, apiKey, endpoint)
143
+ langwatchApiClient: _chunkPQZCGMWTjs.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 = _chunkMZ2O5ZJLjs.LangWatchTraceExporter; exports.attributes = _chunkCKIZDPIJjs.attributes_exports; exports.getLangWatchLogger = _chunkMZ2O5ZJLjs.getLangWatchLogger; exports.getLangWatchTracer = _chunkBP2WGNIVjs.getLangWatchTracer; exports.logger = logger;
160
+ exports.FilterableBatchSpanProcessor = _chunkSNDTNU3Tjs.FilterableBatchSpanProcessor; exports.LangWatch = LangWatch; exports.LangWatchExporter = _chunk4XNHIYPEjs.LangWatchTraceExporter; exports.attributes = _chunkCKIZDPIJjs.attributes_exports; exports.getLangWatchLogger = _chunk4XNHIYPEjs.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-QPHTXDJ5.mjs";
7
+ } from "./chunk-M57C3BU5.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-HRPIRC67.mjs";
17
+ } from "./chunk-LW62ZSAR.mjs";
18
18
  import {
19
19
  DEFAULT_ENDPOINT,
20
20
  LANGWATCH_SDK_NAME_CLIENT,
21
21
  LANGWATCH_SDK_VERSION
22
- } from "./chunk-VMI2XPCC.mjs";
22
+ } from "./chunk-2BFLRROK.mjs";
23
23
  import {
24
24
  ConsoleLogger,
25
25
  NoOpLogger,
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGC7VHCU5js = require('./chunk-GC7VHCU5.js');
3
+ var _chunkBYG3QS2Xjs = require('./chunk-BYG3QS2X.js');
4
4
  require('./chunk-WAAQLJ67.js');
5
5
  require('./chunk-AZHZ4NB4.js');
6
6
  require('./chunk-OHM7JUMR.js');
7
7
 
8
8
  // src/cli/commands/init.ts
9
9
  var initCommand = async () => {
10
- await _chunkGC7VHCU5js.initializeProject.call(void 0, );
10
+ await _chunkBYG3QS2Xjs.initializeProject.call(void 0, );
11
11
  };
12
12
 
13
13
 
14
14
  exports.initCommand = initCommand;
15
- //# sourceMappingURL=init-UFZF26SF.js.map
15
+ //# sourceMappingURL=init-DWQKRJV4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-UFZF26SF.js","../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACLO,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AACpD,EAAA,MAAM,gDAAA,CAAkB;AAC1B,CAAA;ADOA;AACE;AACF,kCAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-UFZF26SF.js","sourcesContent":[null,"import { initializeProject } from \"../utils/init\";\n\nexport const initCommand = async (): Promise<void> => {\n await initializeProject();\n};"]}
1
+ {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-DWQKRJV4.js","../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACLO,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AACpD,EAAA,MAAM,gDAAA,CAAkB;AAC1B,CAAA;ADOA;AACE;AACF,kCAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-DWQKRJV4.js","sourcesContent":[null,"import { initializeProject } from \"../utils/init\";\n\nexport const initCommand = async (): Promise<void> => {\n await initializeProject();\n};"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  initializeProject
3
- } from "./chunk-MBXENFRR.mjs";
3
+ } from "./chunk-W3V3NX7P.mjs";
4
4
  import "./chunk-O6D3W3PG.mjs";
5
5
  import "./chunk-BTBSMJTY.mjs";
6
6
  import "./chunk-URTD2WOC.mjs";
@@ -12,4 +12,4 @@ var initCommand = async () => {
12
12
  export {
13
13
  initCommand
14
14
  };
15
- //# sourceMappingURL=init-ED3OW3TK.mjs.map
15
+ //# sourceMappingURL=init-EHVUZ7TR.mjs.map
@@ -4,11 +4,11 @@ var _chunkF6E4XQQUjs = require('./chunk-F6E4XQQU.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkJ4YLJUX5js = require('./chunk-J4YLJUX5.js');
7
+ var _chunkPQZCGMWTjs = require('./chunk-PQZCGMWT.js');
8
8
  require('./chunk-SNDTNU3T.js');
9
9
  require('./chunk-BP2WGNIV.js');
10
- require('./chunk-MZ2O5ZJL.js');
11
- require('./chunk-BKVMRI32.js');
10
+ require('./chunk-4XNHIYPE.js');
11
+ require('./chunk-4NB5C6GH.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, _chunkJ4YLJUX5js.PromptsApiService)();
82
+ const promptsApiService = new (0, _chunkPQZCGMWTjs.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 _chunkJ4YLJUX5js.PromptsError) {
121
+ if (error instanceof _chunkPQZCGMWTjs.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 _chunkJ4YLJUX5js.PromptsError) {
133
+ if (error instanceof _chunkPQZCGMWTjs.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-LULA2BWM.js.map
148
+ //# sourceMappingURL=list-HV2QUNQG.js.map