Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: add otel trace sampling support (#3739)

Steffen Schmitz4cb688929eec
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5168e30580..c94f495ebc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -98,7 +98,7 @@ importers:
'@vercel/style-guide':
specifier: ^6.0.0
eslint-config-next:
specifier: ^14.2.15
@@ -560,7 +560,7 @@ importers:
version: 0.27.4
langchain:
specifier: ^0.3.2
lodash:
specifier: ^4.17.21
version: 4.17.21
@@ -676,7 +676,7 @@ importers:
'@testing-library/jest-dom':
specifier: ^6.4.6
'@testing-library/react':
specifier: ^15.0.7
@@ -818,6 +818,12 @@ importers:
'@opentelemetry/sdk-node':
specifier: ^0.53.0
version: 0.53.0(@opentelemetry/[email protected])
+ '@opentelemetry/sdk-trace-base':
+ specifier: ^1.26.0
+ version: 1.26.0(@opentelemetry/[email protected])
+ '@opentelemetry/sdk-trace-node':
+ specifier: ^1.26.0
+ version: 1.26.0(@opentelemetry/[email protected])
'@prisma/instrumentation':
specifier: ^5.20.0
version: 5.20.0
@@ -11829,7 +11835,7 @@ snapshots:
'@aws-sdk/client-sso-oidc': 3.624.0(@aws-sdk/[email protected])
'@aws-sdk/client-sts': 3.624.0
'@aws-sdk/core': 3.624.0
- '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/middleware-bucket-endpoint': 3.620.0
'@aws-sdk/middleware-expect-continue': 3.620.0
'@aws-sdk/middleware-flexible-checksums': 3.620.0
@@ -11890,7 +11896,7 @@ snapshots:
'@aws-crypto/sha256-js': 5.2.0
'@aws-sdk/client-sts': 3.624.0
'@aws-sdk/core': 3.624.0
- '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/middleware-host-header': 3.620.0
'@aws-sdk/middleware-logger': 3.609.0
'@aws-sdk/middleware-recursion-detection': 3.620.0
@@ -12111,7 +12117,7 @@ snapshots:
'@aws-crypto/sha256-js': 5.2.0
'@aws-sdk/client-sso-oidc': 3.624.0(@aws-sdk/[email protected])
'@aws-sdk/core': 3.624.0
- '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/middleware-host-header': 3.620.0
'@aws-sdk/middleware-logger': 3.609.0
'@aws-sdk/middleware-recursion-detection': 3.620.0
@@ -12261,6 +12267,24 @@ snapshots:
'@smithy/util-stream': 3.1.9
tslib: 2.6.3
+ dependencies:
+ '@aws-sdk/client-sts': 3.624.0
+ '@aws-sdk/credential-provider-env': 3.620.1
+ '@aws-sdk/credential-provider-http': 3.622.0
+ '@aws-sdk/credential-provider-process': 3.620.1
+ '@aws-sdk/credential-provider-sso': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-web-identity': 3.621.0(@aws-sdk/[email protected])
+ '@aws-sdk/types': 3.609.0
+ '@smithy/credential-provider-imds': 3.2.4
+ '@smithy/property-provider': 3.1.7
+ '@smithy/shared-ini-file-loader': 3.1.8
+ '@smithy/types': 3.5.0
+ tslib: 2.6.3
+ transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
+ - aws-crt
+
dependencies:
'@aws-sdk/client-sts': 3.668.0
@@ -12317,14 +12341,14 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
dependencies:
'@aws-sdk/credential-provider-env': 3.620.1
'@aws-sdk/credential-provider-http': 3.622.0
- '@aws-sdk/credential-provider-ini': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-ini': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.620.1
'@aws-sdk/credential-provider-sso': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
- '@aws-sdk/credential-provider-web-identity': 3.621.0(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-web-identity': 3.621.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.609.0
'@smithy/credential-provider-imds': 3.2.0
'@smithy/property-provider': 3.1.7
@@ -12336,16 +12360,16 @@ snapshots:
- '@aws-sdk/client-sts'
- aws-crt
- '@aws-sdk/[email protected]':
dependencies:
- '@aws-sdk/credential-provider-env': 3.667.0
- '@aws-sdk/credential-provider-http': 3.667.0
- '@aws-sdk/credential-provider-ini': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
- '@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
- '@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
- '@aws-sdk/types': 3.667.0
- '@smithy/credential-provider-imds': 3.2.4
+ '@aws-sdk/credential-provider-env': 3.620.1
+ '@aws-sdk/credential-provider-http': 3.622.0
+ '@aws-sdk/credential-provider-ini': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-process': 3.620.1
+ '@aws-sdk/credential-provider-sso': 3.624.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-web-identity': 3.621.0(@aws-sdk/[email protected])
+ '@aws-sdk/types': 3.609.0
+ '@smithy/credential-provider-imds': 3.2.0
'@smithy/property-provider': 3.1.7
'@smithy/shared-ini-file-loader': 3.1.8
'@smithy/types': 3.5.0
@@ -12354,7 +12378,6 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- '@aws-sdk/client-sts'
- aws-crt
- optional: true
dependencies:
@@ -12452,6 +12475,14 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
+ '@aws-sdk/[email protected](@aws-sdk/[email protected])':
+ dependencies:
+ '@aws-sdk/client-sts': 3.624.0
+ '@aws-sdk/types': 3.609.0
+ '@smithy/property-provider': 3.1.7
+ '@smithy/types': 3.5.0
+ tslib: 2.6.3
+
'@aws-sdk/[email protected](@aws-sdk/[email protected])':
dependencies:
'@aws-sdk/client-sts': 3.668.0
@@ -13691,42 +13722,6 @@ snapshots:
jest-util: 29.7.0
slash: 3.0.0
- dependencies:
- '@jest/console': 29.7.0
- '@jest/reporters': 29.7.0
- '@jest/test-result': 29.7.0
- '@jest/transform': 29.7.0
- '@jest/types': 29.6.3
- '@types/node': 20.14.8
- ansi-escapes: 4.3.2
- chalk: 4.1.2
- ci-info: 3.9.0
- exit: 0.1.2
- graceful-fs: 4.2.11
- jest-changed-files: 29.7.0
- jest-config: 29.7.0(@types/[email protected])
- jest-haste-map: 29.7.0
- jest-message-util: 29.7.0
- jest-regex-util: 29.6.3
- jest-resolve: 29.7.0
- jest-resolve-dependencies: 29.7.0
- jest-runner: 29.7.0
- jest-runtime: 29.7.0
- jest-snapshot: 29.7.0
- jest-util: 29.7.0
- jest-validate: 29.7.0
- jest-watcher: 29.7.0
- micromatch: 4.0.8
- pretty-format: 29.7.0
- slash: 3.0.0
- strip-ansi: 6.0.1
- transitivePeerDependencies:
- - babel-plugin-macros
- - supports-color
- - ts-node
- optional: true
-
dependencies:
'@jest/console': 29.7.0
@@ -13941,12 +13936,12 @@ snapshots:
- '@aws-sdk/client-sts'
- aws-crt
dependencies:
'@aws-sdk/client-bedrock-agent-runtime': 3.668.0
'@aws-sdk/client-bedrock-runtime': 3.668.0
'@aws-sdk/client-kendra': 3.668.0
- '@aws-sdk/credential-provider-node': 3.668.0
+ '@aws-sdk/credential-provider-node': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@langchain/core': 0.3.9([email protected]([email protected]))
zod: 3.23.8
zod-to-json-schema: 3.23.2([email protected])
@@ -16873,7 +16868,7 @@ snapshots:
lz-string: 1.5.0
pretty-format: 27.5.1
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.24.7
@@ -16887,7 +16882,7 @@ snapshots:
'@jest/globals': 29.7.0
'@types/jest': 29.5.12
- vitest: 2.1.2(@types/[email protected])
dependencies:
@@ -17539,7 +17534,7 @@ snapshots:
'@ungap/[email protected]': {}
dependencies:
'@babel/core': 7.24.3
'@babel/eslint-parser': 7.24.1(@babel/[email protected])([email protected])
@@ -17548,18 +17543,18 @@ snapshots:
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint-config-prettier: 9.1.0([email protected])
- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
eslint-plugin-eslint-comments: 3.2.0([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.0([email protected])
eslint-plugin-testing-library: 6.2.0([email protected])([email protected])
eslint-plugin-tsdoc: 0.2.17
eslint-plugin-unicorn: 51.0.1([email protected])
prettier-plugin-packagejson: 2.4.12([email protected])
optionalDependencies:
'@next/eslint-plugin-next': 14.2.15
@@ -17580,6 +17575,16 @@ snapshots:
chai: 5.1.1
tinyrainbow: 1.2.0
+ dependencies:
+ '@vitest/spy': 2.1.2
+ estree-walker: 3.0.3
+ magic-string: 0.30.11
+ optionalDependencies:
+ msw: 2.4.9([email protected])
+ vite: 5.2.14(@types/[email protected])([email protected])
+ optional: true
+
dependencies:
'@vitest/spy': 2.1.2
@@ -17589,13 +17594,14 @@ snapshots:
msw: 2.4.9([email protected])
vite: 5.2.14(@types/[email protected])([email protected])
dependencies:
'@vitest/spy': 2.1.2
estree-walker: 3.0.3
magic-string: 0.30.11
optionalDependencies:
- vite: 5.2.14(@types/[email protected])
+ msw: 2.4.9([email protected])
+ vite: 5.2.14(@types/[email protected])([email protected])
optional: true
'@vitest/[email protected]':
@@ -18630,13 +18636,13 @@ snapshots:
crc-32: 1.2.2
readable-stream: 3.6.2
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
- jest-config: 29.7.0(@types/[email protected])
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -18644,15 +18650,14 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -18660,6 +18665,7 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
@@ -19423,7 +19429,7 @@ snapshots:
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.0([email protected])
@@ -19440,7 +19446,7 @@ snapshots:
dependencies:
eslint: 8.57.0
- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])
eslint-plugin-n: 16.6.2([email protected])
eslint-plugin-promise: 6.4.0([email protected])
@@ -19451,7 +19457,7 @@ snapshots:
dependencies:
dependencies:
@@ -19467,7 +19473,7 @@ snapshots:
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -19478,13 +19484,13 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
debug: 4.3.7([email protected])
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -19506,14 +19512,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -19530,34 +19536,7 @@ snapshots:
eslint: 8.57.0
ignore: 5.3.1
- dependencies:
- array-includes: 3.1.7
- array.prototype.findlastindex: 1.2.4
- array.prototype.flat: 1.3.2
- array.prototype.flatmap: 1.3.2
- debug: 3.2.7
- doctrine: 2.1.0
- eslint: 8.57.0
- eslint-import-resolver-node: 0.3.9
- hasown: 2.0.2
- is-core-module: 2.15.1
- is-glob: 4.0.3
- minimatch: 3.1.2
- object.fromentries: 2.0.8
- object.groupby: 1.0.3
- object.values: 1.2.0
- semver: 6.3.1
- tsconfig-paths: 3.15.0
- optionalDependencies:
- '@typescript-eslint/parser': 7.12.0([email protected])([email protected])
- transitivePeerDependencies:
- - eslint-import-resolver-typescript
- - eslint-import-resolver-webpack
- - supports-color
-
dependencies:
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.4
@@ -19567,7 +19546,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -19584,13 +19563,13 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
'@typescript-eslint/utils': 5.62.0([email protected])([email protected])
eslint: 8.57.0
optionalDependencies:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
- jest: 29.7.0
+ jest: 29.7.0(@types/[email protected])([email protected])
transitivePeerDependencies:
- supports-color
- typescript
@@ -19632,12 +19611,12 @@ snapshots:
dependencies:
eslint: 8.57.0
globals: 13.24.0
optionalDependencies:
dependencies:
@@ -19719,13 +19698,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@typescript-eslint/utils': 7.3.1([email protected])([email protected])
eslint: 8.57.0
optionalDependencies:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- supports-color
- typescript
@@ -20947,16 +20926,16 @@ snapshots:
- babel-plugin-macros
- supports-color
dependencies:
- '@jest/core': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
- create-jest: 29.7.0
exit: 0.1.2
import-local: 3.1.0
- jest-config: 29.7.0(@types/[email protected])
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -20965,18 +20944,17 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
+ create-jest: 29.7.0(@types/[email protected])([email protected])
exit: 0.1.2
import-local: 3.1.0
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -20985,6 +20963,7 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
dependencies:
@@ -21017,37 +20996,6 @@ snapshots:
- babel-plugin-macros
- supports-color
- dependencies:
- '@babel/core': 7.24.3
- '@jest/test-sequencer': 29.7.0
- '@jest/types': 29.6.3
- babel-jest: 29.7.0(@babel/[email protected])
- chalk: 4.1.2
- ci-info: 3.9.0
- deepmerge: 4.3.1
- glob: 7.2.3
- graceful-fs: 4.2.11
- jest-circus: 29.7.0([email protected])
- jest-environment-node: 29.7.0
- jest-get-type: 29.6.3
- jest-regex-util: 29.6.3
- jest-resolve: 29.7.0
- jest-runner: 29.7.0
- jest-util: 29.7.0
- jest-validate: 29.7.0
- micromatch: 4.0.8
- parse-json: 5.2.0
- pretty-format: 29.7.0
- slash: 3.0.0
- strip-json-comments: 3.1.1
- optionalDependencies:
- '@types/node': 20.14.8
- transitivePeerDependencies:
- - babel-plugin-macros
- - supports-color
- optional: true
-
dependencies:
'@babel/core': 7.24.3
@@ -21315,30 +21263,30 @@ snapshots:
merge-stream: 2.0.0
supports-color: 8.1.1
dependencies:
- '@jest/core': 29.7.0
'@jest/types': 29.6.3
import-local: 3.1.0
- jest-cli: 29.7.0
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
dependencies:
'@jest/types': 29.6.3
import-local: 3.1.0
+ jest-cli: 29.7.0(@types/[email protected])([email protected])
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
@@ -21520,7 +21468,7 @@ snapshots:
- encoding
- openai
dependencies:
'@langchain/core': 0.3.9([email protected]([email protected]))
'@langchain/openai': 0.3.0(@langchain/[email protected]([email protected]([email protected])))
@@ -21537,7 +21485,7 @@ snapshots:
zod-to-json-schema: 3.23.2([email protected])
optionalDependencies:
'@langchain/anthropic': 0.3.1(@langchain/[email protected]([email protected]([email protected])))
- '@langchain/aws': 0.1.0(@langchain/[email protected]([email protected]([email protected])))
+ '@langchain/aws': 0.1.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])(@langchain/[email protected]([email protected]([email protected])))
axios: 1.7.7
handlebars: 4.7.8
transitivePeerDependencies:
@@ -24706,12 +24654,12 @@ snapshots:
d3-time: 3.1.0
d3-timer: 3.0.1
dependencies:
cac: 6.7.14
debug: 4.3.7([email protected])
pathe: 1.1.2
- vite: 5.2.14(@types/[email protected])
+ vite: 5.2.14(@types/[email protected])([email protected])
transitivePeerDependencies:
- '@types/node'
- less
@@ -24739,7 +24687,24 @@ snapshots:
- supports-color
- terser
+ dependencies:
+ cac: 6.7.14
+ debug: 4.3.7([email protected])
+ pathe: 1.1.2
+ vite: 5.2.14(@types/[email protected])([email protected])
+ transitivePeerDependencies:
+ - '@types/node'
+ - less
+ - lightningcss
+ - sass
+ - stylus
+ - sugarss
+ - supports-color
+ - terser
+ optional: true
+
dependencies:
esbuild: 0.20.2
postcss: 8.4.47
@@ -24747,6 +24712,7 @@ snapshots:
optionalDependencies:
'@types/node': 20.10.5
fsevents: 2.3.3
+ terser: 5.34.1
optional: true
@@ -24759,10 +24725,21 @@ snapshots:
fsevents: 2.3.3
terser: 5.34.1
+ dependencies:
+ esbuild: 0.20.2
+ postcss: 8.4.47
+ rollup: 4.13.0
+ optionalDependencies:
+ '@types/node': 20.14.8
+ fsevents: 2.3.3
+ terser: 5.34.1
+ optional: true
+
dependencies:
'@vitest/expect': 2.1.2
- '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected](@types/[email protected]))
'@vitest/pretty-format': 2.1.2
'@vitest/runner': 2.1.2
'@vitest/snapshot': 2.1.2
@@ -24777,11 +24754,12 @@ snapshots:
tinyexec: 0.3.0
tinypool: 1.0.1
tinyrainbow: 1.2.0
- vite: 5.2.14(@types/[email protected])
- vite-node: 2.1.2(@types/[email protected])
+ vite: 5.2.14(@types/[email protected])([email protected])
+ vite-node: 2.1.2(@types/[email protected])([email protected])
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.10.5
+ jsdom: 20.0.3
transitivePeerDependencies:
- less
- lightningcss
@@ -24827,6 +24805,41 @@ snapshots:
- supports-color
- terser
+ dependencies:
+ '@vitest/expect': 2.1.2
+ '@vitest/pretty-format': 2.1.2
+ '@vitest/runner': 2.1.2
+ '@vitest/snapshot': 2.1.2
+ '@vitest/spy': 2.1.2
+ '@vitest/utils': 2.1.2
+ chai: 5.1.1
+ debug: 4.3.7([email protected])
+ magic-string: 0.30.11
+ pathe: 1.1.2
+ std-env: 3.7.0
+ tinybench: 2.9.0
+ tinyexec: 0.3.0
+ tinypool: 1.0.1
+ tinyrainbow: 1.2.0
+ vite: 5.2.14(@types/[email protected])([email protected])
+ vite-node: 2.1.2(@types/[email protected])([email protected])
+ why-is-node-running: 2.3.0
+ optionalDependencies:
+ '@types/node': 20.14.8
+ jsdom: 20.0.3
+ transitivePeerDependencies:
+ - less
+ - lightningcss
+ - msw
+ - sass
+ - stylus
+ - sugarss
+ - supports-color
+ - terser
+ optional: true
+
diff --git a/web/src/env.mjs b/web/src/env.mjs
index 02024a1e1b..cba2554a11 100644
--- a/web/src/env.mjs
+++ b/web/src/env.mjs
@@ -113,6 +113,7 @@ export const env = createEnv({
// Otel
OTEL_EXPORTER_OTLP_ENDPOINT: z.string().default("http://localhost:4318"),
OTEL_SERVICE_NAME: z.string().default("web"),
+ OTEL_TRACE_SAMPLING_RATIO: z.coerce.number().gt(0).lte(1).default(1),
// clickhouse
CLICKHOUSE_URL: z.string().optional(),
@@ -317,6 +318,7 @@ export const env = createEnv({
// Otel
OTEL_EXPORTER_OTLP_ENDPOINT: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
OTEL_SERVICE_NAME: process.env.OTEL_SERVICE_NAME,
+ OTEL_TRACE_SAMPLING_RATIO: process.env.OTEL_TRACE_SAMPLING_RATIO,
// S3
S3_ENDPOINT: process.env.S3_ENDPOINT,
S3_ACCESS_KEY_ID: process.env.S3_ACCESS_KEY_ID,
diff --git a/web/src/observability.config.ts b/web/src/observability.config.ts
index b22b016a6d..72e99ab40f 100644
--- a/web/src/observability.config.ts
+++ b/web/src/observability.config.ts
@@ -1,5 +1,6 @@
import dd from "dd-trace";
import { NodeSDK } from "@opentelemetry/sdk-node";
+import { TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { IORedisInstrumentation } from "@opentelemetry/instrumentation-ioredis";
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
@@ -58,6 +59,7 @@ if (!process.env.VERCEL && process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) {
awsEcsDetectorSync,
containerDetector,
],
+ sampler: new TraceIdRatioBasedSampler(env.OTEL_TRACE_SAMPLING_RATIO),
});
sdk.start();
diff --git a/worker/package.json b/worker/package.json
index 4e6d5adcad..9fdd6b69b5 100644
--- a/worker/package.json
+++ b/worker/package.json
@@ -34,6 +34,8 @@
"@opentelemetry/resource-detector-container": "^0.4.2",
"@opentelemetry/resources": "^1.26.0",
"@opentelemetry/sdk-node": "^0.53.0",
+ "@opentelemetry/sdk-trace-base": "^1.26.0",
+ "@opentelemetry/sdk-trace-node": "^1.26.0",
"@prisma/instrumentation": "^5.20.0",
"backoff": "^2.5.0",
"bullmq": "^5.12.10",
diff --git a/worker/src/env.ts b/worker/src/env.ts
index 461fffa092..a7431d439b 100644
--- a/worker/src/env.ts
+++ b/worker/src/env.ts
@@ -91,6 +91,7 @@ const EnvSchema = z.object({
// Otel
OTEL_EXPORTER_OTLP_ENDPOINT: z.string().default("http://localhost:4318"),
OTEL_SERVICE_NAME: z.string().default("worker"),
+ OTEL_TRACE_SAMPLING_RATIO: z.coerce.number().gt(0).lte(1).default(1),
// Flags to toggle queue consumers on or off.
QUEUE_CONSUMER_LEGACY_INGESTION_QUEUE_IS_ENABLED: z
diff --git a/worker/src/instrumentation.ts b/worker/src/instrumentation.ts
index d6d91908cb..318942739b 100644
--- a/worker/src/instrumentation.ts
+++ b/worker/src/instrumentation.ts
@@ -1,5 +1,6 @@
import dd from "dd-trace";
import { NodeSDK } from "@opentelemetry/sdk-node";
+import { TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { IORedisInstrumentation } from "@opentelemetry/instrumentation-ioredis";
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
@@ -57,6 +58,7 @@ const sdk = new NodeSDK({
awsEcsDetectorSync,
containerDetector,
],
+ sampler: new TraceIdRatioBasedSampler(env.OTEL_TRACE_SAMPLING_RATIO),
});
sdk.start();