Connect your Python application to BugByBug using OpenTelemetry (OTel) auto-instrumentation. Once configured, your application can export trace data to BugByBug for continuous monitoring and AI-assisted error investigation.This guide uses the OpenTelemetry Python agent, so you can start collecting telemetry without adding instrumentation code throughout your application.
What you’ll need
Before you begin, make sure you have:
A Python application,
Python 3.10+ and pip installed,
A BugByBug account and project, and
Your BugByBug project API key.
This guide covers frameworks like FastAPI, Flask, Django, Celery, and standalone Python applications. Instrumentation coverage depends on the libraries and versions used by your application.
Next, install the instrumentation packages for the libraries already used by your application:
opentelemetry-bootstrap -a install
The bootstrap command checks your installed Python packages and installs available OpenTelemetry instrumentation packages for supported libraries.For example, if your application uses Flask, Django, or requests, the command can install the corresponding instrumentation packages when available.
3. Configure BugByBug
Configure the OpenTelemetry exporter using environment variables.Add the following to your .env file or application environment:
your-service-name with a recognizable name for your application or service.
YOUR_BUGBYBUG_API_KEY with your actual BugByBug project API key.
Important: The trace endpoint and authentication header above are the BugByBug connection details. The Python exporter must support the configured OTLP/HTTP JSON format. Confirm the exporter package and protocol compatibility before using this configuration in production.
4. Start your application with OpenTelemetry
Use the opentelemetry-instrument command to launch your application.
Replace myproject with your Django project module.
Celery worker
opentelemetry-instrument celery -A tasks worker
Replace tasks with the module containing your Celery application.
Standalone Python script
opentelemetry-instrument python app.py
Replace app.py with your application’s entry-point file.The instrumentation agent runs before your application and instruments supported libraries at runtime. You do not need to add the command separately to every route or function.
5. Verify your connection
After starting your application:
Make a request to one of your application’s endpoints or run a task that exercises an instrumented library.
Check your application logs for OpenTelemetry exporter errors.
Open your BugByBug dashboard.
Confirm that telemetry associated with your configured service appears.
If telemetry does not appear, check the troubleshooting section below before changing your application code.
Troubleshooting
Symptom
Possible cause or fix
opentelemetry-instrument command not found
Confirm that the OpenTelemetry packages are installed in the active virtual environment.
No telemetry appears in BugByBug
Check the API key, endpoint, service name, and exporter configuration.
HTTP 401 or 403
The API key may be missing, incorrect, or invalid.
Exporter reports an unsupported protocol
Confirm that the installed Python exporter supports the protocol configured for BugByBug.
Framework requests are missing
Check whether an instrumentation package is available for the framework and whether it was installed by the bootstrap command.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"BugByBug Docs","colors":{"primary":"#312F80","light":"#F36D21","dark":"#312F80"},"logo":{"light":"https://mintcdn.com/bugbybug-7db4488c/J3e_NT3RYksj_RuS/logo/Logo1.svg?fit=max\u0026auto=format\u0026n=J3e_NT3RYksj_RuS\u0026q=85\u0026s=04d8e133f432efbb7a0230309889ce92","dark":"https://mintcdn.com/bugbybug-7db4488c/J3e_NT3RYksj_RuS/logo/Logo1.3.svg?fit=max\u0026auto=format\u0026n=J3e_NT3RYksj_RuS\u0026q=85\u0026s=e2d642b233629d054e364938158b129d"},"favicon":"https://mintcdn.com/bugbybug-7db4488c/oU-wWfWXEjJa0Htn/favicon.jpg?fit=max\u0026auto=format\u0026n=oU-wWfWXEjJa0Htn\u0026q=85\u0026s=714db7069ba13285d21a1f62e836cf3e","appearance":{"default":"dark","strict":false},"navbar":{"links":[{"icon":"comments-question","href":"mailto:[email protected]","label":"Support"}],"primary":{"type":"button","label":"Request Beta Access","href":"https://bugbybug.com/"}},"footer":{"socials":{"x":"https://x.com/bugbybughq","linkedin":"https://www.linkedin.com/company/bugbybug","website":"https://www.bugbybug.com"}},"errors":{"404":{"redirect":false,"title":"Oops! Wrong page","description":"This does not exist, maybe use the search button."}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://bugbybug.com/"},{"anchor":"Blog","icon":"newspaper","href":"https://blog.bugbybug.com/"},{"anchor":"Discord Community","icon":"discord","href":"https://discord.gg/dCd6z24rGc"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bugbybug-7db4488c","hasAudioNarration":false,"actualSubdomain":"bugbybug-7db4488c","customDomains":["docs.bugbybug.com"],"gitSource":{"type":"github","owner":"bugbybug","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6b0af1eb730522c8a6cc5e3e","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"Documentation","count":10},{"language":"default","tag":"Welcome to BugByBug","count":4},{"language":"default","tag":"Integrations","count":4},{"language":"default","tag":"Resources","count":2},{"language":"default","tag":"Home","count":1},{"language":"default","tag":"Welcome","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"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":"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":"site-roles","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":"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":"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":"turbopuffer-dual-write","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":"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":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"python-guide","slug":"/python-guide","pageMetadata":{"title":"Connect a Python application to BugByBug","description":"Learn how to connect BugByBug to a Python project","icon":"python","href":"/python-guide"},"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: \"Learn how to connect BugByBug to a Python project\"\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`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Connect your Python application to BugByBug using OpenTelemetry (OTel) auto-instrumentation. Once configured, your application can export trace data to BugByBug for continuous monitoring and AI-assisted error investigation.`}),`\n`,_jsxs(_components.p,{children:[`This guide uses the `,_jsx(_components.a,{href:`https://opentelemetry.io/docs/zero-code/python/configuration/`,children:`OpenTelemetry Python agent`}),`, so you can start collecting telemetry without adding instrumentation code throughout your application.`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-you’ll-need`,children:`What you’ll need`}),`\n`,_jsx(_components.p,{children:`Before you begin, make sure you have:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A Python application,`}),`\n`,_jsx(_components.li,{children:`Python 3.10+ and pip installed,`}),`\n`,_jsx(_components.li,{children:`A BugByBug account and project, and`}),`\n`,_jsx(_components.li,{children:`Your BugByBug project API key.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`This guide covers frameworks like FastAPI, Flask, Django, Celery, and standalone Python applications. Instrumentation coverage depends on the libraries and versions used by your application.`}),`\n`,_jsx(Heading,{level:`2`,id:`1-get-your-api-key`,children:`1. Get your API key`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Sign in to your `,_jsx(_components.a,{href:`https://dashboard.bugbybug.com/signup`,children:`BugByBug dashboard`}),`.`]}),`\n`,_jsx(_components.li,{children:`Create or select an existing project.`}),`\n`,_jsx(_components.li,{children:`Copy the project’s API key.`}),`\n`]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Keep this key private. Do not commit it or expose it in frontend code.`})}),`\n`,_jsx(Heading,{level:`2`,id:`2-install-the-opentelemetry-packages`,children:`2. Install the OpenTelemetry packages`}),`\n`,_jsx(_components.p,{children:`Install the OpenTelemetry distribution and instrumentation tools:`}),`\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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` install opentelemetry-distro opentelemetry-instrumentation`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Next, install the instrumentation packages for the libraries already used by your application:`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-bootstrap -a install`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The bootstrap command checks your installed Python packages and installs available OpenTelemetry instrumentation packages for supported libraries.`}),`\n`,_jsx(_components.p,{children:`For example, if your application uses Flask, Django, or requests, the command can install the corresponding instrumentation packages when available.`}),`\n`,_jsx(Heading,{level:`2`,id:`3-configure-bugbybug`,children:`3. Configure BugByBug`}),`\n`,_jsx(_components.p,{children:`Configure the OpenTelemetry exporter using environment variables.`}),`\n`,_jsxs(_components.p,{children:[`Add the following to your `,_jsx(_components.code,{children:`.env`}),` file or application environment:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`OTEL_SERVICE_NAME=your-service-name`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`OTEL_TRACES_EXPORTER=otlp`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://nexus.bugbybug.com/v1/traces`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-api-key=YOUR_BUGBYBUG_API_KEY`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Replace:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`your-service-name`}),` with a recognizable name for your application or service.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`YOUR_BUGBYBUG_API_KEY`}),` with your actual BugByBug project API key.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important:`}),` The trace endpoint and authentication header above are the BugByBug connection details. The Python exporter must support the configured OTLP/HTTP JSON format. Confirm the exporter package and protocol compatibility before using this configuration in production.`]}),`\n`,_jsx(Heading,{level:`2`,id:`4-start-your-application-with-opentelemetry`,children:`4. Start your application with OpenTelemetry`}),`\n`,_jsxs(_components.p,{children:[`Use the `,_jsx(_components.code,{children:`opentelemetry-instrument`}),` command to launch your application.`]}),`\n`,_jsx(Heading,{level:`3`,id:`fastapi-/-uvicorn`,children:`FastAPI / Uvicorn`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-instrument uvicorn main:app --host 0.0.0.0 --port 8000`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`flask`,children:`Flask`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-instrument flask run --host=0.0.0.0 --port=5000`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`django-/-gunicorn`,children:`Django / Gunicorn`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-instrument gunicorn myproject.wsgi:application`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Replace `,_jsx(_components.code,{children:`myproject`}),` with your Django project module.`]}),`\n`,_jsx(Heading,{level:`3`,id:`celery-worker`,children:`Celery worker`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-instrument celery -A tasks worker`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Replace `,_jsx(_components.code,{children:`tasks`}),` with the module containing your Celery application.`]}),`\n`,_jsx(Heading,{level:`3`,id:`standalone-python-script`,children:`Standalone Python script`}),`\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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`opentelemetry-instrument `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` app.py`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Replace `,_jsx(_components.code,{children:`app.py`}),` with your application’s entry-point file.`]}),`\n`,_jsx(_components.p,{children:`The instrumentation agent runs before your application and instruments supported libraries at runtime. You do not need to add the command separately to every route or function.`}),`\n`,_jsx(Heading,{level:`2`,id:`5-verify-your-connection`,children:`5. Verify your connection`}),`\n`,_jsx(_components.p,{children:`After starting your application:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Make a request to one of your application’s endpoints or run a task that exercises an instrumented library.`}),`\n`,_jsx(_components.li,{children:`Check your application logs for OpenTelemetry exporter errors.`}),`\n`,_jsx(_components.li,{children:`Open your BugByBug dashboard.`}),`\n`,_jsx(_components.li,{children:`Confirm that telemetry associated with your configured service appears.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`If telemetry does not appear, check the troubleshooting section below before changing your application code.`}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Symptom`}),_jsx(_components.th,{children:`Possible cause or fix`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`opentelemetry-instrument`}),` command not found`]}),_jsx(_components.td,{children:`Confirm that the OpenTelemetry packages are installed in the active virtual environment.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`No telemetry appears in BugByBug`}),_jsx(_components.td,{children:`Check the API key, endpoint, service name, and exporter configuration.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`HTTP 401 or 403`}),_jsx(_components.td,{children:`The API key may be missing, incorrect, or invalid.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Exporter reports an unsupported protocol`}),_jsx(_components.td,{children:`Confirm that the installed Python exporter supports the protocol configured for BugByBug.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Framework requests are missing`}),_jsx(_components.td,{children:`Check whether an instrumentation package is available for the framework and whether it was installed by the bootstrap command.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Some libraries are not instrumented`}),_jsxs(_components.td,{children:[`Not every Python library has automatic instrumentation. Check the `,_jsx(_components.a,{href:`https://opentelemetry.io/ecosystem/registry/`,children:`OpenTelemetry instrumentation registry`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Telemetry appears under an unexpected service`}),_jsxs(_components.td,{children:[`Check the value of `,_jsx(_components.code,{children:`OTEL_SERVICE_NAME`}),`.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`what’s-next`,children:`What’s next?`}),`\n`,_jsx(_components.p,{children:`Once your Python application is connected, BugByBug can begin receiving its configured telemetry for monitoring and investigation.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`how-it-works`,children:`Learn how BugByBug works`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`opentelemetry`,children:`Explore how OpenTelemetry and BugByBug work together`})}),`\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":"Connect a Python application to BugByBug","description":"Learn how to connect BugByBug to a Python project","icon":"python","href":"/python-guide"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What you’ll need","slug":"what-you’ll-need","depth":2,"children":[]},{"title":"1. Get your API key","slug":"1-get-your-api-key","depth":2,"children":[]},{"title":"2. Install the OpenTelemetry packages","slug":"2-install-the-opentelemetry-packages","depth":2,"children":[]},{"title":"3. Configure BugByBug","slug":"3-configure-bugbybug","depth":2,"children":[]},{"title":"4. Start your application with OpenTelemetry","slug":"4-start-your-application-with-opentelemetry","depth":2,"children":[{"title":"FastAPI / Uvicorn","slug":"fastapi-/-uvicorn","depth":3,"children":[]},{"title":"Flask","slug":"flask","depth":3,"children":[]},{"title":"Django / Gunicorn","slug":"django-/-gunicorn","depth":3,"children":[]},{"title":"Celery worker","slug":"celery-worker","depth":3,"children":[]},{"title":"Standalone Python script","slug":"standalone-python-script","depth":3,"children":[]}]},{"title":"5. Verify your connection","slug":"5-verify-your-connection","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[]},{"title":"What’s next?","slug":"what’s-next","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"bugbybug-7db4488c","siteName":"BugByBug Docs","title":"Connect a Python application to BugByBug - BugByBug Docs","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-28T15:23:27.702Z","originalFileLocation":"python-guide.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=\"Learn how to connect BugByBug to a Python project\">\u003cmeta data-mint-head name=\"application-name\" content=\"BugByBug 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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Connect a Python application to BugByBug - BugByBug Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Learn how to connect BugByBug to a Python project\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"BugByBug Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.bugbybug.com/python-guide\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://bugbybug-7db4488c.mintlify.site/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Connect+a+Python+application+to+BugByBug\u0026amp;description=Learn+how+to+connect+BugByBug+to+a+Python+project\u0026amp;theme=e8f8d27359a131d7f413a5aa\u0026amp;signature=8c6482cff32c5dd1c0afe0b1e5a8e1238b5219f22e4a2f0bf022a19a4c4b530f\">\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=\"Connect a Python application to BugByBug - BugByBug Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Learn how to connect BugByBug to a Python project\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://bugbybug-7db4488c.mintlify.site/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Connect+a+Python+application+to+BugByBug\u0026amp;description=Learn+how+to+connect+BugByBug+to+a+Python+project\u0026amp;theme=e8f8d27359a131d7f413a5aa\u0026amp;signature=8c6482cff32c5dd1c0afe0b1e5a8e1238b5219f22e4a2f0bf022a19a4c4b530f\">\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/bugbybug-7db4488c/dYiuAJOgSfTK61A9/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"BugByBug Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#312F80\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.bugbybug.com/python-guide\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/python-guide.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.bugbybug.com/#organization\",\"name\":\"BugByBug Docs\",\"url\":\"https://docs.bugbybug.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/bugbybug-7db4488c/J3e_NT3RYksj_RuS/logo/Logo1.svg?fit=max\u0026auto=format\u0026n=J3e_NT3RYksj_RuS\u0026q=85\u0026s=04d8e133f432efbb7a0230309889ce92\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.bugbybug.com#website\",\"name\":\"BugByBug Docs\",\"url\":\"https://docs.bugbybug.com\",\"publisher\":{\"@id\":\"https://docs.bugbybug.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.bugbybug.com/python-guide#webpage\",\"url\":\"https://docs.bugbybug.com/python-guide\",\"name\":\"Connect a Python application to BugByBug\",\"description\":\"Learn how to connect BugByBug to a Python project\",\"dateModified\":\"2026-11-28T15:23:27.702Z\",\"isPartOf\":{\"@id\":\"https://docs.bugbybug.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.bugbybug.com/python-guide#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.bugbybug.com/python-guide#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Integrations\",\"item\":\"https://docs.bugbybug.com/reactjs-guide\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connect a Python application to BugByBug\",\"item\":\"https://docs.bugbybug.com/python-guide\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.bugbybug.com/python-guide#article\",\"headline\":\"Connect a Python application to BugByBug\",\"name\":\"Connect a Python application to BugByBug\",\"description\":\"Learn how to connect BugByBug to a Python project\",\"url\":\"https://docs.bugbybug.com/python-guide\",\"mainEntityOfPage\":{\"@id\":\"https://docs.bugbybug.com/python-guide#webpage\"},\"dateModified\":\"2026-11-28T15:23:27.702Z\",\"publisher\":{\"@id\":\"https://docs.bugbybug.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.bugbybug.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"BugByBug Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"BugByBug Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/python-guide.md","siteName":"BugByBug Docs","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://bugbybug.com/"},{"anchor":"Blog","icon":"newspaper","href":"https://blog.bugbybug.com/"},{"anchor":"Discord Community","icon":"discord","href":"https://discord.gg/dCd6z24rGc"}]},"tabs":[{"tab":"Home","icon":"home","pages":[{"title":"Home","href":""}]},{"tab":"Documentation","icon":"book-open","groups":[{"group":"Welcome to BugByBug","pages":[{"title":"Introduction","icon":"handshake","href":"/what-is-bugbybug"},{"title":"How BugByBug Works","icon":"rocket","href":"/how-it-works"},{"title":"Key Concepts in BugByBug","icon":"key","href":"/key-concepts"},{"title":"OpenTelemetry and BugByBug","icon":"code","href":"/opentelemetry"}]},{"group":"Integrations","pages":[{"title":"Connect a React application to BugByBug","icon":"react","href":"/reactjs-guide"},{"title":"Connect a Next.js application to BugByBug","icon":"js","href":"/nextjs-guide"},{"title":"Connect a Node.js application to BugByBug","description":"Learn how to connect BugByBug to a NodeJS project","icon":"node","href":"/nodejs-guide"},{"title":"Connect a Python application to BugByBug","icon":"python","href":"/python-guide"}]},{"group":"Resources","pages":[{"title":"FAQs","description":"Find answers to common questions about BugByBug, OpenTelemetry, telemetry collection, and application monitoring.","icon":"question","href":"/faq/faqs"},{"title":"Troubleshooting","icon":"hammer","href":"/faq/troubleshooting"}]}]}]},"basePath":"","title":"Connect a Python application to BugByBug - BugByBug Docs","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":[],"chunks":[]}