langwatch 1.18.0 → 1.20.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.
Files changed (91) hide show
  1. package/README.md +25 -11
  2. package/dist/agent/index.d.mts +122 -79
  3. package/dist/agent/index.d.ts +122 -79
  4. package/dist/agent/index.js +523 -300
  5. package/dist/agent/index.js.map +1 -1
  6. package/dist/agent/index.mjs +522 -301
  7. package/dist/agent/index.mjs.map +1 -1
  8. package/dist/chunk-5VYEG3RS.js +117 -0
  9. package/dist/chunk-5VYEG3RS.js.map +1 -0
  10. package/dist/{chunk-O4J3ZPZY.js → chunk-5ZNEXSAB.js} +7912 -2564
  11. package/dist/chunk-5ZNEXSAB.js.map +1 -0
  12. package/dist/chunk-BDQ2RG7R.mjs +852 -0
  13. package/dist/chunk-BDQ2RG7R.mjs.map +1 -0
  14. package/dist/chunk-BL3GHEKF.js +59 -0
  15. package/dist/chunk-BL3GHEKF.js.map +1 -0
  16. package/dist/chunk-C7IWJ2GJ.mjs +59 -0
  17. package/dist/chunk-C7IWJ2GJ.mjs.map +1 -0
  18. package/dist/chunk-EQ5CFQGJ.js +852 -0
  19. package/dist/chunk-EQ5CFQGJ.js.map +1 -0
  20. package/dist/{chunk-NPEK4RSD.mjs → chunk-ET5KYCG2.mjs} +7757 -2409
  21. package/dist/chunk-ET5KYCG2.mjs.map +1 -0
  22. package/dist/{chunk-MVQJMRM6.mjs → chunk-FKYYEGJ7.mjs} +120 -112
  23. package/dist/chunk-FKYYEGJ7.mjs.map +1 -0
  24. package/dist/{chunk-JJASOJOK.js → chunk-HCK7TCSK.js} +138 -130
  25. package/dist/chunk-HCK7TCSK.js.map +1 -0
  26. package/dist/{chunk-LCG5Y2EG.js → chunk-N76BG37W.js} +15 -101
  27. package/dist/chunk-N76BG37W.js.map +1 -0
  28. package/dist/chunk-SERULD4Z.mjs +117 -0
  29. package/dist/chunk-SERULD4Z.mjs.map +1 -0
  30. package/dist/{chunk-73QOHSHU.js → chunk-WDUUAIG3.js} +2 -2
  31. package/dist/chunk-WDUUAIG3.js.map +1 -0
  32. package/dist/{chunk-WMDQVWA6.mjs → chunk-WSGVZ3J2.mjs} +22 -108
  33. package/dist/chunk-WSGVZ3J2.mjs.map +1 -0
  34. package/dist/{chunk-57L2K66L.mjs → chunk-XQ4CP2JK.mjs} +2 -2
  35. package/dist/chunk-XQ4CP2JK.mjs.map +1 -0
  36. package/dist/cli/bundle.js +766 -479
  37. package/dist/implementation-B4Z2ksnA.d.mts +261 -0
  38. package/dist/implementation-BFUgzz5C.d.ts +261 -0
  39. package/dist/index.d.mts +398 -1123
  40. package/dist/index.d.ts +398 -1123
  41. package/dist/index.js +7613 -3566
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +7419 -3372
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/observability-sdk/index.d.mts +16 -76
  46. package/dist/observability-sdk/index.d.ts +16 -76
  47. package/dist/observability-sdk/index.js +8 -5
  48. package/dist/observability-sdk/index.js.map +1 -1
  49. package/dist/observability-sdk/index.mjs +8 -5
  50. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +3 -5
  51. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +3 -5
  52. package/dist/observability-sdk/instrumentation/langchain/index.js +160 -112
  53. package/dist/observability-sdk/instrumentation/langchain/index.js.map +1 -1
  54. package/dist/observability-sdk/instrumentation/langchain/index.mjs +148 -100
  55. package/dist/observability-sdk/instrumentation/langchain/index.mjs.map +1 -1
  56. package/dist/observability-sdk/semconv/index.d.mts +37 -0
  57. package/dist/observability-sdk/semconv/index.d.ts +37 -0
  58. package/dist/observability-sdk/semconv/index.js +121 -0
  59. package/dist/observability-sdk/semconv/index.js.map +1 -0
  60. package/dist/observability-sdk/semconv/index.mjs +121 -0
  61. package/dist/observability-sdk/semconv/index.mjs.map +1 -0
  62. package/dist/observability-sdk/setup/node/index.d.mts +73 -313
  63. package/dist/observability-sdk/setup/node/index.d.ts +73 -313
  64. package/dist/observability-sdk/setup/node/index.js +6 -4
  65. package/dist/observability-sdk/setup/node/index.js.map +1 -1
  66. package/dist/observability-sdk/setup/node/index.mjs +5 -3
  67. package/dist/types-B696jWYQ.d.mts +16010 -0
  68. package/dist/types-Bo6OvFct.d.ts +16010 -0
  69. package/dist/{types-VOZv9LYO.d.mts → types-CoS5PmeU.d.mts} +22 -59
  70. package/dist/{types-VOZv9LYO.d.ts → types-CoS5PmeU.d.ts} +22 -59
  71. package/dist/{types-DLfhJb38.d.mts → types-RkiBQZ9j.d.mts} +1 -6
  72. package/dist/{types-DLfhJb38.d.ts → types-RkiBQZ9j.d.ts} +1 -6
  73. package/dist/values-1yj9l0Sa.d.mts +112 -0
  74. package/dist/values-1yj9l0Sa.d.ts +112 -0
  75. package/package.json +95 -64
  76. package/dist/chunk-57L2K66L.mjs.map +0 -1
  77. package/dist/chunk-73QOHSHU.js.map +0 -1
  78. package/dist/chunk-HY2N6TO5.mjs +0 -566
  79. package/dist/chunk-HY2N6TO5.mjs.map +0 -1
  80. package/dist/chunk-JJASOJOK.js.map +0 -1
  81. package/dist/chunk-LCG5Y2EG.js.map +0 -1
  82. package/dist/chunk-MVQJMRM6.mjs.map +0 -1
  83. package/dist/chunk-NPEK4RSD.mjs.map +0 -1
  84. package/dist/chunk-O4J3ZPZY.js.map +0 -1
  85. package/dist/chunk-UEJSGC3P.js +0 -566
  86. package/dist/chunk-UEJSGC3P.js.map +0 -1
  87. package/dist/chunk-WMDQVWA6.mjs.map +0 -1
  88. package/dist/implementation-BvX-7vox.d.ts +0 -716
  89. package/dist/implementation-CQ__V0Vc.d.mts +0 -716
  90. package/dist/types-CNEUr6Hm.d.ts +0 -36682
  91. package/dist/types-DfPAHmAh.d.mts +0 -36682
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "langwatch",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "author": "LangWatch",
9
5
  "license": "MIT",
