{"slug": "baseten-monitoring-observability-with-opentelemetry", "title": "Baseten Monitoring & Observability with OpenTelemetry", "summary": "Baseten has released a monitoring and observability integration using OpenTelemetry that exports traces, logs, and metrics to SigNoz, enabling developers to track performance and usage of their AI and LLM applications. The setup uses auto-instrumentation in Python to capture telemetry data, which can then be analyzed in unified dashboards for alerts and reliability improvements.", "body_md": "Overview\n\nThis guide walks you through setting up monitoring and observability for Baseten using [OpenTelemetry](https://opentelemetry.io/) and exporting traces, logs, and metrics to SigNoz. With this integration, you can observe and track various metrics for your Baseten applications and LLM usage.\n\nMonitoring Baseten in your AI applications with telemetry ensures full observability across your AI and LLM workflows. By leveraging SigNoz, you can analyze correlated traces, logs, and metrics in unified dashboards, configure alerts, and gain actionable insights to continuously improve reliability, responsiveness, and user experience.\n\nPrerequisites\n\n- A\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key or[Self Hosted SigNoz instance](https://signoz.io/docs/install/self-host/) - For Python:\n`pip`\n\ninstalled for managing Python packages - A\n[Baseten account](https://login.baseten.co/sign-up)and API key. You can get the API key from[Baseten API Keys page](https://app.baseten.co/settings/account/api_keys)\n\nMonitoring Baseten\n\nFor more information on getting started with Baseten in your Python environment, refer to the [Baseten quickstart guide](https://docs.baseten.co/training/getting-started).\n\nNo code auto-instrumentation is recommended for quick setup with minimal code changes. It's ideal when you want to get observability up and running without modifying your application code and are leveraging standard instrumentor libraries.\n\nStep 1: Install the necessary packages in your Python environment.\n\n```\npip install \\\n  opentelemetry-distro \\\n  opentelemetry-exporter-otlp \\\n  httpx \\\n  opentelemetry-instrumentation-httpx \\\n  opentelemetry-instrumentation-system-metrics \\\n  openai \\\n  opentelemetry-instrumentation-openai-v2\n```\n\nStep 2: Add Automatic Instrumentation\n\n```\nopentelemetry-bootstrap --action=install\n```\n\nStep 3: Configure logging level\n\nTo ensure logs are properly captured and exported, configure the root logger to emit logs at the DEBUG level or higher:\n\n``` python\nimport logging\n\nlogging.getLogger().setLevel(logging.DEBUG)\nlogging.getLogger(\"httpx\").setLevel(logging.DEBUG)\n```\n\nThis sets the minimum log level for the root logger to DEBUG, which ensures that `logger.debug()`\n\ncalls and higher severity logs (INFO, WARNING, ERROR, CRITICAL) are captured by the OpenTelemetry logging auto-instrumentation and sent to SigNoz.\n\nStep 4: Create an example Baseten application\n\n``` python\nfrom openai import OpenAI\nimport os\nimport logging\n\nlogging.getLogger().setLevel(logging.DEBUG)\nlogging.getLogger(\"httpx\").setLevel(logging.DEBUG)\n\nclient = OpenAI(\n    base_url=\"https://inference.baseten.co/v1\",\n    api_key=os.environ[\"BASETEN_API_KEY\"],\n)\n\ntry:\n    response = client.chat.completions.create(\n        model=\"nvidia/Nemotron-120B-A12B\",\n        messages=[\n            {\"role\": \"user\", \"content\": \"What is SigNoz?\"},\n        ],\n    )\n    print(response.choices[0].message.content)\nexcept Exception as e:\n    print(f\"Error type: {type(e).__name__}\")\n    print(f\"Error message: {str(e)}\")\n    if hasattr(e, 'response'):\n        print(f\"Response status: {e.response.status_code if hasattr(e.response, 'status_code') else 'N/A'}\")\n        print(f\"Response body: {e.response.text if hasattr(e.response, 'text') else 'N/A'}\")\n    raise\n```\n\nBefore running this code, ensure that you have set the environment variable `BASETEN_API_KEY`\n\nwith your generated Baseten API key.\n\nStep 5: Run your application with auto-instrumentation\n\nRun your application with the following environment variables set. This configures OpenTelemetry to export traces, logs, and metrics to SigNoz Cloud and enables automatic log correlation:\n\n```\nOTEL_RESOURCE_ATTRIBUTES=\"service.name=<service_name>\" \\\nOTEL_EXPORTER_OTLP_ENDPOINT=\"https://ingest.<region>.signoz.cloud:443\" \\\nOTEL_EXPORTER_OTLP_HEADERS=\"signoz-ingestion-key=<your-ingestion-key>\" \\\nOTEL_EXPORTER_OTLP_PROTOCOL=grpc \\\nOTEL_TRACES_EXPORTER=otlp \\\nOTEL_METRICS_EXPORTER=otlp \\\nOTEL_LOGS_EXPORTER=otlp \\\nOTEL_PYTHON_LOG_CORRELATION=true \\\nOTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \\\nopentelemetry-instrument <your_run_command>\n```\n\nis the name of your service`<service_name>`\n\n`<region>`\n\n: Your[SigNoz Cloud region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint)`<your-ingestion-key>`\n\n: Your SigNoz[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)- Replace\n`<your_run_command>`\n\nwith the actual command you would use to run your application. In this case we would use:`python main.py`\n\nCode-based manual instrumentation gives you fine-grained control over your telemetry configuration. Use this approach when you need to customize resource attributes, sampling strategies, or integrate with existing observability infrastructure.\n\nStep 1: Install additional OpenTelemetry dependencies\n\n```\npip install \\\n  opentelemetry-api \\\n  opentelemetry-sdk \\\n  opentelemetry-exporter-otlp \\\n  opentelemetry-instrumentation-httpx \\\n  opentelemetry-instrumentation-system-metrics \\\n  openai \\\n  opentelemetry-instrumentation-openai-v2\n```\n\nStep 2: Set up Traces\n\n``` python\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import BatchSpanProcessor\nfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter\nfrom opentelemetry import trace\nfrom opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor\nimport os\n\nresource = Resource.create({\"service.name\": \"<service_name>\"})\nprovider = TracerProvider(resource=resource)\nspan_exporter = OTLPSpanExporter(\n    endpoint=os.getenv(\"OTEL_EXPORTER_TRACES_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nprocessor = BatchSpanProcessor(span_exporter)\nprovider.add_span_processor(processor)\ntrace.set_tracer_provider(provider)\n\nOpenAIInstrumentor().instrument()\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud trace endpoint with appropriate`OTEL_EXPORTER_TRACES_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/traces`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nStep 3: Set up Metrics\n\n``` python\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.metrics import MeterProvider\nfrom opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter\nfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader\nfrom opentelemetry import metrics\nfrom opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor\nfrom opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor\nimport os\n\nresource = Resource.create({\"service.name\": \"<service_name>\"})\nmetric_exporter = OTLPMetricExporter(\n    endpoint=os.getenv(\"OTEL_EXPORTER_METRICS_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nreader = PeriodicExportingMetricReader(metric_exporter)\nmetric_provider = MeterProvider(metric_readers=[reader], resource=resource)\nmetrics.set_meter_provider(metric_provider)\n\nmeter = metrics.get_meter(__name__)\n\n# turn on out-of-the-box metrics\nSystemMetricsInstrumentor().instrument()\nHTTPXClientInstrumentor().instrument()\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud endpoint with appropriate`OTEL_EXPORTER_METRICS_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/metrics`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nSystemMetricsInstrumentor provides system metrics (CPU, memory, etc.), and HTTPXClientInstrumentor provides outbound HTTP request metrics such as request duration. If you want to add custom metrics to your Baseten application, see [Python Custom Metrics](https://signoz.io/opentelemetry/python-custom-metrics/).\n\nStep 4: Set up Logs\n\n``` python\nimport logging\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry._logs import set_logger_provider\nfrom opentelemetry.sdk._logs import LoggerProvider, LoggingHandler\nfrom opentelemetry.sdk._logs.export import BatchLogRecordProcessor\nfrom opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter\nimport os\n\nresource = Resource.create({\"service.name\": \"<service_name>\"})\nlogger_provider = LoggerProvider(resource=resource)\nset_logger_provider(logger_provider)\n\notlp_log_exporter = OTLPLogExporter(\n    endpoint=os.getenv(\"OTEL_EXPORTER_LOGS_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nlogger_provider.add_log_record_processor(\n    BatchLogRecordProcessor(otlp_log_exporter)\n)\n# Attach OTel logging handler to root logger\nhandler = LoggingHandler(level=logging.INFO, logger_provider=logger_provider)\nlogging.basicConfig(level=logging.INFO, handlers=[handler])\n\nlogger = logging.getLogger(__name__)\n\n# Enable httpx logging to capture HTTP requests\nhttpx_logger = logging.getLogger(\"httpx\")\nhttpx_logger.setLevel(logging.DEBUG)\nhttpx_logger.addHandler(handler)\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud endpoint with appropriate`OTEL_EXPORTER_LOGS_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/logs`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nStep 5: Run an example Baseten application\n\nEnsure you have completed the steps above (traces, logs, and metrics configuration) before running this code. All OpenTelemetry instrumentation must be initialized first.\n\n``` python\nfrom openai import OpenAI\nimport os\nimport logging\n\nlogging.getLogger().setLevel(logging.DEBUG)\nlogging.getLogger(\"httpx\").setLevel(logging.DEBUG)\n\nclient = OpenAI(\n    base_url=\"https://inference.baseten.co/v1\",\n    api_key=os.environ[\"BASETEN_API_KEY\"],\n)\n\ntry:\n    response = client.chat.completions.create(\n        model=\"nvidia/Nemotron-120B-A12B\",\n        messages=[\n            {\"role\": \"user\", \"content\": \"What is SigNoz?\"},\n        ],\n    )\n    print(response.choices[0].message.content)\nexcept Exception as e:\n    print(f\"Error type: {type(e).__name__}\")\n    print(f\"Error message: {str(e)}\")\n    if hasattr(e, 'response'):\n        print(f\"Response status: {e.response.status_code if hasattr(e.response, 'status_code') else 'N/A'}\")\n        print(f\"Response body: {e.response.text if hasattr(e.response, 'text') else 'N/A'}\")\n    raise\n```\n\nBefore running this code, ensure that you have set the environment variable `BASETEN_API_KEY`\n\nwith your generated Baseten API key.\n\nView Traces, Logs, and Metrics in SigNoz\n\nYour Baseten LLM usage should now automatically emit traces, logs, and metrics.\n\nYou should be able to view traces in SigNoz Cloud under the traces tab:\n\nWhen you click on a trace in SigNoz, you'll see a detailed view of the trace, including all associated spans, along with their events and attributes.\n\nYou should be able to view logs in SigNoz Cloud under the logs tab. You can also view logs by clicking on the \"Related Logs\" button in the trace view to see correlated logs:\n\nWhen you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:\n\nYou should be able to see Baseten related metrics in SigNoz Cloud under the metrics tab:\n\nWhen you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:\n\nTroubleshooting\n\n[Troubleshooting](#troubleshooting)\n\nIf you don't see your telemetry data:\n\n**Verify network connectivity**- Ensure your application can reach SigNoz Cloud endpoints** Check ingestion key**- Verify your SigNoz ingestion key is correct** Wait for data**- OpenTelemetry batches data before sending, so wait 10-30 seconds after making API calls** Try a console exporter**— Enable a console exporter locally to confirm that your application is generating telemetry data before it’s sent to SigNoz\n\nNext Steps\n\nYou can also check out our custom Baseten dashboard [here](https://signoz.io/docs/dashboards/dashboard-templates/baseten-dashboard/) which provides specialized visualizations for monitoring your Baseten usage in applications. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.\n\nSetup OpenTelemetry Collector (Optional)\n\n[Setup OpenTelemetry Collector (Optional)](#setup-opentelemetry-collector-optional)\n\nWhat is the OpenTelemetry Collector?\n\nThink of the OTel Collector as a middleman between your app and SigNoz. Instead of your application sending data directly to SigNoz, it sends everything to the Collector first, which then forwards it along.\n\nWhy use it?\n\n**Cleaning up data**— Filter out noisy traces you don't care about, or remove sensitive info before it leaves your servers.** Keeping your app lightweight**— Let the Collector handle batching, retries, and compression instead of your application code.** Adding context automatically**— The Collector can tag your data with useful info like which Kubernetes pod or cloud region it came from.** Future flexibility**— Want to send data to multiple backends later? The Collector makes that easy without changing your app.\n\nSee [Switch from direct export to Collector](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/switch-to-collector/) for step-by-step instructions to convert your setup.\n\nFor more details, see [Why use the OpenTelemetry Collector?](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/why-to-use-collector/) and the [Collector configuration guide](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/configuration/).\n\nAdditional resources:\n\n- Set up\n[alerts](https://signoz.io/docs/alerts/)for high latency or error rates - Learn more about\n[querying traces](https://signoz.io/docs/userguide/traces/) - Explore\n[log correlation](https://signoz.io/docs/userguide/logs_query_builder/)", "url": "https://wpnews.pro/news/baseten-monitoring-observability-with-opentelemetry", "canonical_source": "https://signoz.io/docs/baseten-monitoring", "published_at": "2026-06-11 00:00:00+00:00", "updated_at": "2026-06-12 09:59:57.460600+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "large-language-models", "ai-infrastructure", "mlops"], "entities": ["Baseten", "OpenTelemetry", "SigNoz", "Python"], "alternates": {"html": "https://wpnews.pro/news/baseten-monitoring-observability-with-opentelemetry", "markdown": "https://wpnews.pro/news/baseten-monitoring-observability-with-opentelemetry.md", "text": "https://wpnews.pro/news/baseten-monitoring-observability-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/baseten-monitoring-observability-with-opentelemetry.jsonld"}}