Migrate your application to the new Apitally SDK for .NET.
The .NET 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 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.
AddApitally() now registers everything the SDK needs, including its middleware. Remove the app.UseApitally() call. The SDK adds its middleware at the start of the request pipeline automatically.
The RequestLoggingOptions class and RequestLogging property have been removed. Their settings are now properties directly on ApitallyOptions, with the option changes listed below.The same applies to the Apitally section in appsettings.json:
Replaced by WriteToken, which requires a new credential.
Env
Defaults to the lowercased ASP.NET Core environment name instead of default, with Production shortened to prod and Development to dev. Remove the option if the derived name fits your setup.
RequestLogging.CaptureLogs
Moved to CaptureLogs. Default changed from false to true.
RequestLogging.IncludeRequestHeaders
Renamed to CaptureRequestHeaders.
RequestLogging.IncludeRequestBody
Renamed to CaptureRequestBody.
RequestLogging.IncludeResponseHeaders
Renamed to CaptureResponseHeaders.
RequestLogging.IncludeResponseBody
Renamed to CaptureResponseBody.
RequestLogging.QueryParamMaskPatterns
Renamed to MaskQueryParams.
RequestLogging.HeaderMaskPatterns
Renamed to MaskHeaders.
RequestLogging.BodyFieldMaskPatterns
Renamed to MaskBodyFields.
RequestLogging.MaskRequestBody
Moved to MaskRequestBody with new arguments.
RequestLogging.MaskResponseBody
Moved to MaskResponseBody with new arguments.
RequestLogging.ShouldExclude
Replaced by SampleOnRequest or SampleOnResponse with new arguments and return values.
RequestLogging.PathExcludePatterns
Renamed to ExcludePaths. Matches actual request paths instead of matched route patterns.
The SDK now provides the IApitally service with a SetConsumer() method. Setting the ApitallyConsumer item in HttpContext.Items no longer has any effect, and the ApitallyConsumer class has been removed.Call SetConsumer() where the consumer is known, such as in your authentication code. Inject IApitally into your controllers, Minimal API handlers, or middleware, or resolve it from HttpContext.RequestServices:
// Beforecontext.Items["ApitallyConsumer"] = new ApitallyConsumer{ Identifier = user.Identifier, Name = user.Name, Group = user.Group,};// Aftervar apitally = context.RequestServices.GetRequiredService<IApitally>();apitally.SetConsumer( user.Identifier, name: user.Name, // optional group: user.Group, // optional attributes: new Dictionary<string, string?> { ["plan"] = user.Plan } // optional);
The identifier is now always a string. Convert numeric identifiers with ToString().
MaskRequestBody and MaskResponseBody now both receive (span, body), rather than the Request and Response objects. The body is passed as a byte[]. 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 for early decisions based on the request, or SampleOnResponse for decisions based on the response status or consumer. Both receive the span as their only argument.The callbacks should return 1.0 to capture the request, and 0.0 to exclude it. Callbacks can also return any probability between 0 and 1. Returning null from SampleOnRequest applies SampleRate, and returning null from SampleOnResponse preserves the earlier sampling decision.For example, to capture only error responses:
Replace the ShouldExclude 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 registers a tracer provider via AddOpenTelemetry().WithTracing(...), the SDK automatically adds its span processor. No manual registration is required.If you build a tracer provider separately, for example with Sdk.CreateTracerProviderBuilder(), add the ASP.NET Core instrumentation and the Apitally source to it, and register it with dependency injection so the SDK can find it:
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.
Sources: Previously, the SDK captured activities from any ActivitySource during requests. It now captures only the activities your provider is configured for. Register your own sources with AddSource(), and add AddHttpClientInstrumentation() to keep tracing outgoing HTTP calls.
Integration tests: The SDK is automatically disabled in tests using the in-memory TestServer, including the default WebApplicationFactory. For tests running against a real Kestrel server, set Disabled = true or the APITALLY_DISABLED environment variable.
Network access: The SDK now sends data to otlp.apitally.io instead of hub.apitally.io. Update firewall allowlists if necessary.
Removed types: The Apitally.Models namespace, ApitallyConsumer, RequestLoggingOptions, ValidationErrorFilter, and ValidationError have been removed from the public API.
{"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":"6ad8ba0a77553aa7e946289d","clientVersion":"0.0.3964","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/dotnet/v1/migration","slug":"/sdk-reference/dotnet/v1/migration","pageMetadata":{"title":"Migration from v0","description":"Migrate your application to the new Apitally SDK for .NET.","href":"/sdk-reference/dotnet/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 .NET.\"\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 .NET 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`,_jsx(_components.p,{children:`Upgrade the Apitally package to the latest version:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,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:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`dotnet`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` package`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Apitally`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The SDK now requires .NET 8 or later. If your application references OpenTelemetry packages directly, upgrade them to version 1.19.0 or later.`}),`\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`,_jsxs(Heading,{level:`3`,id:`useapitally-has-been-removed`,children:[_jsx(_components.code,{children:`UseApitally()`}),` has been removed`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`AddApitally()`}),` now registers everything the SDK needs, including its middleware. Remove the `,_jsx(_components.code,{children:`app.UseApitally()`}),` call. The SDK adds its middleware at the start of the request pipeline automatically.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`csharp`,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:`csharp`,children:_jsxs(_components.code,{language:`csharp`,numberOfLines:`16`,children:[_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Services`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`AddApitally`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ClientId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your-client-id\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`var`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Build`}),_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:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`UseApitally`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Services`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`AddApitally`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`WriteToken`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your-write-token\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`var`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Build`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If you use a `,_jsx(_components.code,{children:`Startup`}),` class, keep calling `,_jsx(_components.code,{children:`services.AddApitally()`}),` in `,_jsx(_components.code,{children:`ConfigureServices`}),` and remove `,_jsx(_components.code,{children:`app.UseApitally()`}),` from `,_jsx(_components.code,{children:`Configure`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`configuration-changes`,children:`Configuration changes`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`RequestLoggingOptions`}),` class and `,_jsx(_components.code,{children:`RequestLogging`}),` property have been removed. Their settings are now properties directly on `,_jsx(_components.code,{children:`ApitallyOptions`}),`, with the option changes listed below.`]}),`\n`,_jsxs(_components.p,{children:[`The same applies to the `,_jsx(_components.code,{children:`Apitally`}),` section in `,_jsx(_components.code,{children:`appsettings.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`22`,language:`jsonc`,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:`jsonc`,children:_jsxs(_components.code,{language:`jsonc`,numberOfLines:`22`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Before`})}),`\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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Apitally\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"ClientId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-client-id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"RequestLogging\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Enabled\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"IncludeRequestBody\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"IncludeResponseBody\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"HeaderMaskPatterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"^X-Internal-\"`}),_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:`#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`,_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Apitally\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"WriteToken\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-write-token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"CaptureRequestBody\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"CaptureResponseBody\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"MaskHeaders\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"^X-Internal-\"`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\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:`Env`})}),_jsxs(`td`,{children:[`Defaults to the lowercased ASP.NET Core environment name instead of `,_jsx(`code`,{children:`default`}),`, with `,_jsx(`code`,{children:`Production`}),` shortened to `,_jsx(`code`,{children:`prod`}),` and `,_jsx(`code`,{children:`Development`}),` to `,_jsx(`code`,{children:`dev`}),`. Remove the option if the derived name fits your setup.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.CaptureLogs`})}),_jsxs(`td`,{children:[`Moved to `,_jsx(`code`,{children:`CaptureLogs`}),`. Default changed from `,_jsx(`code`,{children:`false`}),` to `,_jsx(`code`,{children:`true`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.IncludeRequestHeaders`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`CaptureRequestHeaders`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.IncludeRequestBody`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`CaptureRequestBody`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.IncludeResponseHeaders`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`CaptureResponseHeaders`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.IncludeResponseBody`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`CaptureResponseBody`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.QueryParamMaskPatterns`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`MaskQueryParams`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.HeaderMaskPatterns`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`MaskHeaders`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.BodyFieldMaskPatterns`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`MaskBodyFields`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.MaskRequestBody`})}),_jsxs(`td`,{children:[`Moved to `,_jsx(`code`,{children:`MaskRequestBody`}),` with new arguments.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.MaskResponseBody`})}),_jsxs(`td`,{children:[`Moved to `,_jsx(`code`,{children:`MaskResponseBody`}),` with new arguments.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging.ShouldExclude`})}),_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:`RequestLogging.PathExcludePatterns`})}),_jsxs(`td`,{children:[`Renamed to `,_jsx(`code`,{children:`ExcludePaths`}),`. 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 have been removed:`}),`\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:_jsx(`code`,{style:{whiteSpace:`nowrap`},children:`RequestLogging`})}),_jsxs(`td`,{children:[`Set its properties directly on `,_jsx(`code`,{children:`ApitallyOptions`}),`, applying the changes above. Remove its `,_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:`RequestLogging.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:`RequestLogging.IncludeQueryParams`})}),_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:`RequestLogging.IncludeException`})}),_jsx(`td`,{children:`Unhandled exceptions are now always captured in request traces.`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`/sdk-reference/dotnet/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 the `,_jsx(_components.code,{children:`IApitally`}),` service with a `,_jsx(_components.code,{children:`SetConsumer()`}),` method. Setting the `,_jsx(_components.code,{children:`ApitallyConsumer`}),` item in `,_jsx(_components.code,{children:`HttpContext.Items`}),` no longer has any effect, and the `,_jsx(_components.code,{children:`ApitallyConsumer`}),` class has been removed.`]}),`\n`,_jsxs(_components.p,{children:[`Call `,_jsx(_components.code,{children:`SetConsumer()`}),` where the consumer is known, such as in your authentication code. Inject `,_jsx(_components.code,{children:`IApitally`}),` into your controllers, Minimal API handlers, or middleware, or resolve it from `,_jsx(_components.code,{children:`HttpContext.RequestServices`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`csharp`,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:`csharp`,children:_jsxs(_components.code,{language:`csharp`,numberOfLines:`16`,children:[_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`context`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Items`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ApitallyConsumer\"`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ApitallyConsumer`})]}),`\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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Identifier`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_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:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Group`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_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:`,`})]}),`\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:`var`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` apitally`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` context`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RequestServices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`GetRequiredService`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`IApitally`}),_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:`apitally`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:` 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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` group`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` attributes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Dictionary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?> { [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"plan\"`}),_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:`#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:[`The identifier is now always a `,_jsx(_components.code,{children:`string`}),`. Convert numeric identifiers with `,_jsx(_components.code,{children:`ToString()`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`body-masking-callbacks`,children:`Body masking callbacks`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`MaskRequestBody`}),` and `,_jsx(_components.code,{children:`MaskResponseBody`}),` now both receive `,_jsx(_components.code,{children:`(span, body)`}),`, rather than the `,_jsx(_components.code,{children:`Request`}),` and `,_jsx(_components.code,{children:`Response`}),` objects. The body is passed as a `,_jsx(_components.code,{children:`byte[]`}),`. Request metadata is available through `,_jsx(_components.a,{href:`/sdk-reference/dotnet/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:`9`,language:`csharp`,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:`csharp`,children:_jsxs(_components.code,{language:`csharp`,numberOfLines:`9`,children:[_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RequestLogging`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`MaskRequestBody`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:` =>`})]}),`\n`,_jsxs(_components.span,{className:`line`,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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?`}),_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:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`Body`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`MaskRequestBody`}),_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:`span`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`})]}),`\n`,_jsxs(_components.span,{className:`line`,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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`GetValueOrDefault`}),_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:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`is`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` string`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` route`}),_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\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--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`]})})}),`\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`}),` for early decisions based on the request, or `,_jsx(_components.code,{children:`SampleOnResponse`}),` for decisions based on the response status or consumer. Both receive the span as their only argument.`]}),`\n`,_jsxs(_components.p,{children:[`The callbacks should return `,_jsx(_components.code,{children:`1.0`}),` to capture the request, and `,_jsx(_components.code,{children:`0.0`}),` to exclude it. Callbacks can also return any probability between 0 and 1. Returning `,_jsx(_components.code,{children:`null`}),` from `,_jsx(_components.code,{children:`SampleOnRequest`}),` applies `,_jsx(_components.code,{children:`SampleRate`}),`, and returning `,_jsx(_components.code,{children:`null`}),` 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:`9`,language:`csharp`,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:`csharp`,children:_jsxs(_components.code,{language:`csharp`,numberOfLines:`9`,children:[_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RequestLogging`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ShouldExclude`}),_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:`request`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_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`}),`\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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`SampleOnResponse`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:` =>`})]}),`\n`,_jsxs(_components.span,{className:`line`,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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`GetValueOrDefault`}),_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:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`is`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` long`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` statusCode`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_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`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1.0`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Replace the `,_jsx(_components.code,{children:`ShouldExclude`}),` 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/dotnet/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 registers a tracer provider via `,_jsx(_components.code,{children:`AddOpenTelemetry().WithTracing(...)`}),`, the SDK automatically adds its span processor. No manual registration is required.`]}),`\n`,_jsxs(_components.p,{children:[`If you build a tracer provider separately, for example with `,_jsx(_components.code,{children:`Sdk.CreateTracerProviderBuilder()`}),`, add the ASP.NET Core instrumentation and the `,_jsx(_components.code,{children:`Apitally`}),` source to it, and register it with dependency injection so the SDK can find it:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`csharp`,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:`csharp`,children:_jsxs(_components.code,{language:`csharp`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Services`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`AddSingleton`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TracerProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tracerProvider`}),_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:`builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Services`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`AddApitally`}),_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`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sources:`}),` Previously, the SDK captured activities from any `,_jsx(_components.code,{children:`ActivitySource`}),` during requests. It now captures only the activities your provider is configured for. Register your own sources with `,_jsx(_components.code,{children:`AddSource()`}),`, and add `,_jsx(_components.code,{children:`AddHttpClientInstrumentation()`}),` to keep tracing outgoing HTTP calls.`]}),`\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:`Integration tests:`}),` The SDK is automatically disabled in tests using the in-memory `,_jsx(_components.code,{children:`TestServer`}),`, including the default `,_jsx(_components.code,{children:`WebApplicationFactory`}),`. For tests running against a real Kestrel server, set `,_jsx(_components.code,{children:`Disabled = true`}),` or the `,_jsx(_components.code,{children:`APITALLY_DISABLED`}),` environment variable.`]}),`\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`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Removed types:`}),` The `,_jsx(_components.code,{children:`Apitally.Models`}),` namespace, `,_jsx(_components.code,{children:`ApitallyConsumer`}),`, `,_jsx(_components.code,{children:`RequestLoggingOptions`}),`, `,_jsx(_components.code,{children:`ValidationErrorFilter`}),`, and `,_jsx(_components.code,{children:`ValidationError`}),` have been removed from the public API.`]}),`\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 .NET.","href":"/sdk-reference/dotnet/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":"UseApitally() has been removed","slug":"useapitally-has-been-removed","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/dotnet/v1/migration","matchLevel":0},"v0":{"href":"/sdk-reference/dotnet/v0/overview","matchLevel":2}},"firstHrefInLanguage":{}},"lastModified":"2026-10-21T06:06:11.852Z","originalFileLocation":"sdk-reference/dotnet/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 .NET.\">\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 .NET.\">\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/dotnet/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+.NET.\u0026amp;theme=f8a29e48343a1364e1ae879f\u0026amp;signature=1039932e5c9c4f5ee5c9b095563353c9656b5913b98654e21bf5d4e314bc6294\">\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 .NET.\">\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+.NET.\u0026amp;theme=f8a29e48343a1364e1ae879f\u0026amp;signature=1039932e5c9c4f5ee5c9b095563353c9656b5913b98654e21bf5d4e314bc6294\">\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/dotnet/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/dotnet/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/dotnet/v1/migration#webpage\",\"url\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration\",\"name\":\"Migration from v0\",\"description\":\"Migrate your application to the new Apitally SDK for .NET.\",\"dateModified\":\"2026-10-21T06:06:11.852Z\",\"isPartOf\":{\"@id\":\"https://docs.apitally.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"SDK reference\",\"item\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Migration from v0\",\"item\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration#article\",\"headline\":\"Migration from v0\",\"name\":\"Migration from v0\",\"description\":\"Migrate your application to the new Apitally SDK for .NET.\",\"url\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration\",\"mainEntityOfPage\":{\"@id\":\"https://docs.apitally.io/sdk-reference/dotnet/v1/migration#webpage\"},\"dateModified\":\"2026-10-21T06:06:11.852Z\",\"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","pages":[{"title":"JavaScript","href":"/sdk-reference/javascript/v1/overview"}]},{"product":"Go","icon":"golang","pages":[{"title":"Go","href":"/sdk-reference/go/v1/overview"}]},{"product":".NET","icon":"microsoft","versions":[{"version":"v1","groups":[{"group":"SDK reference","icon":"book","pages":[{"title":".NET SDK reference","sidebarTitle":"Overview","mode":"wide","href":"/sdk-reference/dotnet/v1/overview"},{"title":"Configuration","href":"/sdk-reference/dotnet/v1/configuration"},{"title":"Masking","href":"/sdk-reference/dotnet/v1/masking"},{"title":"Sampling","href":"/sdk-reference/dotnet/v1/sampling"},{"title":"Tracing instrumentation","sidebarTitle":"Tracing","href":"/sdk-reference/dotnet/v1/tracing"},{"title":"Attributes","description":"Span attributes available to callbacks in the Apitally SDK for .NET.","href":"/sdk-reference/dotnet/v1/attributes"},{"title":"Migration from v0","href":"/sdk-reference/dotnet/v1/migration"}]},{"group":"Setup guides","icon":"rocket","pages":[{"title":"Setup guide for ASP.NET Core","sidebarTitle":"ASP.NET Core","description":"Set up the Apitally SDK for your ASP.NET Core application.","href":"/sdk-reference/dotnet/v1/setup-guides/aspnet-core"}]}]},{"version":"v0","pages":[{"title":"v0","href":"/sdk-reference/dotnet/v0/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_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","deploymentId":"dpl_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","dynamics":[],"chunks":[]}