10
- "engines": {
11
- "node": ">=20",
12
- "pnpm": ">=8"
6
+ "author": "LangWatch",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/langwatch/langwatch.git",
10
+ "directory": "typescript-sdk"
11
+ },
12
+ "bin": {
13
+ "langwatch": "./dist/cli/index.js",
14
+ "lw": "./dist/cli/index.js"
13
15
  },
14
16
  "files": [
15
17
  "dist",
@@ -18,10 +20,9 @@
18
20
  "README.md",
19
21
  "LICENSE"
20
22
  ],
21
- "bin": {
22
- "lw": "./dist/cli/index.js",
23
- "langwatch": "./dist/cli/index.js"
24
- },
23
+ "main": "dist/index.js",
24
+ "module": "dist/index.mjs",
25
+ "types": "dist/index.d.ts",
25
26
  "exports": {
26
27
  ".": {
27
28
  "types": "./dist/index.d.ts",
@@ -33,6 +34,11 @@
33
34
  "require": "./dist/observability-sdk/index.js",
34
35
  "import": "./dist/observability-sdk/index.mjs"
35
36
  },
37
+ "./observability/semconv": {
38
+ "types": "./dist/observability-sdk/semconv/index.d.ts",
39
+ "require": "./dist/observability-sdk/semconv/index.js",
40
+ "import": "./dist/observability-sdk/semconv/index.mjs"
41
+ },
36
42
  "./observability/node": {
37
43
  "types": "./dist/observability-sdk/setup/node/index.d.ts",
38
44
  "require": "./dist/observability-sdk/setup/node/index.js",
@@ -49,79 +55,78 @@
49
55
  "import": "./dist/agent/index.mjs"
50
56
  }
51
57
  },
