Migrate your application to the new Apitally SDK for JavaScript.
The JavaScript SDK now uses OpenTelemetry to collect and send metrics, logs, and traces.
Request logging, tracing, and application log capture are now enabled by default. If you previously used the SDK for metrics only, set sampleRate: 0 to keep that behavior.
The updated setup guides provide the installation steps and initialization code for each framework. Follow these to replace your existing SDK integration.
The SDK now authenticates with a write token instead of a client ID. Your existing app’s token (apt_...) is available under Setup instructions in the Apitally dashboard.Use this token as the writeToken option in place of clientId, or set the APITALLY_WRITE_TOKEN environment variable.
The requestLogging object and its deprecated alias requestLoggingConfig have been removed. Their settings are now top-level configuration options, with the option changes listed below.
The SDK now provides setConsumer() from apitally for all frameworks. The request or context argument has been removed.Call it where the consumer is known, such as in your authentication code:
This replaces consumer values assigned to request state, including Elysia’s apitally.consumer. Existing setConsumer(request, ...) or setConsumer(context, ...) calls should use the new function without the first argument.
maskRequestBodyCallback and maskResponseBodyCallback are now named maskRequestBody and maskResponseBody. Both receive (body, span), rather than request/response objects. The body is passed as a Buffer. Request metadata is available through span.attributes.For example, a callback that masks bodies for admin routes becomes:
Use sampling callbacks to exclude requests: sampleOnRequest(span) for early decisions based on the request, or sampleOnResponse(span) for decisions based on the response status or consumer.The callbacks should return true to capture the request, and false to exclude it. Callbacks can also return a probability as a number between 0 and 1. Returning undefined from sampleOnRequest applies sampleRate, and returning undefined from sampleOnResponse preserves the earlier sampling decision.For example, to capture only error responses:
Replace the excludeCallback option with the appropriate sampling callback. Note that captured headers and bodies are not available in sampling callbacks.Sampling affects request logs and traces, but not metrics.See sampling for details.
excludePaths now matches request paths rather than matched route patterns. If a pattern contains route parameters, update it to match concrete values. For example, replace /^\/users\/:id$/ with /^\/users\/[^/]+$/ to match /users/123.
If your application configures its own tracer provider, you must register ApitallySpanProcessor alongside your existing span processors. Its import has moved from apitally/otel to apitally.For example, with NodeSDK:
import { NodeSDK } from "@opentelemetry/sdk-node";import { ApitallySpanProcessor } from "apitally";const sdk = new NodeSDK({ spanProcessors: [ // Your existing span processors ... new ApitallySpanProcessor(), ], // Your existing configuration ...});sdk.start();
Review these settings when upgrading:
Sampling: Previously, your provider’s sampler affected traces but not Apitally’s request logs. It now affects both. Check that its sampling rate provides the request log coverage you want. Metrics remain unsampled.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Apitally Docs","colors":{"primary":"#0b9797","light":"#0b9797","dark":"#0b9797"},"logo":{"light":"https://mintcdn.com/apitally/N2ERaeHClCgFy9Y6/images/logo-light.svg?fit=max\u0026auto=format\u0026n=N2ERaeHClCgFy9Y6\u0026q=85\u0026s=e1d72c6d56f4625e48a29dd012b89739","dark":"https://mintcdn.com/apitally/N2ERaeHClCgFy9Y6/images/logo-dark.svg?fit=max\u0026auto=format\u0026n=N2ERaeHClCgFy9Y6\u0026q=85\u0026s=c6aecd17ce726476be3d8a32b2b8d990"},"favicon":"https://mintcdn.com/apitally/TB-PurCnjfcCoHVd/images/favicon.svg?fit=max\u0026auto=format\u0026n=TB-PurCnjfcCoHVd\u0026q=85\u0026s=a6cf7d03f3f69f4fec43387790813a2b","background":{"image":"https://mintcdn.com/apitally/N2ERaeHClCgFy9Y6/images/background.webp?fit=max\u0026auto=format\u0026n=N2ERaeHClCgFy9Y6\u0026q=85\u0026s=da30315f44124609083957a5c3b96a38","color":{"dark":"#0e1515"}},"navbar":{"links":[{"href":"https://app.apitally.io","label":"Log in"}],"primary":{"type":"button","label":"Sign up","href":"https://app.apitally.io?signup"}},"footer":{"socials":{"github":"https://github.com/apitally","twitter":"https://twitter.com/apitally_io","linkedin":"https://www.linkedin.com/company/apitally"}},"integrations":{"posthog":{"apiKey":"phc_kOKUlIHUZPLsz5a6Bqix8h7uy5zl7SaMWSDlXhLVZka","apiHost":"https://ph.apitally.io"},"plausible":{"domain":"docs.apitally.io","server":"plsbl.apitally.io"}},"interaction":{"drilldown":false},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"apitally","hasAudioNarration":false,"actualSubdomain":"apitally","customDomains":["docs.apitally.io"],"gitSource":{"type":"github","owner":"apitally","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad8ba0a77553aa7e946289d","collectionId":"dedff5c3-a2e7-4a75-886e-69116bba5747","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad8ba0a77553aa7e946289d"},"feedback":{"edits":true,"issues":true},"entitlements":{},"buildId":"6add9e35cd8ebdc75e3668af","clientVersion":"0.0.3965","searchFilterCounts":[{"language":"default","tag":"SDK reference","count":145},{"language":"default","tag":"Setup guides","count":44},{"language":"default","tag":"JavaScript","count":29},{"language":"default","tag":"Python","count":25},{"language":"default","tag":"Go","count":19},{"language":"default","tag":"Documentation","count":18},{"language":"default","tag":".NET","count":13},{"language":"default","tag":"API reference","count":9},{"language":"default","tag":"API metrics","count":7},{"language":"default","tag":"Endpoints","count":7}]},"assistantConfig":{},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#sidebar,html{scrollbar-gutter:stable;scrollbar-color:#e1e2e2 #ffffff00}#sidebar{scrollbar-width:thin}html.dark,html.dark #sidebar{scrollbar-color:#252b2b #0e151500}header div:has(>[data-component-part=version-select-trigger]){flex-shrink:0;margin-left:-.5rem;order:1}header [data-component-part=products-selector-trigger]{flex-shrink:0;margin-left:.5rem}header a:has(>.nav-logo){flex-shrink:0}@media (min-width:1024px){header div:has(>a>.nav-logo){flex:0 0 30.5rem}}@media (min-width:1024px) and (max-width:1279px){header div:has(>#search-bar-entry){flex:0 1 18rem;min-width:0}}"}],"page":{"pagePath":"sdk-reference/javascript/v1/migration","slug":"/sdk-reference/javascript/v1/migration","pageMetadata":{"title":"Migration from v0","description":"Migrate your application to the new Apitally SDK for JavaScript.","href":"/sdk-reference/javascript/v1/migration"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Migrate your application to the new Apitally SDK for JavaScript.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The JavaScript SDK now uses OpenTelemetry to collect and send metrics, logs, and traces.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Request logging, tracing, and application log capture are now enabled by default. If you previously used the SDK for metrics only, set `,_jsx(_components.code,{children:`sampleRate: 0`}),` to keep that behavior.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`installation-and-setup`,children:`Installation and setup`}),`\n`,_jsxs(_components.p,{children:[`The updated `,_jsx(_components.a,{href:`/sdk-reference/javascript/v1/overview#supported-frameworks`,children:`setup guides`}),` provide the installation steps and initialization code for each framework. Follow these to replace your existing SDK integration.`]}),`\n`,_jsx(Heading,{level:`3`,id:`write-tokens-replace-client-ids`,children:`Write tokens replace client IDs`}),`\n`,_jsxs(_components.p,{children:[`The SDK now authenticates with a `,_jsx(_components.strong,{children:`write token`}),` instead of a client ID. Your existing app’s token (`,_jsx(_components.code,{children:`apt_...`}),`) is available under `,_jsx(_components.em,{children:`Setup instructions`}),` in the `,_jsx(_components.a,{href:`https://app.apitally.io/apps`,children:`Apitally dashboard`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Use this token as the `,_jsx(_components.code,{children:`writeToken`}),` option in place of `,_jsx(_components.code,{children:`clientId`}),`, or set the `,_jsx(_components.code,{children:`APITALLY_WRITE_TOKEN`}),` environment variable.`]}),`\n`,_jsx(Heading,{level:`2`,id:`configuration-changes`,children:`Configuration changes`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`requestLogging`}),` object and its deprecated alias `,_jsx(_components.code,{children:`requestLoggingConfig`}),` have been removed. Their settings are now top-level configuration options, with the option changes listed below.`]}),`\n`,_jsx(Heading,{level:`3`,id:`changed-options`,children:`Changed options`}),`\n`,_jsx(_components.p,{children:`The following options have been changed:`}),`\n`,_jsxs(`table`,{children:[_jsxs(`colgroup`,{children:[_jsx(`col`,{width:`40%`}),_jsx(`col`,{width:`60%`})]}),_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{style:{minWidth:`240px`},children:`Option`}),_jsx(`th`,{style:{minWidth:`300px`},children:`Change`})]})}),_jsxs(`tbody`,{children:[_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`clientId`})}),_jsxs(`td`,{children:[`Replaced by `,_jsx(`code`,{children:`writeToken`}),`, which requires a new credential.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`captureLogs`})}),_jsxs(`td`,{children:[`Default changed from `,_jsx(`code`,{children:`false`}),` to `,_jsx(`code`,{children:`true`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logRequestHeaders`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`captureRequestHeaders`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logRequestBody`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`captureRequestBody`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logResponseHeaders`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`captureResponseHeaders`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logResponseBody`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`captureResponseBody`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`maskRequestBodyCallback`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`maskRequestBody`}),` with new arguments.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`maskResponseBodyCallback`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`maskResponseBody`}),` with new arguments.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`excludeCallback`})}),_jsxs(`td`,{children:[`Replaced by `,_jsx(`code`,{children:`sampleOnRequest`}),` or `,_jsx(`code`,{children:`sampleOnResponse`}),` with new arguments and return values.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`excludePaths`})}),_jsx(`td`,{children:`Matches actual request paths instead of matched route patterns.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`removed-options`,children:`Removed options`}),`\n`,_jsx(_components.p,{children:`These options are no longer accepted when initializing the SDK:`}),`\n`,_jsxs(`table`,{children:[_jsxs(`colgroup`,{children:[_jsx(`col`,{width:`40%`}),_jsx(`col`,{width:`60%`})]}),_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{style:{minWidth:`240px`},children:`Removed option`}),_jsx(`th`,{style:{minWidth:`300px`},children:`Migration`})]})}),_jsxs(`tbody`,{children:[_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsxs(_components.p,{children:[_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`requestLogging`}),` and`,_jsx(`br`,{}),`\n`,_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`requestLoggingConfig`})]})}),_jsxs(`td`,{children:[`Pass their settings directly as top-level configuration options, applying the changes above. Remove the `,_jsx(`code`,{children:`enabled`}),` flag.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsxs(_components.p,{children:[_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`requestLogging.enabled`}),` and`,_jsx(`br`,{}),`\n`,_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`captureTraces`})]})}),_jsxs(`td`,{children:[`Previously defaulted to `,_jsx(`code`,{children:`false`}),`. Request logging and tracing are now enabled by default. Use `,_jsx(`code`,{children:`sampleRate: 0`}),` to disable request logs and traces.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logQueryParams`})}),_jsxs(`td`,{children:[`Query parameters are now always captured. To mask all values, use `,_jsx(`code`,{children:`maskQueryParams: [/.*/]`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logException`})}),_jsx(`td`,{children:`Unhandled exceptions are now always captured in request traces.`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`logger`})}),_jsxs(`td`,{children:[`SDK diagnostics are now written directly to stderr. Use `,_jsx(`code`,{children:`APITALLY_DEBUG`}),` to enable debug output.`]})]}),_jsxs(`tr`,{children:[_jsxs(`td`,{children:[_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`basePath`}),` (Express)`]}),_jsx(`td`,{children:`Mounted router prefixes are captured automatically.`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`/sdk-reference/javascript/v1/configuration`,children:`configuration reference`}),` lists all available options.`]}),`\n`,_jsx(Heading,{level:`2`,id:`consumer-identification`,children:`Consumer identification`}),`\n`,_jsxs(_components.p,{children:[`The SDK now provides `,_jsx(_components.code,{children:`setConsumer()`}),` from `,_jsx(_components.code,{children:`apitally`}),` for all frameworks. The request or context argument has been removed.`]}),`\n`,_jsx(_components.p,{children:`Call it where the consumer is known, such as in your authentication code:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`setConsumer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"apitally\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`setConsumer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` identifier:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`identifier`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` group:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`group`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attributes:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`plan:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`plan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This replaces consumer values assigned to request state, including Elysia’s `,_jsx(_components.code,{children:`apitally.consumer`}),`. Existing `,_jsx(_components.code,{children:`setConsumer(request, ...)`}),` or `,_jsx(_components.code,{children:`setConsumer(context, ...)`}),` calls should use the new function without the first argument.`]}),`\n`,_jsx(Heading,{level:`2`,id:`body-masking-callbacks`,children:`Body masking callbacks`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`maskRequestBodyCallback`}),` and `,_jsx(_components.code,{children:`maskResponseBodyCallback`}),` are now named `,_jsx(_components.code,{children:`maskRequestBody`}),` and `,_jsx(_components.code,{children:`maskResponseBody`}),`. Both receive `,_jsx(_components.code,{children:`(body, span)`}),`, rather than request/response objects. The body is passed as a `,_jsx(_components.code,{children:`Buffer`}),`. Request metadata is available through `,_jsx(_components.a,{href:`/sdk-reference/javascript/v1/attributes`,children:_jsx(_components.code,{children:`span.attributes`})}),`.`]}),`\n`,_jsx(_components.p,{children:`For example, a callback that masks bodies for admin routes becomes:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ReadableSpan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@opentelemetry/sdk-trace-base\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Before`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` maskRequestBodyCallback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Buffer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` undefined`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`path`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`startsWith`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/admin/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// After`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` maskRequestBody`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`span`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ReadableSpan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Buffer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` route`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` span`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`attributes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"http.route\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`typeof`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` route`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"string\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` route`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`startsWith`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/admin/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`request-exclusion`,children:`Request exclusion`}),`\n`,_jsxs(_components.p,{children:[`Use sampling callbacks to exclude requests: `,_jsx(_components.code,{children:`sampleOnRequest(span)`}),` for early decisions based on the request, or `,_jsx(_components.code,{children:`sampleOnResponse(span)`}),` for decisions based on the response status or consumer.`]}),`\n`,_jsxs(_components.p,{children:[`The callbacks should return `,_jsx(_components.code,{children:`true`}),` to capture the request, and `,_jsx(_components.code,{children:`false`}),` to exclude it. Callbacks can also return a probability as a `,_jsx(_components.code,{children:`number`}),` between 0 and 1. Returning `,_jsx(_components.code,{children:`undefined`}),` from `,_jsx(_components.code,{children:`sampleOnRequest`}),` applies `,_jsx(_components.code,{children:`sampleRate`}),`, and returning `,_jsx(_components.code,{children:`undefined`}),` from `,_jsx(_components.code,{children:`sampleOnResponse`}),` preserves the earlier sampling decision.`]}),`\n`,_jsx(_components.p,{children:`For example, to capture only error responses:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ReadableSpan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@opentelemetry/sdk-trace-base\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Before`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` excludeRequest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`statusCode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`statusCode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// After`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sampleOnResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`span`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ReadableSpan`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` statusCode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` span`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`attributes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"http.response.status_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` typeof`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` statusCode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"number\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` statusCode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Replace the `,_jsx(_components.code,{children:`excludeCallback`}),` option with the appropriate sampling callback. Note that captured headers and bodies are not available in sampling callbacks.`]}),`\n`,_jsx(_components.p,{children:`Sampling affects request logs and traces, but not metrics.`}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/sdk-reference/javascript/v1/sampling`,children:`sampling`}),` for details.`]}),`\n`,_jsx(Heading,{level:`3`,id:`path-exclusions`,children:`Path exclusions`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`excludePaths`}),` now matches request paths rather than matched route patterns. If a pattern contains route parameters, update it to match concrete values. For example, replace `,_jsx(_components.code,{children:`/^\\\\/users\\\\/:id$/`}),` with `,_jsx(_components.code,{children:`/^\\\\/users\\\\/[^/]+$/`}),` to match `,_jsx(_components.code,{children:`/users/123`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`existing-opentelemetry-setups`,children:`Existing OpenTelemetry setups`}),`\n`,_jsxs(_components.p,{children:[`If your application configures its own tracer provider, you must register `,_jsx(_components.code,{children:`ApitallySpanProcessor`}),` alongside your existing span processors. Its import has moved from `,_jsx(_components.code,{children:`apitally/otel`}),` to `,_jsx(_components.code,{children:`apitally`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For example, with `,_jsx(_components.code,{children:`NodeSDK`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`NodeSDK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@opentelemetry/sdk-node\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ApitallySpanProcessor`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"apitally\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sdk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` NodeSDK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` spanProcessors:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Your existing span processors ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ApitallySpanProcessor`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Your existing configuration ...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sdk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`start`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Review these settings when upgrading:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sampling:`}),` Previously, your provider’s sampler affected traces but not Apitally’s request logs. It now affects both. Check that its sampling rate provides the request log coverage you want. Metrics remain unsampled.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`other-changes`,children:`Other changes`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Network access:`}),` The SDK now sends data to `,_jsx(_components.code,{children:`otlp.apitally.io`}),` instead of `,_jsx(_components.code,{children:`hub.apitally.io`}),`. Update firewall allowlists if necessary.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Migration from v0","description":"Migrate your application to the new Apitally SDK for JavaScript.","href":"/sdk-reference/javascript/v1/migration"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Installation and setup","slug":"installation-and-setup","depth":2,"children":[{"title":"Write tokens replace client IDs","slug":"write-tokens-replace-client-ids","depth":3,"children":[]}]},{"title":"Configuration changes","slug":"configuration-changes","depth":2,"children":[{"title":"Changed options","slug":"changed-options","depth":3,"children":[]},{"title":"Removed options","slug":"removed-options","depth":3,"children":[]}]},{"title":"Consumer identification","slug":"consumer-identification","depth":2,"children":[]},{"title":"Body masking callbacks","slug":"body-masking-callbacks","depth":2,"children":[]},{"title":"Request exclusion","slug":"request-exclusion","depth":2,"children":[{"title":"Path exclusions","slug":"path-exclusions","depth":3,"children":[]}]},{"title":"Existing OpenTelemetry setups","slug":"existing-opentelemetry-setups","depth":2,"children":[]},{"title":"Other changes","slug":"other-changes","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"apitally","siteName":"Apitally Docs","title":"Migration from v0 - Apitally Docs","navMaps":{"firstHrefInVersion":{"v1":{"href":"/sdk-reference/javascript/v1/migration","matchLevel":0},"v0":{"href":"/sdk-reference/javascript/v0/overview","matchLevel":2}},"firstHrefInLanguage":{}},"lastModified":"2026-10-13T09:24:40.996Z","originalFileLocation":"sdk-reference/javascript/v1/migration.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Migrate your application to the new Apitally SDK for JavaScript.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Apitally Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Migration from v0 - Apitally Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Migrate your application to the new Apitally SDK for JavaScript.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Apitally Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.apitally.io/sdk-reference/javascript/v1/migration\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://apitally.mintlify.app/_mintlify/api/og/v2?division=SDK+reference\u0026amp;title=Migration+from+v0\u0026amp;description=Migrate+your+application+to+the+new+Apitally+SDK+for+JavaScript.\u0026amp;theme=f8a29e48343a1364e1ae879f\u0026amp;signature=5436195bc2ac3cf3f82449b0064340bba4e5b2b722c94830460d0ed7be0901bb\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Migration from v0 - Apitally Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Migrate your application to the new Apitally SDK for JavaScript.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://apitally.mintlify.app/_mintlify/api/og/v2?division=SDK+reference\u0026amp;title=Migration+from+v0\u0026amp;description=Migrate+your+application+to+the+new+Apitally+SDK+for+JavaScript.\u0026amp;theme=f8a29e48343a1364e1ae879f\u0026amp;signature=5436195bc2ac3cf3f82449b0064340bba4e5b2b722c94830460d0ed7be0901bb\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/apitally/wbLGdYpKEp4-Uamx/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Apitally Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0b9797\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.apitally.io/sdk-reference/javascript/v1/migration\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk-reference/javascript/v1/migration.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.apitally.io/#organization\",\"name\":\"Apitally Docs\",\"url\":\"https://docs.apitally.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/apitally/N2ERaeHClCgFy9Y6/images/logo-light.svg?fit=max\u0026auto=format\u0026n=N2ERaeHClCgFy9Y6\u0026q=85\u0026s=e1d72c6d56f4625e48a29dd012b89739\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.apitally.io#website\",\"name\":\"Apitally Docs\",\"url\":\"https://docs.apitally.io\",\"publisher\":{\"@id\":\"https://docs.apitally.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration#webpage\",\"url\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration\",\"name\":\"Migration from v0\",\"description\":\"Migrate your application to the new Apitally SDK for JavaScript.\",\"dateModified\":\"2026-10-13T09:24:40.996Z\",\"isPartOf\":{\"@id\":\"https://docs.apitally.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"SDK reference\",\"item\":\"https://docs.apitally.io/sdk-reference/javascript/v1/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Migration from v0\",\"item\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration#article\",\"headline\":\"Migration from v0\",\"name\":\"Migration from v0\",\"description\":\"Migrate your application to the new Apitally SDK for JavaScript.\",\"url\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration\",\"mainEntityOfPage\":{\"@id\":\"https://docs.apitally.io/sdk-reference/javascript/v1/migration#webpage\"},\"dateModified\":\"2026-10-13T09:24:40.996Z\",\"publisher\":{\"@id\":\"https://docs.apitally.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.apitally.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Apitally Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Apitally Docs","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/introduction"}]},{"anchor":"SDK reference","icon":"box-isometric","products":[{"product":"Overview","icon":"book","pages":[{"title":"Overview","href":"/sdk-reference/overview"}]},{"product":"Python","icon":"python","pages":[{"title":"Python","href":"/sdk-reference/python/v1/overview"}]},{"product":"JavaScript","icon":"node-js","versions":[{"version":"v1","groups":[{"group":"SDK reference","icon":"book","pages":[{"title":"JavaScript SDK reference","sidebarTitle":"Overview","mode":"wide","href":"/sdk-reference/javascript/v1/overview"},{"title":"Configuration","href":"/sdk-reference/javascript/v1/configuration"},{"title":"Masking","href":"/sdk-reference/javascript/v1/masking"},{"title":"Sampling","href":"/sdk-reference/javascript/v1/sampling"},{"title":"Tracing instrumentation","sidebarTitle":"Tracing","href":"/sdk-reference/javascript/v1/tracing"},{"title":"Attributes","description":"Span attributes available to callbacks in the Apitally SDK for JavaScript.","href":"/sdk-reference/javascript/v1/attributes"},{"title":"Migration from v0","href":"/sdk-reference/javascript/v1/migration"}]},{"group":"Setup guides","icon":"rocket","pages":[{"title":"Setup guide for AdonisJS","sidebarTitle":"AdonisJS","description":"Set up the Apitally SDK for your AdonisJS application.","href":"/sdk-reference/javascript/v1/setup-guides/adonisjs"},{"title":"Setup guide for Elysia","sidebarTitle":"Elysia","href":"/sdk-reference/javascript/v1/setup-guides/elysia"},{"title":"Setup guide for Express","sidebarTitle":"Express","href":"/sdk-reference/javascript/v1/setup-guides/express"},{"title":"Setup guide for Fastify","sidebarTitle":"Fastify","href":"/sdk-reference/javascript/v1/setup-guides/fastify"},{"title":"Setup guide for H3 v2","sidebarTitle":"H3","href":"/sdk-reference/javascript/v1/setup-guides/h3"},{"title":"Setup guide for hapi","sidebarTitle":"hapi","href":"/sdk-reference/javascript/v1/setup-guides/hapi"},{"title":"Setup guide for Hono","sidebarTitle":"Hono","href":"/sdk-reference/javascript/v1/setup-guides/hono"},{"title":"Setup guide for Koa","sidebarTitle":"Koa","href":"/sdk-reference/javascript/v1/setup-guides/koa"},{"title":"Setup guide for NestJS","sidebarTitle":"NestJS","href":"/sdk-reference/javascript/v1/setup-guides/nestjs"}]}]},{"version":"v0","pages":[{"title":"v0","href":"/sdk-reference/javascript/v0/overview"}]}]},{"product":"Go","icon":"golang","pages":[{"title":"Go","href":"/sdk-reference/go/v1/overview"}]},{"product":".NET","icon":"microsoft","pages":[{"title":".NET","href":"/sdk-reference/dotnet/v1/overview"}]},{"product":"Python Serverless","icon":"python","pages":[{"title":"Python Serverless","href":"/sdk-reference/python-serverless/v0/overview"}]},{"product":"JavaScript Serverless","icon":"node-js","pages":[{"title":"JavaScript Serverless","href":"/sdk-reference/javascript-serverless/v0/overview"}]}]},{"anchor":"API reference","icon":"brackets-curly","pages":[{"title":"API reference","href":"/api-reference"}]},{"anchor":"Website","icon":"globe","href":"https://apitally.io"}]},"title":"Migration from v0 - Apitally Docs","buildId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","deploymentId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","dynamics":[],"chunks":[]}