The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.
A span processor sits between your code and the Exporter. It intercepts spans at two key lifecycle points and decides what to do with them before they leave the process — filter, enrich, batch, or export immediately.
The Two Lifecycle Hooks
Every span processor implements two methods:
Hook
When it fires
Span state
Common uses
on_start(span, parent_context)
Right after the span is created.
Mutable. Attributes may not be set yet.
Add context-scoped attributes (session ID, user ID, request ID).
on_end(span)
After span.end() is called.
Passed in as a ReadableSpan — intended to be immutable.
Filter, enrich, or modify attributes; forward to the exporter.
A new processor method, on_ending, is in development. It fires before on_end and gives you a mutable span — useful for modifying attributes at the last moment without the workarounds described below.
Modifying Attributes in on_end
The ReadableSpan passed to on_end is intended to be immutable, but language implementations vary:
Python — nothing is truly immutable. Attributes and context can be edited directly.
TypeScript — ReadableSpan properties are readonly, so the object can’t be reassigned, but properties can be mutated in place.
Editing a ReadableSpan in place can have unintended side effects. If multiple span processors are attached to the Tracer Provider, every downstream processor sees the modification. If you need to modify a span, prefer copying it with the edited attributes rather than mutating the original.
Configuring a Span Processor
The most common processor for production is BatchSpanProcessor, which queues spans and exports them in batches:
Each parameter has a matching environment variable, so you can leave the code unchanged and tune at deploy time. See the BatchSpanProcessor API reference for current defaults.
BatchSpanProcessor vs SimpleSpanProcessor
OpenTelemetry ships two built-in processors. The difference is fundamental — when each span leaves your process.
Property
BatchSpanProcessor
SimpleSpanProcessor
Best for
Production and staging
Local debugging, demos, CI
Export behavior
Async, in batches
Each span immediately (sync)
Impact on latency
Low — work done off the request path
Higher — export blocks the request
Throughput
High, optimized for volume
Low, can bottleneck under load
Reliability on exit
Requires force_flush() / shutdown()
Spans exported immediately
Visibility speed
Slight delay (buffering)
Immediate
Failure surfacing
Export failures logged in background
Failures raised inline
Tuning
Configurable (batch size, delay, timeouts)
Minimal
SimpleSpanProcessor is synchronous and blocking. It exports each span before your code continues, which adds latency to every traced operation. Use BatchSpanProcessor for production.
Common Pitfalls
A few span-processor failure modes worth knowing about:
Using SimpleSpanProcessor in production — exports every span synchronously. Under load, this adds latency to every traced operation.
export_timeout_millis too short — in Python, export failures trigger exponential backoff up to 32 seconds. During that backoff, no other batches can export, the queue fills up, and spans get dropped. Set the timeout high enough that transient slowdowns don’t trigger retries.
max_queue_size, max_export_batch_size, or schedule_delay_millis too high — spans accumulate in memory, creating memory pressure. Big batches may also exceed the backend’s per-request size limit (see the >4 MB gRPC pitfall on the Exporter page).
Forgetting that processors run in order — multiple processors execute in the order they were added. If one mutates a ReadableSpan in on_end, every later processor sees the mutation.
Where Span Processor Fits in the Pipeline
The processor is the middle stage of the export pipeline. Spans flow:
The processor is owned by the Tracer Provider. You can attach multiple processors — each one independently decides whether and when to forward spans to its exporter.
Next step
The span processor decides when spans leave. The Tracer Provider holds it all together:
Next: Tracer Provider and Tracer
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Arize AX Docs","colors":{"primary":"#7A0047","light":"#FF8AC8","dark":"#FF74BF"},"logo":{"light":"https://mintcdn.com/arize-ax/V-uvingrGLOCK4VD/logo/light.svg?fit=max\u0026auto=format\u0026n=V-uvingrGLOCK4VD\u0026q=85\u0026s=cc58ee9388d5b5253d39b65cc662908f","dark":"https://mintcdn.com/arize-ax/V-uvingrGLOCK4VD/logo/dark.svg?fit=max\u0026auto=format\u0026n=V-uvingrGLOCK4VD\u0026q=85\u0026s=b16a0266f5913934131301a1b60af51e","href":"https://arize.com"},"favicon":"https://mintcdn.com/arize-ax/1gcABHkqP5TIGbru/favicon.ico?fit=max\u0026auto=format\u0026n=1gcABHkqP5TIGbru\u0026q=85\u0026s=aef538e87b54a3c819583bc40acfc2f8","appearance":{"default":"dark"},"background":{"color":{"light":"#FFFFFF","dark":"#0A0A12"}},"navbar":{"links":[],"primary":{"type":"button","label":"Get started","href":"https://app.arize.com/auth/join"}},"footer":{"socials":{"x":"https://x.com/arizeai","bluesky":"https://bsky.app/profile/arize.bsky.social","threads":"https://www.threads.com/@arize.ai","instagram":"https://www.instagram.com/arize_ai","linkedin":"https://www.linkedin.com/company/arizeai","youtube":"https://youtube.com/@arizeai","slack":"https://arize-ai.slack.com/ssb/redirect","website":"https://fosstodon.org/@arizeai"},"links":[{"header":"Support","items":[{"label":"Chat Us On Slack","href":"https://arize-ai.slack.com/ssb/redirect"},{"label":"support@arize.com","href":"mailto:support@arize.com"},{"label":"System Status","href":"https://status.arize.com"}]},{"header":"Get Started","items":[{"label":"Signup For Free","href":"https://arize.com/join"},{"label":"Book A Demo","href":"https://arize.com/request-a-demo"}]},{"header":"Resources","items":[{"label":"Blog","href":"https://arize.com/blog"}]}]},"seo":{"metatags":{"canonical":"https://arize.com/docs"},"indexing":"all"},"fonts":{"heading":{"family":"Geist","weight":600},"body":{"family":"Geist"}},"styling":{"codeblocks":{"theme":{"light":"github-light-default","dark":"github-dark-default"}},"latex":true},"integrations":{"gtm":{"tagId":"GTM-W96XM35"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"interaction":{"drilldown":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"arize-ax","hasAudioNarration":false,"actualSubdomain":"arize-ax","customDomains":[],"gitSource":{"type":"github","owner":"arize-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"contextualFeedback":{"allowEmail":true,"emailDisclaimer":"We will only use your email to follow up with you about this feedback."}},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6afa81bdfa6d377b6d1d4433","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"APIs, SDKs, Skills \u0026 MCP","count":369},{"language":"default","tag":"Get Started","count":256},{"language":"default","tag":"API reference","count":214},{"language":"default","tag":"REST","count":181},{"language":"default","tag":"Endpoints","count":178},{"language":"default","tag":"API clients","count":143},{"language":"default","tag":"Machine Learning","count":139},{"language":"default","tag":"ML observability","count":139},{"language":"default","tag":"Integrations","count":129},{"language":"default","tag":"Python SDK","count":67}]},"assistantConfig":{"enableAskAiButton":true,"enableStarterQuestions":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@arize.com"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","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":"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":"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":"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":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","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":"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":"workos-sso-scim","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},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","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}],"starterQuestions":[{"_id":"6944513fe59e82150b5700b3","deploymentId":"6894ef048eafbd2a7c20796e","questionText":"Need more help? Ask our team in #arize-ax-platform-support on community Slack.","status":"active","generatedBy":"manual","createdAt":"2025-12-18T19:08:47.802Z","updatedAt":"2025-12-18T19:15:01.436Z","__v":0}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"/* cyrillic-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrodmgPn.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrMdmgPn.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* symbols2 */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFg08vz7ehw.woff2) format('woff2');\n unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrgdmgPn.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrkdmgPn.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrcdmg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrodmgPn.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrMdmgPn.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* symbols2 */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFg08vz7ehw.woff2) format('woff2');\n unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrgdmgPn.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrkdmgPn.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrcdmg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrodmgPn.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrMdmgPn.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* symbols2 */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFg08vz7ehw.woff2) format('woff2');\n unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrgdmgPn.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrkdmgPn.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrcdmg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrodmgPn.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrMdmgPn.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* symbols2 */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFg08vz7ehw.woff2) format('woff2');\n unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrgdmgPn.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrkdmgPn.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Geist Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/docs/_mintlify/assets/fonts/google/s/geistmono/v6/or3nQ6H-1_WfwkMZI_qYFrcdmg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\nhtml:root{--font-family-mono-custom: 'Geist Mono'}html:root{--gray-50: 248 248 246;--gray-100: 242 242 237;--gray-200: 230 230 223;--gray-300: 205 205 200;--gray-400: 179 179 191;--gray-500: 138 138 150;--gray-600: 91 91 105;--gray-700: 62 62 78;--gray-800: 46 46 61;--gray-900: 21 21 31;--gray-950: 10 10 18}html:root{--ax-radius-sm: 2px;--ax-radius-md: 6px;--ax-radius-lg: 8px;--ax-accent-bg: #FF74BF;--ax-panel: #CDBEF7;--ax-panel-2: #E3DBFC;--ax-panel-code: #FFFFFF;--ax-panel-border: rgba(19, 22, 64, 0.22);--ax-panel-icon: #4827C1;--ax-panel-t1: #121221;--ax-panel-t2: #2A2A38;--ax-panel-accent: #6E1046;--ax-panel-code-kw: #3F4110;--ax-panel-code-flag: #5A3200;--ax-panel-code-url: #004A70;--ax-panel-selection: #FFE9F4}html:not(.dark){--ax-bg: #FFFFFF;--ax-surface: #F8F8F4;--ax-code-bg: #F5F5ED;--ax-chip: #EDEDE2;--ax-line: rgba(19, 22, 64, 0.20);--ax-t1: #121221;--ax-t2: #2E2E3D;--ax-t3: #3E3E4E;--ax-accent: #7A0047;--ax-accent-line: rgba(255, 98, 182, 0.55);--ax-accent-soft: #FFE9F4;--ax-on-accent: #121221;--ax-note: #E8F3EC;--ax-note-line: rgba(30, 70, 50, 0.24);--ax-note-t: #1B4230;--ax-warn: #FBEEE0;--ax-warn-line: rgba(90, 50, 0, 0.24);--ax-warn-t: #54300A;--ax-blue: #E7F3FD;--ax-blue-line: rgba(0, 82, 125, 0.24);--ax-blue-t: #00527D;--ax-danger: #FFEBE9;--ax-danger-line: rgba(207, 34, 46, 0.28);--ax-danger-t: #A40E26}html.dark{--ax-bg: #0A0A12;--ax-surface: #15151F;--ax-code-bg: #05050B;--ax-chip: #221B3A;--ax-line: rgba(247, 247, 252, 0.16);--ax-t1: #F5F5FA;--ax-t2: #DCDCE6;--ax-t3: #B3B3C4;--ax-accent: #FF8AC8;--ax-accent-line: rgba(255, 138, 200, 0.45);--ax-accent-soft: #2A1425;--ax-on-accent: #0A0A12;--ax-note: #10241A;--ax-note-line: rgba(159, 224, 188, 0.30);--ax-note-t: #9FE0BC;--ax-warn: #2A1B0A;--ax-warn-line: rgba(255, 201, 138, 0.30);--ax-warn-t: #FFC98A;--ax-blue: #0A1A24;--ax-blue-line: rgba(57, 195, 255, 0.30);--ax-blue-t: #97D8FF;--ax-danger: #2A0F12;--ax-danger-line: rgba(255, 138, 148, 0.30);--ax-danger-t: #FFB3B8}#content{line-height:1.75}#page-title,#content h1{font-size:clamp(2rem, 1.4rem + 2.1vw, 2.875rem);line-height:1.12;letter-spacing:-0.02em;font-weight:600}#content h2,#content h3,#content h4{letter-spacing:-0.01em;font-weight:600}#content code,#content kbd,#content samp{font-feature-settings:'tnum' 1}#content a:not(.card){color:var(--ax-accent);text-decoration-thickness:1px;text-underline-offset:3px}:focus-visible{outline:2px solid var(--ax-accent-line);outline-offset:2px}html.dark :focus-visible{outline-color:var(--ax-accent-line)}::selection{background:var(--ax-accent-soft)}#navbar{background:var(--ax-bg);border-bottom:1px solid var(--ax-line)}#navbar div:has(>.nav-tabs){position:relative}#navbar div:has(>.nav-tabs)::before{content:'';position:absolute;top:0;left:50%;width:100vw;margin-left:-50vw;border-top:1px solid var(--ax-line);pointer-events:none}.nav-tabs-item[data-active]{box-shadow:inset 0 -2px 0 var(--ax-accent)}.ax-product-selector{position:relative;display:inline-flex;align-items:stretch;flex:0 0 auto}.ax-product-selector--desktop{margin-left:0.75rem;align-self:center}.page-context-dropdown__label{font-family:inherit;font-weight:400}.page-context-dropdown__chevron>span{display:inline-block;transition:transform 150ms ease}.page-context-dropdown__chevron svg{display:block;width:1rem;height:1rem}.page-context-dropdown__chevron[aria-expanded=\"true\"]>span{transform:rotate(180deg)}.page-context-dropdown__menu{position:absolute;z-index:60;top:calc(100% + 0.55rem);right:0;min-width:12.5rem;padding:0.4rem;background:var(--ax-bg);border:1px solid var(--ax-line);border-radius:var(--ax-radius-md);box-shadow:0 0.75rem 1.5rem rgb(10 10 18 / 0.18)}.ax-product-selector--desktop .page-context-dropdown__menu{right:auto;left:0}.page-context-dropdown__menu[hidden]{display:none}.page-context-dropdown__item{display:flex;align-items:center;justify-content:space-between;min-height:2.5rem;padding:0.55rem 0.65rem;color:var(--ax-t1);border-radius:var(--ax-radius-sm);font-size:0.9375rem;font-weight:400;text-decoration:none;transition:background-color 150ms ease, color 150ms ease}.page-context-dropdown__item:hover,.page-context-dropdown__item:focus-visible{color:var(--ax-accent);background:var(--ax-accent-soft)}.page-context-dropdown__item[data-selected=\"true\"]{color:var(--ax-accent);font-weight:500}.page-context-dropdown__item[data-selected=\"true\"]::after{content:'✓';margin-left:1.5rem;color:var(--ax-accent);font-size:0.875rem}@media (prefers-reduced-motion: reduce){.page-context-dropdown__chevron>span,.page-context-dropdown__item{transition:none}}@media (max-width: 767px){#navbar .ax-product-selector--desktop{display:none}#mobile-nav-content .ax-product-selector--mobile{margin:0.5rem 0 1rem}#mobile-nav-content .page-context-dropdown__label{flex:1 1 auto}#mobile-nav-content .page-context-dropdown__chevron{flex:0 0 auto}#mobile-nav-content .page-context-dropdown__menu{position:static;margin-top:0.4rem}}#topbar-cta-button{background:var(--ax-accent-bg);color:var(--ax-on-accent);border-radius:var(--ax-radius-md);border:none}#topbar-cta-button span,#topbar-cta-button svg{color:var(--ax-on-accent)!important}#search-bar-entry{background:var(--ax-surface);border:1px solid var(--ax-line);border-radius:var(--ax-radius-md)}#assistant-entry{background:var(--ax-surface);border:1px solid var(--ax-accent-line);border-radius:var(--ax-radius-md)}#assistant-entry svg{color:var(--ax-accent)}#page-context-menu,.page-context-dropdown{font-size:0.9375rem;align-items:stretch}#page-context-menu-button,.page-context-dropdown__label{display:inline-flex;align-items:center;padding:10px 14px;border-radius:var(--ax-radius-md) 0 0 var(--ax-radius-md);background:var(--ax-surface);border-color:var(--ax-line);color:var(--ax-t1);border:1px solid var(--ax-line);text-decoration:none}#page-context-menu-button>div{font-size:0.9375rem;gap:9px}#page-context-menu>button[aria-haspopup],.page-context-dropdown__chevron{height:auto;align-self:stretch;aspect-ratio:auto;padding:10px 11px;border-radius:0 var(--ax-radius-md) var(--ax-radius-md) 0;background:var(--ax-surface);border-color:var(--ax-line);color:var(--ax-t3);border:1px solid var(--ax-line);border-left:0;cursor:pointer}#sidebar-content li[data-active]>a{background:var(--ax-accent-soft);color:var(--ax-accent);border-radius:var(--ax-radius-md);font-weight:500}.sidebar-group-header{font-weight:600;color:var(--ax-t1)}.toc-item[data-active],.toc-item[data-active] a{color:var(--ax-accent);font-weight:400}.card.card{background:var(--ax-surface);border-color:var(--ax-line);border-radius:var(--ax-radius-lg);box-shadow:none}.frame.frame{background:var(--ax-surface);border:1px solid var(--ax-line);border-radius:var(--ax-radius-lg)}.accordion.accordion,.accordion-group.accordion-group{border-radius:var(--ax-radius-md);border-color:var(--ax-line)}.accordion.accordion{background:var(--ax-surface)}.code-block.code-block,.code-group.code-group{background:var(--ax-code-bg);border-color:var(--ax-line);border-radius:var(--ax-radius-md)}.code-block-background{background:var(--ax-code-bg)!important}html.dark .code-block-background{background:var(--ax-code-bg)!important}#content :not(pre)>code{background:var(--ax-chip);border-radius:var(--ax-radius-sm)}.code-block:has([data-floating-buttons]) [data-fade-overlay]{background-image:none}[data-floating-buttons] button{background:var(--ax-chip)}.callout .code-block.code-block,.callout .code-group.code-group,.callout .code-block-background,html.dark .callout .code-block-background{background:var(--ax-bg)!important}.callout{border-radius:var(--ax-radius-lg)}.callout[data-callout-type=\"callout\"],.callout[data-callout-type=\"info\"]{background:var(--ax-surface);border-color:var(--ax-line)}.callout[data-callout-type=\"callout\"] [data-component-part=\"callout-content\"],.callout[data-callout-type=\"info\"] [data-component-part=\"callout-content\"]{color:var(--ax-t2)!important}.callout[data-callout-type=\"tip\"],.callout[data-callout-type=\"check\"]{background:var(--ax-note);border-color:var(--ax-note-line)}.callout[data-callout-type=\"tip\"] [data-component-part=\"callout-content\"],.callout[data-callout-type=\"check\"] [data-component-part=\"callout-content\"]{color:var(--ax-note-t)!important}.callout[data-callout-type=\"warning\"]{background:var(--ax-warn);border-color:var(--ax-warn-line)}.callout[data-callout-type=\"warning\"] [data-component-part=\"callout-content\"]{color:var(--ax-warn-t)!important}.callout[data-callout-type=\"note\"]{background:var(--ax-blue);border-color:var(--ax-blue-line)}.callout[data-callout-type=\"note\"] [data-component-part=\"callout-content\"]{color:var(--ax-blue-t)!important}.callout[data-callout-type=\"danger\"]{background:var(--ax-danger);border-color:var(--ax-danger-line)}.callout[data-callout-type=\"danger\"] [data-component-part=\"callout-content\"]{color:var(--ax-danger-t)!important}[data-component-part=\"step-number\"]>div{background:var(--ax-accent-soft);border:1px solid var(--ax-accent-line);color:var(--ax-accent);font-weight:500}.update.update-container{flex-direction:column;gap:0.5rem;border-top:1px solid var(--ax-line)}.update.update-container:first-of-type{border-top:none}.update.update-container>div:first-child{width:100%;position:static}.update.update-container>div:last-child{width:100%;max-width:none}#content th{color:var(--ax-t1);font-weight:600;border-bottom:1px solid var(--ax-line)}#content td{border-bottom:1px solid var(--ax-line)}footer{border-top:1px solid var(--ax-line)}.ax-hero .callout{background:var(--ax-panel);border-color:var(--ax-panel-border);border-radius:var(--ax-radius-lg)}.ax-hero .callout [data-component-part=\"callout-content\"],.ax-hero .callout p,.ax-hero .callout li{color:var(--ax-panel-t2)!important}.ax-hero .callout h2,.ax-hero .callout h3,.ax-hero .callout strong{color:var(--ax-panel-t1)!important}.ax-hero .callout [data-component-part=\"callout-icon\"] svg{background:var(--ax-panel-icon)!important}.ax-hero .code-block,.ax-hero .code-group,.ax-hero .code-block-background{background:var(--ax-panel-code)!important;border-color:var(--ax-panel-border)}.ax-hero .code-block,.ax-hero .code-group{padding:0;overflow:hidden}html.dark .ax-hero .code-block,html.dark .ax-hero .code-group,html.dark .ax-hero .code-block-background,html.dark .ax-hero .shiki,html:not(.dark) .ax-hero .code-block,html:not(.dark) .ax-hero .code-group,html:not(.dark) .ax-hero .code-block-background{background:var(--ax-panel-code)!important}html.dark .ax-hero .shiki,html.dark .ax-hero .shiki span{color:var(--ax-panel-t1)!important}html.dark .ax-hero .shiki span[style*=\"#FFA657\"]{color:var(--ax-panel-code-kw)!important}html.dark .ax-hero .shiki span[style*=\"#79C0FF\"]{color:var(--ax-panel-code-flag)!important}html.dark .ax-hero .shiki span[style*=\"#A5D6FF\"]{color:var(--ax-panel-code-url)!important}.ax-hero .code-group>div:first-child,html.dark .ax-hero .code-group>div:first-child{background:var(--ax-panel-2)!important;border-bottom:1px solid var(--ax-panel-border)}.ax-hero .code-group [role=\"tab\"]{color:var(--ax-panel-t2)!important}.ax-hero .code-group [role=\"tab\"][aria-selected=\"true\"]{color:var(--ax-panel-accent)!important}.ax-hero .code-group [role=\"tab\"][aria-selected=\"true\"]>div:last-child{background:var(--ax-panel-accent)!important}.ax-hero .code-block svg,.ax-hero .code-group svg{color:var(--ax-panel-t2)}html.dark .ax-hero [data-fade-overlay]{background-image:linear-gradient(\n to right,\n rgb(255 255 255 / 0) 0,\n rgb(255 255 255 / 0.2) 10px,\n rgb(255 255 255 / 0.5) 25px,\n rgb(255 255 255 / 0.8) 35px,\n rgb(255 255 255) 45px\n )}.ax-hero .callout a{color:var(--ax-panel-accent)!important}.ax-hero::selection,.ax-hero ::selection{background:var(--ax-panel-selection)}.card-group .card img{max-height:197px!important}.card-group[class$=\"-2\"] .card img{height:160px!important}.card-group[class$=\"-3\"] .card img{height:150px!important}table{display:table!important}.step-title{font-size:1.5rem!important}"}],"page":{"pagePath":"ax/concepts/otel-openinference/span-processor","slug":"/ax/concepts/otel-openinference/span-processor","pageMetadata":{"title":"Span Processor","sidebarTitle":"Span processor","description":"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.","keywords":["span processor","BatchSpanProcessor","SimpleSpanProcessor","on_start","on_end","OpenTelemetry"],"href":"/ax/concepts/otel-openinference/span-processor"},"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: \"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\"\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`,blockquote:`blockquote`,code:`code`,em:`em`,hr:`hr`,img:`img`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Card,CodeBlock,Heading,Table,Warning}=_components;if(!Card)_missingMdxReference(`Card`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`A `,_jsx(_components.strong,{children:`span processor`}),` sits between your code and the `,_jsx(_components.a,{href:`/ax/concepts/otel-openinference/exporter`,children:`Exporter`}),`. It intercepts spans at two key lifecycle points and decides what to do with them before they leave the process — filter, enrich, batch, or export immediately.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-two-lifecycle-hooks`,children:`The Two Lifecycle Hooks`}),`\n`,_jsx(_components.p,{children:`Every span processor implements two methods:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Hook`}),_jsx(_components.th,{style:{textAlign:`left`},children:`When it fires`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Span state`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Common uses`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`on_start(span, parent_context)`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Right after the span is created.`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Mutable. Attributes may not be set yet.`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Add context-scoped attributes (session ID, user ID, request ID).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`on_end(span)`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`After `,_jsx(_components.code,{children:`span.end()`}),` is called.`]}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Passed in as a `,_jsx(_components.code,{children:`ReadableSpan`}),` — intended to be immutable.`]}),_jsx(_components.td,{style:{textAlign:`left`},children:`Filter, enrich, or modify attributes; forward to the exporter.`})]})]})]}),`\n`,_jsx(_components.p,{children:_jsx(_components.img,{src:`https://storage.googleapis.com/arize-phoenix-assets/assets/images/arize-docs-images/concepts/otel/span-processor-flow.png`,alt:`Span processor flow`})}),`\n`,_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[`A new processor method, `,_jsx(_components.code,{children:`on_ending`}),`, is in development. It fires before `,_jsx(_components.code,{children:`on_end`}),` and gives you a mutable span — useful for modifying attributes at the last moment without the workarounds described below.`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`3`,id:`modifying-attributes-in-on_end`,children:[`Modifying Attributes in `,_jsx(_components.code,{children:`on_end`})]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`ReadableSpan`}),` passed to `,_jsx(_components.code,{children:`on_end`}),` is `,_jsx(_components.em,{children:`intended`}),` to be immutable, but language implementations vary:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Python`}),` — nothing is truly immutable. Attributes and context can be edited directly.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`TypeScript`}),` — `,_jsx(_components.code,{children:`ReadableSpan`}),` properties are `,_jsx(_components.code,{children:`readonly`}),`, so the object can’t be reassigned, but properties can be mutated in place.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Editing a `,_jsx(_components.code,{children:`ReadableSpan`}),` in place can have unintended side effects. If multiple span processors are attached to the Tracer Provider, every downstream processor sees the modification. If you need to modify a span, prefer copying it with the edited attributes rather than mutating the original.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`configuring-a-span-processor`,children:`Configuring a Span Processor`}),`\n`,_jsxs(_components.p,{children:[`The most common processor for production is `,_jsx(_components.code,{children:`BatchSpanProcessor`}),`, which queues spans and exports them in batches:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` opentelemetry.exporter.otlp.proto.http.trace_exporter `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` OTLPSpanExporter`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` opentelemetry.sdk.trace.export `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` BatchSpanProcessor`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`otlp_exporter `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` OTLPSpanExporter(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`span_processor `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` BatchSpanProcessor(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` span_exporter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`otlp_exporter,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` max_queue_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`2048`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#8B949E`},children:`# env: OTEL_BSP_MAX_QUEUE_SIZE`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` schedule_delay_millis`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`5000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#8B949E`},children:`# env: OTEL_BSP_SCHEDULE_DELAY`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` max_export_batch_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`512`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#8B949E`},children:`# env: OTEL_BSP_MAX_EXPORT_BATCH_SIZE`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` export_timeout_millis`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`30000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#8B949E`},children:`# env: OTEL_BSP_EXPORT_TIMEOUT`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Each parameter has a matching environment variable, so you can leave the code unchanged and tune at deploy time. See the `,_jsx(_components.a,{href:`https://opentelemetry-python.readthedocs.io/en/latest/sdk/trace.export.html#opentelemetry.sdk.trace.export.BatchSpanProcessor`,children:`BatchSpanProcessor API reference`}),` for current defaults.`]}),`\n`,_jsx(Heading,{level:`2`,id:`batchspanprocessor-vs-simplespanprocessor`,children:`BatchSpanProcessor vs SimpleSpanProcessor`}),`\n`,_jsx(_components.p,{children:`OpenTelemetry ships two built-in processors. The difference is fundamental — when each span leaves your process.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Property`}),_jsx(_components.th,{style:{textAlign:`left`},children:`BatchSpanProcessor`}),_jsx(_components.th,{style:{textAlign:`left`},children:`SimpleSpanProcessor`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Best for`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Production and staging`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Local debugging, demos, CI`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Export behavior`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Async, in batches`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Each span immediately (sync)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Impact on latency`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Low — work done off the request path`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Higher — export blocks the request`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Throughput`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`High, optimized for volume`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Low, can bottleneck under load`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Reliability on exit`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Requires `,_jsx(_components.code,{children:`force_flush()`}),` / `,_jsx(_components.code,{children:`shutdown()`})]}),_jsx(_components.td,{style:{textAlign:`left`},children:`Spans exported immediately`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Visibility speed`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Slight delay (buffering)`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Immediate`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Failure surfacing`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Export failures logged in background`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Failures raised inline`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.strong,{children:`Tuning`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Configurable (batch size, delay, timeouts)`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Minimal`})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`SimpleSpanProcessor`}),` is synchronous and blocking. It exports each span before your code continues, which adds latency to every traced operation. Use `,_jsx(_components.code,{children:`BatchSpanProcessor`}),` for production.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`common-pitfalls`,children:`Common Pitfalls`}),`\n`,_jsx(_components.p,{children:`A few span-processor failure modes worth knowing about:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Using `,_jsx(_components.code,{children:`SimpleSpanProcessor`}),` in production`]}),` — exports every span synchronously. Under load, this adds latency to every traced operation.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`export_timeout_millis`}),` too short`]}),` — in Python, export failures trigger exponential backoff up to 32 seconds. During that backoff, no other batches can export, the queue fills up, and spans get dropped. Set the timeout high enough that transient slowdowns don’t trigger retries.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`max_queue_size`}),`, `,_jsx(_components.code,{children:`max_export_batch_size`}),`, or `,_jsx(_components.code,{children:`schedule_delay_millis`}),` too high`]}),` — spans accumulate in memory, creating memory pressure. Big batches may also exceed the backend’s per-request size limit (see the >4 MB gRPC pitfall on the `,_jsx(_components.a,{href:`/ax/concepts/otel-openinference/exporter#common-pitfalls`,children:`Exporter page`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Forgetting that processors run in order`}),` — multiple processors execute in the order they were added. If one mutates a `,_jsx(_components.code,{children:`ReadableSpan`}),` in `,_jsx(_components.code,{children:`on_end`}),`, every later processor sees the mutation.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`where-span-processor-fits-in-the-pipeline`,children:`Where Span Processor Fits in the Pipeline`}),`\n`,_jsx(_components.p,{children:`The processor is the middle stage of the export pipeline. Spans flow:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Your code → Tracer → Span Processor → Exporter → Arize AX`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The processor is owned by the `,_jsx(_components.a,{href:`/ax/concepts/otel-openinference/tracer-provider`,children:`Tracer Provider`}),`. You can attach multiple processors — each one independently decides whether and when to forward spans to its exporter.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`next-step`,children:`Next step`}),`\n`,_jsx(_components.p,{children:`The span processor decides when spans leave. The Tracer Provider holds it all together:`}),`\n`,_jsx(Card,{title:`Next: Tracer Provider and Tracer`,icon:`arrow-right`,href:`/ax/concepts/otel-openinference/tracer-provider`})]})}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":{"codeStyling":{"theme":{"light":"github-light-default","dark":"github-dark-default"}},"config":{},"pageMetadata":{"title":"Span Processor","sidebarTitle":"Span processor","description":"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.","keywords":["span processor","BatchSpanProcessor","SimpleSpanProcessor","on_start","on_end","OpenTelemetry"],"href":"/ax/concepts/otel-openinference/span-processor"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The Two Lifecycle Hooks","slug":"the-two-lifecycle-hooks","depth":2,"children":[{"title":"Modifying Attributes in on_end","slug":"modifying-attributes-in-on_end","depth":3,"children":[]}]},{"title":"Configuring a Span Processor","slug":"configuring-a-span-processor","depth":2,"children":[]},{"title":"BatchSpanProcessor vs SimpleSpanProcessor","slug":"batchspanprocessor-vs-simplespanprocessor","depth":2,"children":[]},{"title":"Common Pitfalls","slug":"common-pitfalls","depth":2,"children":[]},{"title":"Where Span Processor Fits in the Pipeline","slug":"where-span-processor-fits-in-the-pipeline","depth":2,"children":[]},{"title":"Next step","slug":"next-step","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/arize-ax/6a30b7a67da02161/analytics.js","/docs/_mintlify/custom/arize-ax/67a4d27b62fababa/product-selector.js"],"subdomain":"arize-ax","siteName":"Arize AX Docs","title":"Span Processor - Arize AX Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-11T22:06:19.973Z","originalFileLocation":"ax/concepts/otel-openinference/span-processor.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=\"dark\"}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=\"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Arize AX Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_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=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Span Processor - Arize AX Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Arize AX Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://arize-ax.mintlify.site/docs/_mintlify/api/og/v2?division=OpenTelemetry+and+OpenInference\u0026amp;title=Span+Processor\u0026amp;description=The+OpenTelemetry+component+that+intercepts+spans+at+the+start+and+end+of+their+lifecycle+%E2%80%94+how+BatchSpanProcessor+and+SimpleSpanProcessor+differ%2C+and+how+to+tu\u0026amp;theme=6b2e1c1a14346acb1262754f\u0026amp;signature=903a14752d05cbdc8ff0b9c08aab3320ab38c9b1fdb92b0c428dc707a7840f20\">\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=\"Span Processor - Arize AX Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://arize-ax.mintlify.site/docs/_mintlify/api/og/v2?division=OpenTelemetry+and+OpenInference\u0026amp;title=Span+Processor\u0026amp;description=The+OpenTelemetry+component+that+intercepts+spans+at+the+start+and+end+of+their+lifecycle+%E2%80%94+how+BatchSpanProcessor+and+SimpleSpanProcessor+differ%2C+and+how+to+tu\u0026amp;theme=6b2e1c1a14346acb1262754f\u0026amp;signature=903a14752d05cbdc8ff0b9c08aab3320ab38c9b1fdb92b0c428dc707a7840f20\">\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=\"/docs/mintlify-assets/_mintlify/favicons/arize-ax/vxzD83QsbAzzm43O/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Arize AX Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#7A0047\">\u003clink data-mint-head rel=\"canonical\" href=\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/ax/concepts/otel-openinference/span-processor.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://arize.com/#organization\",\"name\":\"Arize AX Docs\",\"url\":\"https://arize.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/arize-ax/V-uvingrGLOCK4VD/logo/light.svg?fit=max\u0026auto=format\u0026n=V-uvingrGLOCK4VD\u0026q=85\u0026s=cc58ee9388d5b5253d39b65cc662908f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://arize.com/docs#website\",\"name\":\"Arize AX Docs\",\"url\":\"https://arize.com/docs\",\"publisher\":{\"@id\":\"https://arize.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor#webpage\",\"url\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor\",\"name\":\"Span Processor\",\"description\":\"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\",\"dateModified\":\"2026-11-11T22:06:19.973Z\",\"isPartOf\":{\"@id\":\"https://arize.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"OpenTelemetry and OpenInference\",\"item\":\"https://arize.com/docs/ax/concepts/otel-openinference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Span Processor\",\"item\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor#article\",\"headline\":\"Span Processor\",\"name\":\"Span Processor\",\"description\":\"The OpenTelemetry component that intercepts spans at the start and end of their lifecycle — how BatchSpanProcessor and SimpleSpanProcessor differ, and how to tune them.\",\"url\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor\",\"mainEntityOfPage\":{\"@id\":\"https://arize.com/docs/ax/concepts/otel-openinference/span-processor#webpage\"},\"dateModified\":\"2026-11-11T22:06:19.973Z\",\"keywords\":\"span processor, BatchSpanProcessor, SimpleSpanProcessor, on_start, on_end, OpenTelemetry\",\"publisher\":{\"@id\":\"https://arize.com/#organization\"},\"isPartOf\":{\"@id\":\"https://arize.com/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/ax/concepts/otel-openinference/span-processor.md","siteName":"Arize AX Docs","nav":{"global":null,"tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/ax"}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/ax/cookbooks"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/ax/integrations"}]},{"tab":"APIs, SDKs, Skills \u0026 MCP","pages":[{"title":"APIs, SDKs, Skills \u0026 MCP","href":"/api-reference/overview"}]},{"tab":"Courses","pages":[{"title":"Courses","href":"/ax/learn/courses/overview"}]},{"tab":"Concepts","groups":[{"group":"OpenTelemetry and OpenInference","pages":[{"title":"OpenTelemetry and OpenInference","sidebarTitle":"Overview","href":"/ax/concepts/otel-openinference/overview"},{"title":"Signals, Spans, Traces, and Sessions","sidebarTitle":"Signals, spans, traces, and sessions","href":"/ax/concepts/otel-openinference/signals"},{"title":"Resource","sidebarTitle":"Resource","href":"/ax/concepts/otel-openinference/resource"},{"title":"Exporter and OTLP","sidebarTitle":"Exporter and OTLP","description":"How OpenTelemetry ships spans out of your application — exporters, the OTLP protocol, and the choice between gRPC and HTTP transport.","href":"/ax/concepts/otel-openinference/exporter"},{"title":"Span Processor","sidebarTitle":"Span processor","href":"/ax/concepts/otel-openinference/span-processor"},{"title":"Tracer Provider and Tracer","sidebarTitle":"Tracer provider and tracer","description":"The central configuration object for OpenTelemetry tracing — what the Tracer Provider owns, how to configure it, and the Lambda and Node.js shutdown gotchas to know about.","href":"/ax/concepts/otel-openinference/tracer-provider"},{"title":"The arize.otel Helpers","sidebarTitle":"arize.otel helpers","href":"/ax/concepts/otel-openinference/arize-otel-helpers"},{"title":"OpenInference Semantic Conventions","sidebarTitle":"Semantic conventions","href":"/ax/concepts/otel-openinference/semantic-conventions"},{"title":"OpenInference Span Kinds","sidebarTitle":"Span kinds","href":"/ax/concepts/otel-openinference/span-kinds"},{"title":"Instrumentation Approaches","sidebarTitle":"Instrumentation approaches","href":"/ax/concepts/otel-openinference/instrumentation-approaches"},{"title":"OpenInference Context Managers","sidebarTitle":"Context managers","href":"/ax/concepts/otel-openinference/context-managers"},{"title":"Context Propagation","sidebarTitle":"Context propagation","href":"/ax/concepts/otel-openinference/context-propagation"},{"title":"Sampling","sidebarTitle":"Sampling","href":"/ax/concepts/otel-openinference/sampling"},{"title":"OpenTelemetry Collector","sidebarTitle":"OpenTelemetry Collector","href":"/ax/concepts/otel-openinference/otel-collector"}]},{"group":"Prompts","pages":[{"title":"Prompts in Arize AX","sidebarTitle":"Overview","href":"/ax/concepts/prompts/overview"},{"title":"The Prompt Object","sidebarTitle":"The Prompt Object","href":"/ax/concepts/prompts/prompt-object"},{"title":"Versioning and Tags","sidebarTitle":"Versioning and tags","href":"/ax/concepts/prompts/versioning-and-tags"},{"title":"The Prompt Hub","sidebarTitle":"The Prompt Hub","href":"/ax/concepts/prompts/prompt-hub"},{"title":"Loading Prompts in Your Application","sidebarTitle":"Loading in applications","href":"/ax/concepts/prompts/loading-in-applications"},{"title":"The Prompt Playground","sidebarTitle":"The Prompt Playground","href":"/ax/concepts/prompts/prompt-playground"},{"title":"Datasets for Prompt Iteration","sidebarTitle":"Datasets","href":"/ax/concepts/prompts/datasets-for-prompts"},{"title":"Experiments for Prompts","sidebarTitle":"Experiments","href":"/ax/concepts/prompts/experiments-for-prompts"},{"title":"Prompts in CI/CD","sidebarTitle":"Prompts in CI/CD","href":"/ax/concepts/prompts/prompts-in-ci-cd"},{"title":"Optimizing Prompts","sidebarTitle":"Optimizing prompts","href":"/ax/concepts/prompts/optimizing-prompts"}]},{"group":"Evaluators","pages":[{"title":"Evaluators in Arize AX","sidebarTitle":"Overview","href":"/ax/concepts/evaluators/overview"},{"title":"Evaluation Levels — Span, Trace, and Session","sidebarTitle":"Evaluation levels","href":"/ax/concepts/evaluators/evaluation-levels"},{"title":"Evaluator Types — Human, Code, and LLM-as-a-Judge","sidebarTitle":"Evaluator types","href":"/ax/concepts/evaluators/evaluator-types"},{"title":"Anatomy of an Evaluator","sidebarTitle":"Anatomy of an evaluator","href":"/ax/concepts/evaluators/anatomy-of-an-evaluator"},{"title":"Online vs Offline Evaluators","sidebarTitle":"Online vs offline","href":"/ax/concepts/evaluators/online-vs-offline"},{"title":"Online LLM-as-a-Judge","sidebarTitle":"Online LLM-as-a-judge","href":"/ax/concepts/evaluators/online-llm-as-judge"},{"title":"Online Code Evaluators","sidebarTitle":"Online code evaluators","href":"/ax/concepts/evaluators/online-code-evaluators"},{"title":"Filters, Scope, and Cadence","sidebarTitle":"Filters, scope, and cadence","href":"/ax/concepts/evaluators/filters-scope-and-cadence"},{"title":"Offline Evaluation","sidebarTitle":"Offline evaluation","href":"/ax/concepts/evaluators/offline-evaluation-with-phoenix"},{"title":"Evaluating Agents","sidebarTitle":"Evaluating agents","href":"/ax/concepts/evaluators/evaluating-agents"},{"title":"Evaluator Best Practices","sidebarTitle":"Best practices","href":"/ax/concepts/evaluators/evaluator-best-practices"},{"title":"Validating and Improving Evaluators","sidebarTitle":"Validating and improving","href":"/ax/concepts/evaluators/validating-and-improving-evaluators"}]},{"group":"adb","pages":[{"title":"adb in Arize AX","sidebarTitle":"Overview","href":"/ax/concepts/adb/overview"},{"title":"adb architecture","sidebarTitle":"Architecture","href":"/ax/concepts/adb/architecture"},{"title":"Real-time ingestion in adb","sidebarTitle":"Real-time ingestion","href":"/ax/concepts/adb/real-time-ingestion"},{"title":"adb performance \u0026 benchmarks","sidebarTitle":"Performance \u0026 benchmarks","href":"/ax/concepts/adb/performance"}]}]},{"tab":"Self-Hosting","pages":[{"title":"Self-Hosting","href":"/ax/selfhosting"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/ax/release-notes"}]}]},"basePath":"","title":"Span Processor - Arize AX Docs","buildId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","deploymentId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DsiWwPWR.js","lightbox-handle-r17bVUz3.js"]}