52
- "repository": {
53
- "type": "git",
54
- "url": "https://github.com/langwatch/langwatch.git",
55
- "directory": "typescript-sdk"
58
+ "dependencies": {
59
+ "@opentelemetry/api-logs": "0.221.0",
60
+ "@opentelemetry/context-async-hooks": "2.10.0",
61
+ "@opentelemetry/core": "2.10.0",
62
+ "@opentelemetry/exporter-logs-otlp-proto": "0.221.0",
63
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.221.0",
64
+ "@opentelemetry/otlp-exporter-base": "0.221.0",
65
+ "@opentelemetry/resources": "^2.8.0",
66
+ "@opentelemetry/sdk-logs": "^0.221.0",
67
+ "@opentelemetry/sdk-trace-base": "2.10.0",
68
+ "@opentelemetry/sdk-trace-node": "2.10.0",
69
+ "liquidjs": "^10.27.1",
70
+ "open": "^11.0.0",
71
+ "openapi-fetch": "^0.17.0",
72
+ "ws": "^8.21.0",
73
+ "xksuid": "^0.0.4",
74
+ "zod": "^4.6.7"
56
75
  },
57
76
  "devDependencies": {
58
77
  "@eslint/js": "^9.32.0",
59
78
  "@langchain/core": ">=0.3.68 <0.4.0",
60
79
  "@langchain/langgraph": ">=0.4.0 <1.0.0",
61
80
  "@langchain/openai": ">=0.6.0 <1.0.0",
62
- "@opentelemetry/sdk-node": "0.221.0",
63
- "@opentelemetry/sdk-trace-node": "^2.0.1",
64
- "@opentelemetry/sdk-trace-web": ">=2.0.1",
65
- "@types/debug": "^4.1.12",
81
+ "@langwatch/e2e-stack": "0.0.1",
82
+ "@langwatch/handled-error": "0.1.0",
83
+ "@opentelemetry/api": "^1.9.1",
84
+ "@opentelemetry/instrumentation": "^0.221.0",
85
+ "@opentelemetry/sdk-metrics": "^2.8.0",
86
+ "@opentelemetry/sdk-trace-web": "2.10.0",
87
+ "@types/debug": "^4.1.13",
66
88
  "@types/js-yaml": "^4.0.9",
67
89
  "@types/node": "^26.2.0",
68
90
  "@types/prompts": "^2.4.9",
69
91
  "@types/ws": "^8.18.1",
92
+ "@typescript-eslint/parser": "^8.58.1",
70
93
  "@vercel/otel": "^1.13.0",
71
- "@vitest/coverage-v8": "^4.1.0",
94
+ "@vitest/coverage-v8": "^5.0.1",
95
+ "chalk": "^6.0.0",
96
+ "cloudflared": "0.7.1",
97
+ "commander": "^15.0.0",
98
+ "dotenv": "^17.4.2",
72
99
  "dotenv-cli": "^11.0.0",
73
- "esbuild": "^0.28.1",
100
+ "esbuild": "^0.28.2",
74
101
  "eslint": "^9.32.0",
75
102
  "fets": "^0.8.5",
76
103
  "fishery": "^2.3.1",
104
+ "js-yaml": "^5.2.0",
105
+ "jsonc-parser": "^3.3.1",
77
106
  "langchain": ">=0.3.0 <2.0.0",
78
107
  "msw": "^2.10.4",
79
108
  "nock": "^14.0.8",
80
109
  "openapi-msw": "^1.2.0",
81
110
  "openapi-typescript": "7.13.0",
111
+ "ora": "^9.3.0",
112
+ "prompts": "^2.4.2",
82
113
  "tsup": "^8.5.0",
83
114
  "typescript": "^6.0.3",
84
- "typescript-eslint": "^8.38.0",
85
- "vitest": "^4.1.0",
115
+ "typescript-eslint": "^8.55.0",
116
+ "vitest": "^5.0.1",
86
117
  "vitest-mock-extended": "^5.1.1",
87
- "yaml": "^2.8.1",
88
- "@langwatch/langy": "0.1.0"
89
- },
90
- "dependencies": {
91
- "@opentelemetry/api": "^1.9.0",
92
- "@opentelemetry/api-logs": "0.221.0",
93
- "@opentelemetry/core": "^2.0.1",
94
- "@opentelemetry/exporter-logs-otlp-http": "0.221.0",
95
- "@opentelemetry/exporter-trace-otlp-http": "0.221.0",
96
- "@opentelemetry/instrumentation": "0.221.0",
97
- "@opentelemetry/resources": "^2.0.1",
98
- "@opentelemetry/sdk-logs": "0.221.0",
99
- "@opentelemetry/sdk-metrics": "^2.0.1",
100
- "@opentelemetry/sdk-node": "^0.221.0",
101
- "@opentelemetry/sdk-trace-base": "^2.0.1",
102
- "@opentelemetry/semantic-conventions": "^1.36.0",
103
- "chalk": "^6.0.0",
104
- "cloudflared": "0.7.1",
105
- "commander": "^15.0.0",
106
- "dotenv": "^17.3.1",
107
- "js-yaml": "^5.2.0",
108
- "jsonc-parser": "^3.3.1",
109
- "liquidjs": "^10.27.0",
110
- "open": "^11.0.0",
111
- "openapi-fetch": "^0.17.0",
112
- "ora": "^9.3.0",
113
- "prompts": "^2.4.2",
114
- "ws": "^8.21.0",
115
- "xksuid": "^0.0.4",
116
- "zod": "^4.0.14"
118
+ "yaml": "^2.8.1"
117
119
  },
118
120
  "peerDependencies": {
119
121
  "@ai-sdk/openai": ">=2.0.0 <5.0.0",
120
122
  "@langchain/core": ">=0.3.0 <2.0.0",
121
123
  "@langchain/langgraph": ">=0.4.0 <2.0.0",
122
124
  "@langchain/openai": ">=0.6.0 <2.0.0",
123
- "@opentelemetry/context-async-hooks": "^2.1.0",
125
+ "@opentelemetry/api": "^1.9.0",
124
126
  "@opentelemetry/context-zone": ">=1.19.0 <3.0.0",
127
+ "@opentelemetry/exporter-trace-otlp-grpc": ">=0.221.0 <1.0.0",
128
+ "@opentelemetry/instrumentation": ">=0.200.0 <1.0.0",
129
+ "@opentelemetry/sdk-metrics": ">=2.0.0 <3.0.0",
125
130
  "@opentelemetry/sdk-trace-web": ">=1.19.0 <3.0.0",
126
131
  "langchain": ">=0.3.0 <2.0.0"
127
132
  },
@@ -138,10 +143,16 @@
138
143
  "@langchain/openai": {
139
144
  "optional": true
140
145
  },
141
- "@opentelemetry/context-async-hooks": {
146
+ "@opentelemetry/context-zone": {
142
147
  "optional": true
143
148
  },
144
- "@opentelemetry/context-zone": {
149
+ "@opentelemetry/exporter-trace-otlp-grpc": {
150
+ "optional": true
151
+ },
152
+ "@opentelemetry/instrumentation": {
153
+ "optional": true
154
+ },
155
+ "@opentelemetry/sdk-metrics": {
145
156
  "optional": true
146
157
  },
147
158
  "@opentelemetry/sdk-trace-web": {
@@ -151,25 +162,45 @@
151
162
  "optional": true
152
163
  }
153
164
  },
165
+ "engines": {
166
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1",
167
+ "pnpm": ">=8"
168
+ },
169
+ "nx": {
170
+ "namedInputs": {
171
+ "sdkBuild": [
172
+ "default",
173
+ "!{projectRoot}/**/*.test.ts",
174
+ "!{projectRoot}/**/*.test.tsx",
175
+ "!{projectRoot}/**/*.test.mts",
176
+ "!{projectRoot}/vitest.config.*",
177
+ "!{projectRoot}/vitest.integration.config.*",
178
+ "!{projectRoot}/__tests__/**/*"
179
+ ],
180
+ "production": [
181
+ "sdkBuild",
182
+ "!{projectRoot}/src/cli/**/*"
183
+ ]
184
+ }
185
+ },
154
186
  "scripts": {
155
- "generate": "pnpm run generate:server-types && pnpm run generate:openapi-types",
187
+ "generate": "pnpm run generate:server-types",
156
188
  "cli": "node dist/cli/index.js",
157
189
  "prelint": "pnpm run generate",
158
190
  "lint": "eslint .",
159
191
  "pretest": "pnpm run generate",
160
- "test": "vitest",
161
- "test:unit": "vitest run --exclude '**/*.integration.test.ts'",
192
+ "test": "vitest run --exclude '**/*.integration.test.ts'",
162
193
  "test:e2e": "dotenv -- vitest run -c ./vitest.e2e.config.mts",
163
194
  "test:governance-e2e": "vitest run -c ./vitest.governance-e2e.config.mts",
164
- "test:seed": "dotenv -e .env.test -- bash -c 'cd ../../platform/app && pnpm prisma:seed'",
195
+ "test:seed": "dotenv -e .env.test -- pnpm -w run prisma:seed",
165
196
  "prebuild": "pnpm run generate",
166
- "build": "tsc --noEmit && rm -rf dist && tsup",
197
+ "build": "rm -rf dist && tsup",
167
198
  "postbuild": "node -e \"const{statSync}=require('node:fs'),{execFileSync}=require('node:child_process');const f='dist/cli/index.js',want=require('./package.json').version;const s=statSync(f);if(process.platform!=='win32'&&!(s.mode&0o111))throw new Error(f+' is not executable');const got=execFileSync(process.execPath,[f,'--version'],{encoding:'utf8',env:{...process.env,LANGWATCH_NO_DAEMON:'1'}}).trim();if(got!==want)throw new Error('version mismatch: '+f+' reports '+got+', package.json says '+want);console.log('postbuild: '+f+' ok ('+got+')')\"",
168
199
  "build:binary": "bun run scripts/build-cli-binary.ts",
169
200
  "tarball": "pnpm build && pnpm pack",
170
- "typecheck": "tsc --noEmit",
201
+ "typecheck": "GOMAXPROCS=2 GOMEMLIMIT=2GiB pnpm -w exec tsc -b sdks/typescript",
171
202
  "prepublish": "pnpm run build",
172
- "generate:openapi-types": "pnpm exec openapi-typescript ../../platform/app/src/app/api/openapiLangWatch.json -o ./src/internal/generated/openapi/api-client.ts && node scripts/patch-generated-openapi.mjs",
203
+ "generate:openapi-types": "node scripts/generate-openapi-types.mjs",
173
204
  "generate:server-types": "./copy-types.sh"
174
205
  }
175
206
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observability-sdk/processors/filterable-batch-span-processor.ts","../src/observability-sdk/features/data-capture/presets.ts"],"sourcesContent":["/**\n * Filterable Batch Span Exporter for OpenTelemetry\n *\n * This module provides a BatchSpanProcessor subclass that allows filtering of spans before export\n * based on configurable rules. Spans matching any exclude rule are dropped and not exported.\n *\n * @module filterable-batch-span-exporter\n */\n\nimport {\n BatchSpanProcessor,\n type ReadableSpan,\n type SpanExporter,\n} from '@opentelemetry/sdk-trace-base';\n\n/**\n * A rule for excluding spans from export based on their name or instrumentation scope name.\n *\n * @property fieldName - The span field to match against ('span_name' or 'instrumentation_scope_name').\n * @property matchValue - The value to match against the field.\n * @property matchOperation - The operation to use for matching ('includes', 'exact_match', 'starts_with', 'ends_with').\n *\n * @example\n * const rule: SpanProcessingExcludeRule = {\n * fieldName: 'span_name',\n * matchValue: 'heartbeat',\n * matchOperation: 'exact_match',\n * };\n */\nexport interface SpanProcessingExcludeRule {\n fieldName: \"span_name\" | \"instrumentation_scope_name\";\n matchValue: string;\n matchOperation: \"includes\" | \"exact_match\" | \"starts_with\" | \"ends_with\";\n}\n\n/**\n * A BatchSpanProcessor that filters out spans matching any of the provided exclude rules before export.\n *\n * This is useful for dropping noisy or irrelevant spans (e.g., health checks, heartbeats) from being exported to your tracing backend.\n *\n * @example\n * import { FilterableBatchSpanProcessor } from './filterable-batch-span-exporter';\n * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\n *\n * const exporter = new OTLPTraceExporter({ url: '...' });\n * const filters = [\n * { fieldName: 'span_name', matchValue: 'heartbeat', matchOperation: 'exact_match' },\n * { fieldName: 'instrumentation_scope_name', matchValue: 'internal', matchOperation: 'starts_with' },\n * ];\n * provider.addSpanProcessor(new FilterableBatchSpanProcessor(exporter, filters));\n */\nexport class FilterableBatchSpanProcessor extends BatchSpanProcessor {\n private readonly _filters: SpanProcessingExcludeRule[];\n\n /**\n * Create a new FilterableBatchSpanProcessor.\n *\n * @param exporter - The underlying SpanExporter to use for exporting spans.\n * @param filters - An array of rules for excluding spans from export.\n */\n constructor(exporter: SpanExporter, filters: SpanProcessingExcludeRule[]) {\n super(exporter);\n this._filters = filters;\n }\n\n /**\n * Called when a span ends. If the span matches any exclude rule, it is dropped and not exported.\n *\n * @param span - The ReadableSpan that has ended.\n */\n override onEnd(span: ReadableSpan): void {\n for (const filter of this._filters) {\n let sourceValue: string;\n\n if (filter.fieldName === \"span_name\") {\n sourceValue = span.name;\n } else if (filter.fieldName === \"instrumentation_scope_name\") {\n sourceValue = span.instrumentationScope.name;\n } else {\n continue;\n }\n\n const matchValue = filter.matchValue;\n const matchOperation = filter.matchOperation;\n\n switch (true) {\n case matchOperation === \"exact_match\" && sourceValue === matchValue:\n case matchOperation === \"includes\" && sourceValue.includes(matchValue):\n case matchOperation === \"starts_with\" && sourceValue.startsWith(matchValue):\n case matchOperation === \"ends_with\" && sourceValue.endsWith(matchValue):\n return;\n\n default: break;\n }\n }\n\n super.onEnd(span);\n }\n}\n","import { type DataCaptureMode } from \"./types\";\n\n/**\n * Predefined data capture configurations for common use cases.\n */\nexport const DataCapturePresets = {\n /**\n * Capture both input and output - useful for development and debugging.\n */\n CAPTURE_ALL: \"all\" as DataCaptureMode,\n\n /**\n * Capture nothing - useful for high-security environments.\n */\n CAPTURE_NONE: \"none\" as DataCaptureMode,\n\n /**\n * Capture only inputs - useful when you want to see what's being sent.\n */\n INPUT_ONLY: \"input\" as DataCaptureMode,\n\n /**\n * Capture only outputs - useful when you want to see responses.\n */\n OUTPUT_ONLY: \"output\" as DataCaptureMode,\n} as const;\n"],"mappings":";;;;;AASA;AAAA,EACE;AAAA,OAGK;AAsCA,IAAM,+BAAN,cAA2C,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnE,YAAY,UAAwB,SAAsC;AACxE,UAAM,QAAQ;AACd,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOS,MAAM,MAA0B;AACvC,eAAW,UAAU,KAAK,UAAU;AAClC,UAAI;AAEJ,UAAI,OAAO,cAAc,aAAa;AACpC,sBAAc,KAAK;AAAA,MACrB,WAAW,OAAO,cAAc,8BAA8B;AAC5D,sBAAc,KAAK,qBAAqB;AAAA,MAC1C,OAAO;AACL;AAAA,MACF;AAEA,YAAM,aAAa,OAAO;AAC1B,YAAM,iBAAiB,OAAO;AAE9B,cAAQ,MAAM;AAAA,QACZ,MAAK,mBAAmB,iBAAiB,gBAAgB;AAAA,QACzD,MAAK,mBAAmB,cAAc,YAAY,SAAS,UAAU;AAAA,QACrE,MAAK,mBAAmB,iBAAiB,YAAY,WAAW,UAAU;AAAA,QAC1E,MAAK,mBAAmB,eAAe,YAAY,SAAS,UAAU;AACpE;AAAA,QAEF;AAAS;AAAA,MACX;AAAA,IACF;AAEA,UAAM,MAAM,IAAI;AAAA,EAClB;AACF;;;AC7FO,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,aAAa;AAAA;AAAA;AAAA;AAAA,EAKb,cAAc;AAAA;AAAA;AAAA;AAAA,EAKd,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,aAAa;AACf;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/sdks/typescript/dist/chunk-73QOHSHU.js","../src/observability-sdk/processors/filterable-batch-span-processor.ts","../src/observability-sdk/features/data-capture/presets.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACKA;AACE;AAAA,6DAGK;AAsCA,IAAM,6BAAA,EAAN,MAAA,QAA2C,iCAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnE,WAAA,CAAY,QAAA,EAAwB,OAAA,EAAsC;AACxE,IAAA,KAAA,CAAM,QAAQ,CAAA;AACd,IAAA,IAAA,CAAK,SAAA,EAAW,OAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOS,KAAA,CAAM,IAAA,EAA0B;AACvC,IAAA,IAAA,CAAA,MAAW,OAAA,GAAU,IAAA,CAAK,QAAA,EAAU;AAClC,MAAA,IAAI,WAAA;AAEJ,MAAA,GAAA,CAAI,MAAA,CAAO,UAAA,IAAc,WAAA,EAAa;AACpC,QAAA,YAAA,EAAc,IAAA,CAAK,IAAA;AAAA,MACrB,EAAA,KAAA,GAAA,CAAW,MAAA,CAAO,UAAA,IAAc,4BAAA,EAA8B;AAC5D,QAAA,YAAA,EAAc,IAAA,CAAK,oBAAA,CAAqB,IAAA;AAAA,MAC1C,EAAA,KAAO;AACL,QAAA,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,WAAA,EAAa,MAAA,CAAO,UAAA;AAC1B,MAAA,MAAM,eAAA,EAAiB,MAAA,CAAO,cAAA;AAE9B,MAAA,OAAA,CAAQ,IAAA,EAAM;AAAA,QACZ,KAAA,CAAK,eAAA,IAAmB,cAAA,GAAiB,YAAA,IAAgB,UAAA,CAAA;AAAA,QACzD,KAAA,CAAK,eAAA,IAAmB,WAAA,GAAc,WAAA,CAAY,QAAA,CAAS,UAAU,CAAA,CAAA;AAAA,QACrE,KAAA,CAAK,eAAA,IAAmB,cAAA,GAAiB,WAAA,CAAY,UAAA,CAAW,UAAU,CAAA,CAAA;AAAA,QAC1E,KAAA,CAAK,eAAA,IAAmB,YAAA,GAAe,WAAA,CAAY,QAAA,CAAS,UAAU,CAAA,CAAA;AACpE,UAAA,MAAA;AAAA,QAEF,OAAA;AAAS,UAAA,KAAA;AAAA,MACX;AAAA,IACF;AAEA,IAAA,KAAA,CAAM,KAAA,CAAM,IAAI,CAAA;AAAA,EAClB;AACF,CAAA;ADjDA;AACA;AE7CO,IAAM,mBAAA,EAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,WAAA,EAAa,KAAA;AAAA;AAAA;AAAA;AAAA,EAKb,YAAA,EAAc,MAAA;AAAA;AAAA;AAAA;AAAA,EAKd,UAAA,EAAY,OAAA;AAAA;AAAA;AAAA;AAAA,EAKZ,WAAA,EAAa;AACf,CAAA;AF4CA;AACA;AACE;AACA;AACF,qHAAC","file":"/home/runner/work/langwatch/langwatch/sdks/typescript/dist/chunk-73QOHSHU.js","sourcesContent":[null,"/**\n * Filterable Batch Span Exporter for OpenTelemetry\n *\n * This module provides a BatchSpanProcessor subclass that allows filtering of spans before export\n * based on configurable rules. Spans matching any exclude rule are dropped and not exported.\n *\n * @module filterable-batch-span-exporter\n */\n\nimport {\n BatchSpanProcessor,\n type ReadableSpan,\n type SpanExporter,\n} from '@opentelemetry/sdk-trace-base';\n\n/**\n * A rule for excluding spans from export based on their name or instrumentation scope name.\n *\n * @property fieldName - The span field to match against ('span_name' or 'instrumentation_scope_name').\n * @property matchValue - The value to match against the field.\n * @property matchOperation - The operation to use for matching ('includes', 'exact_match', 'starts_with', 'ends_with').\n *\n * @example\n * const rule: SpanProcessingExcludeRule = {\n * fieldName: 'span_name',\n * matchValue: 'heartbeat',\n * matchOperation: 'exact_match',\n * };\n */\nexport interface SpanProcessingExcludeRule {\n fieldName: \"span_name\" | \"instrumentation_scope_name\";\n matchValue: string;\n matchOperation: \"includes\" | \"exact_match\" | \"starts_with\" | \"ends_with\";\n}\n\n/**\n * A BatchSpanProcessor that filters out spans matching any of the provided exclude rules before export.\n *\n * This is useful for dropping noisy or irrelevant spans (e.g., health checks, heartbeats) from being exported to your tracing backend.\n *\n * @example\n * import { FilterableBatchSpanProcessor } from './filterable-batch-span-exporter';\n * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\n *\n * const exporter = new OTLPTraceExporter({ url: '...' });\n * const filters = [\n * { fieldName: 'span_name', matchValue: 'heartbeat', matchOperation: 'exact_match' },\n * { fieldName: 'instrumentation_scope_name', matchValue: 'internal', matchOperation: 'starts_with' },\n * ];\n * provider.addSpanProcessor(new FilterableBatchSpanProcessor(exporter, filters));\n */\nexport class FilterableBatchSpanProcessor extends BatchSpanProcessor {\n private readonly _filters: SpanProcessingExcludeRule[];\n\n /**\n * Create a new FilterableBatchSpanProcessor.\n *\n * @param exporter - The underlying SpanExporter to use for exporting spans.\n * @param filters - An array of rules for excluding spans from export.\n */\n constructor(exporter: SpanExporter, filters: SpanProcessingExcludeRule[]) {\n super(exporter);\n this._filters = filters;\n }\n\n /**\n * Called when a span ends. If the span matches any exclude rule, it is dropped and not exported.\n *\n * @param span - The ReadableSpan that has ended.\n */\n override onEnd(span: ReadableSpan): void {\n for (const filter of this._filters) {\n let sourceValue: string;\n\n if (filter.fieldName === \"span_name\") {\n sourceValue = span.name;\n } else if (filter.fieldName === \"instrumentation_scope_name\") {\n sourceValue = span.instrumentationScope.name;\n } else {\n continue;\n }\n\n const matchValue = filter.matchValue;\n const matchOperation = filter.matchOperation;\n\n switch (true) {\n case matchOperation === \"exact_match\" && sourceValue === matchValue:\n case matchOperation === \"includes\" && sourceValue.includes(matchValue):\n case matchOperation === \"starts_with\" && sourceValue.startsWith(matchValue):\n case matchOperation === \"ends_with\" && sourceValue.endsWith(matchValue):\n return;\n\n default: break;\n }\n }\n\n super.onEnd(span);\n }\n}\n","import { type DataCaptureMode } from \"./types\";\n\n/**\n * Predefined data capture configurations for common use cases.\n */\nexport const DataCapturePresets = {\n /**\n * Capture both input and output - useful for development and debugging.\n */\n CAPTURE_ALL: \"all\" as DataCaptureMode,\n\n /**\n * Capture nothing - useful for high-security environments.\n */\n CAPTURE_NONE: \"none\" as DataCaptureMode,\n\n /**\n * Capture only inputs - useful when you want to see what's being sent.\n */\n INPUT_ONLY: \"input\" as DataCaptureMode,\n\n /**\n * Capture only outputs - useful when you want to see responses.\n */\n OUTPUT_ONLY: \"output\" as DataCaptureMode,\n} as const;\n"]}