{"slug": "openai-monitoring-with-opentelemetry", "title": "OpenAI Monitoring with OpenTelemetry", "summary": "SigNoz released a guide for monitoring OpenAI applications using OpenTelemetry and its observability platform, enabling developers to track token usage, model latency, error rates, and request traces in real time. The setup requires Python 3.8+ or Java 8+ with the OpenAI library, and provides step-by-step instrumentation instructions for both SigNoz Cloud and self-hosted instances. The integration aims to help teams identify cost drivers, detect API failures, and trace individual LLM calls through their full application stack.", "body_md": "This guide walks you through setting up OpenAI monitoring using OpenTelemetry and SigNoz. You will instrument your OpenAI applications to capture traces, logs, and metrics and visualize them in real time in SigNoz.\n\nOpenAI monitoring with SigNoz gives you visibility into:\n\n**Token usage**— track input and output tokens per request to understand cost drivers** Model latency**— measure response times across models and request types** Error rates**— detect API failures, rate limit errors, and timeouts before they impact users** Request traces**— follow individual LLM calls through your full application stack\n\nRequirements\n\n- Python 3.8 or newer\n- OpenAI Python library (\n`openai >= 1.0.0`\n\n) - Valid OpenAI API key\n- SigNoz setup (choose one):\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key- Self-hosted SigNoz instance\n\nSetup\n\nStep 1. Create a virtual environment\n\n```\npython3 -m venv .venv\nsource .venv/bin/activate\n```\n\nStep 2. Install the OpenTelemetry dependencies\n\n```\npip install opentelemetry-distro~=0.51b0\npip install opentelemetry-exporter-otlp~=1.30.0\npip install opentelemetry-instrumentation-openai-v2\n```\n\nStep 3. Add automatic instrumentation\n\n```\nopentelemetry-bootstrap --action=install\n```\n\nStep 4. Run your application\n\n```\nOTEL_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_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \\\nOTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true \\\nOPENAI_API_KEY=<your-openai-key> \\\nopentelemetry-instrument <your_run_command>\n```\n\n**Environment Variables Explained:**\n\n`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED`\n\n- Enables automatic logging instrumentation`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`\n\n- Captures prompts and completions as logs`<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\n`<service-name>`\n\nwith the name of your serviceReplace\n\n`<your-openai-key>`\n\nwith your OpenAI API key\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nRequirements\n\n- Java 8 or newer\n- OpenAI Java SDK (\n`openai-java >= 1.1.0`\n\n) - Valid OpenAI API key\n- SigNoz setup (choose one):\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key- Self-hosted SigNoz instance\n\nSetup\n\nStep 1. Add dependencies\n\n**For Gradle (build.gradle.kts):**\n\n```\ndependencies {\n    implementation(\"com.openai:openai-java:3.6.1\")\n    implementation(\"io.github.cdimascio:dotenv-java:3.0.0\")\n    implementation(\"io.opentelemetry:opentelemetry-api:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-sdk:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-sdk-trace:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-sdk-metrics:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-sdk-logs:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-exporter-otlp:1.54.1\")\n    implementation(\"io.opentelemetry:opentelemetry-semconv:1.27.0-alpha\")\n    implementation(platform(\"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:2.20.1-alpha\"))\n    implementation(\"io.opentelemetry.instrumentation:opentelemetry-openai-java-1.1\")\n}\n```\n\n**For Maven (pom.xml):**\n\n```\n<dependencies>\n    <dependency>\n        <groupId>com.openai</groupId>\n        <artifactId>openai-java</artifactId>\n        <version>3.6.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.github.cdimascio</groupId>\n        <artifactId>dotenv-java</artifactId>\n        <version>3.0.0</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-api</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-sdk</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-sdk-trace</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-sdk-metrics</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-sdk-logs</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-exporter-otlp</artifactId>\n        <version>1.54.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry</groupId>\n        <artifactId>opentelemetry-semconv</artifactId>\n        <version>1.27.0-alpha</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry.instrumentation</groupId>\n        <artifactId>opentelemetry-openai-java-1.1</artifactId>\n        <version>2.20.1-alpha</version>\n    </dependency>\n</dependencies>\n```\n\nStep 2. Import the necessary modules in your Java application\n\n**OpenTelemetry:**\n\n``` python\nimport io.opentelemetry.api.OpenTelemetry;\nimport io.opentelemetry.instrumentation.openai.v1_1.OpenAITelemetry;\nimport io.opentelemetry.sdk.OpenTelemetrySdk;\nimport io.opentelemetry.sdk.resources.Resource;\nimport io.opentelemetry.semconv.ServiceAttributes;\n```\n\n**Traces:**\n\n``` python\nimport io.opentelemetry.sdk.trace.SdkTracerProvider;\nimport io.opentelemetry.sdk.trace.export.BatchSpanProcessor;\nimport io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;\n```\n\n**Logs:**\n\n``` python\nimport io.opentelemetry.sdk.logs.SdkLoggerProvider;\nimport io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor;\nimport io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporter;\n```\n\n**Metrics:**\n\n``` python\nimport io.opentelemetry.sdk.metrics.SdkMeterProvider;\nimport io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;\nimport io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter;\n```\n\nStep 3. Setup Traces\n\n``` python\nimport io.github.cdimascio.dotenv.Dotenv;\n\nimport io.opentelemetry.api.OpenTelemetry;\nimport io.opentelemetry.sdk.OpenTelemetrySdk;\nimport io.opentelemetry.sdk.resources.Resource;\nimport io.opentelemetry.semconv.ServiceAttributes;\n\nimport io.opentelemetry.sdk.trace.SdkTracerProvider;\nimport io.opentelemetry.sdk.trace.export.BatchSpanProcessor;\nimport io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;\n\nDotenv dotenv = Dotenv.load();\n\nString serviceName = \"<service_name>\";\n\nResource resource = Resource.getDefault()\n            .toBuilder()\n            .put(ServiceAttributes.SERVICE_NAME, serviceName)\n            .build();\n\nOtlpHttpSpanExporter otlpSpanExporter = OtlpHttpSpanExporter.builder()\n            .setEndpoint(System.getenv(\"OTEL_EXPORTER_TRACES_ENDPOINT\"))\n            .addHeader(\"signoz-ingestion-key\", System.getenv(\"SIGNOZ_INGESTION_KEY\"))\n            .build();\n\nSdkTracerProvider tracerProvider = SdkTracerProvider.builder()\n            .setResource(resource)\n            .addSpanProcessor(BatchSpanProcessor.builder(otlpSpanExporter).build())\n            .build();\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud 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\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nStep 4. Setup Logs\n\n``` python\nimport io.opentelemetry.sdk.logs.SdkLoggerProvider;\nimport io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor;\nimport io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporter;\n\nOtlpHttpLogRecordExporter otlpLogExporter = OtlpHttpLogRecordExporter.builder()\n            .setEndpoint(System.getenv(\"OTEL_EXPORTER_LOGS_ENDPOINT\"))\n            .addHeader(\"signoz-ingestion-key\", System.getenv(\"SIGNOZ_INGESTION_KEY\"))\n            .build();\n\nSdkLoggerProvider loggerProvider = SdkLoggerProvider.builder()\n            .setResource(resource)\n            .addLogRecordProcessor(BatchLogRecordProcessor.builder(otlpLogExporter).build())\n            .build();\n```\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\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nStep 5. Setup Metrics\n\n``` python\nimport io.opentelemetry.sdk.metrics.SdkMeterProvider;\nimport io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;\nimport io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter;\n\nOtlpHttpMetricExporter otlpMetricExporter = OtlpHttpMetricExporter.builder()\n            .setEndpoint(System.getenv(\"OTEL_EXPORTER_METRICS_ENDPOINT\"))\n            .addHeader(\"signoz-ingestion-key\", System.getenv(\"SIGNOZ_INGESTION_KEY\"))\n            .build();\n\nSdkMeterProvider meterProvider = SdkMeterProvider.builder()\n            .setResource(resource)\n            .registerMetricReader(PeriodicMetricReader.builder(otlpMetricExporter).build())\n            .build();\n```\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\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nStep 6. Setup OpenTelemetry SDK with your created providers\n\n```\nOpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder()\n            .setTracerProvider(tracerProvider)\n            .setMeterProvider(meterProvider)\n            .setLoggerProvider(loggerProvider)\n            .build();\n```\n\nStep 7. Run an Example using OpenAI Instrumentor\n\n``` python\nimport io.opentelemetry.instrumentation.openai.v1_1.OpenAITelemetry;\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.ChatModel;\nimport com.openai.models.chat.completions.ChatCompletion;\nimport com.openai.models.chat.completions.ChatCompletionCreateParams;\n\nOpenAIClient client = OpenAIOkHttpClient.builder()\n            .apiKey(System.getenv(\"OPENAI_API_KEY\"))\n            .build();\n\nOpenAIClient otelClient = OpenAITelemetry.builder(openTelemetry)\n            .build()\n            .wrap(client);\n\nChatCompletionCreateParams params = ChatCompletionCreateParams.builder()\n            .addUserMessage(\"What is SigNoz?\")\n            .model(\"gpt-4.1\")\n            .build();\n\nChatCompletion chatCompletion = otelClient.chat().completions().create(params);\nSystem.out.println(chatCompletion);\n\n// Force flush with timeout to ensure all telemetry is exported before shutdown\nsdk.getSdkTracerProvider().forceFlush().join(10, java.util.concurrent.TimeUnit.SECONDS);\nsdk.getSdkMeterProvider().forceFlush().join(10, java.util.concurrent.TimeUnit.SECONDS);\nsdk.getSdkLoggerProvider().forceFlush().join(10, java.util.concurrent.TimeUnit.SECONDS);\n\nsdk.getSdkTracerProvider().shutdown();\nsdk.getSdkMeterProvider().shutdown();\nsdk.getSdkLoggerProvider().shutdown();\n```\n\n📌 Note: Before running this code, ensure that you have set the environment variable or .env file\n\n`OPENAI_API_KEY`\n\nwith your generated API key.\n\nRequirements\n\n- Java 8 or newer\n- OpenAI Java SDK (\n`openai-java >= 1.1.0`\n\n) - Valid OpenAI API key\n- OpenTelemetry Java agent (if not already installed)\n- SigNoz setup (choose one):\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key- Self-hosted SigNoz instance\n\nSetup with Auto-Instrumentation\n\nIf you're already using the OpenTelemetry Java agent for auto-instrumentation, you can add OpenAI instrumentation on top of your existing setup.\n\nStep 1. Add dependencies\n\n**For Gradle (build.gradle.kts):**\n\n```\ndependencies {\n    implementation(\"com.openai:openai-java:3.6.1\")\n    implementation(platform(\"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:2.20.1-alpha\"))\n    implementation(\"io.opentelemetry.instrumentation:opentelemetry-openai-java-1.1\")\n}\n```\n\n**For Maven (pom.xml):**\n\n```\n<dependencies>\n    <dependency>\n        <groupId>com.openai</groupId>\n        <artifactId>openai-java</artifactId>\n        <version>3.6.1</version>\n    </dependency>\n    <dependency>\n        <groupId>io.opentelemetry.instrumentation</groupId>\n        <artifactId>opentelemetry-openai-java-1.1</artifactId>\n        <version>2.20.1-alpha</version>\n    </dependency>\n</dependencies>\n```\n\nStep 2. Import the necessary modules in your Java application\n\n``` python\nimport io.opentelemetry.api.GlobalOpenTelemetry;\nimport io.opentelemetry.api.OpenTelemetry;\nimport io.opentelemetry.instrumentation.openai.v1_1.OpenAITelemetry;\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.ChatModel;\nimport com.openai.models.chat.completions.ChatCompletion;\nimport com.openai.models.chat.completions.ChatCompletionCreateParams;\n```\n\nStep 3. Wrap your OpenAI client with OpenTelemetry instrumentation\n\n```\n// Get the global OpenTelemetry instance configured by the Java agent\nOpenTelemetry openTelemetry = GlobalOpenTelemetry.get();\n\n// Create your OpenAI client\nOpenAIClient client = OpenAIOkHttpClient.builder()\n    .apiKey(System.getenv(\"OPENAI_API_KEY\"))\n    .build();\n\n// Wrap it with OpenTelemetry instrumentation\nOpenAIClient otelClient = OpenAITelemetry.builder(openTelemetry)\n    .build()\n    .wrap(client);\n\n// Use otelClient for all OpenAI API calls\nChatCompletionCreateParams params = ChatCompletionCreateParams.builder()\n    .addUserMessage(\"What is SigNoz?\")\n    .model(\"gpt-4\")\n    .build();\n\nChatCompletion chatCompletion = otelClient.chat().completions().create(params);\nSystem.out.println(chatCompletion);\n```\n\nStep 4. Download the OpenTelemetry Java agent (if not already installed)\n\n```\ncurl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar\n```\n\nStep 5. Run your application with the Java agent\n\n```\nOTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \\\nOTEL_EXPORTER_OTLP_HEADERS=\"signoz-ingestion-key=<your-ingestion-key>\" \\\nOTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<region>.signoz.cloud:443 \\\njava -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar\n```\n\n**Configuration Variables:**\n\n- Set\n`<service_name>`\n\nto the name of your service `<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`<my-app>`\n\nwith your application JAR file name\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\n📌\n\nNote:This approach uses`GlobalOpenTelemetry.get()`\n\nto retrieve the OpenTelemetry instance configured by the Java agent. This ensures that OpenAI traces are properly correlated with traces from auto-instrumented components (HTTP servers, databases, etc.).\n\n📌\n\nNote:Before running this code, ensure that you have set the environment variable`OPENAI_API_KEY`\n\nwith your generated API key.\n\n📌\n\nNote:The Java agent will automatically instrument common frameworks and libraries (Spring Boot, JDBC, HTTP clients, etc.). The OpenAI instrumentation library adds specific telemetry for OpenAI API calls on top of this existing instrumentation.\n\n📌\n\nNote:If you're running a web application or microservice, the OpenAI spans will automatically be linked as child spans to incoming HTTP request spans, providing full distributed tracing across your application.\n\nWhat Does OpenAI Monitoring Capture?\n\nThis instrumentation captures comprehensive telemetry data for your OpenAI applications:\n\nTraces\n\n**Spans** for each OpenAI API call with timing information**Operation details** like model name, max tokens etc.**Token usage** including input and output**Request and response metadata** such as finish reason and model used\n\nLogs\n\n**Structured logs** for each API call when`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`\n\nis set**Message content logs**(prompts and completions) when`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`\n\nis enabled**Error logs** for failed API calls with detailed error information and stack traces**Performance logs** showing request duration and timing information\n\n**Log Levels and Content:**\n\n`INFO`\n\nlevel logs for successful API calls with metadata`ERROR`\n\nlevel logs for failed requests with error details`DEBUG`\n\nlevel logs for detailed request/response information (when debug logging is enabled)\n\nMetrics\n\n**Duration metrics** showing how long OpenAI calls take**Token usage metrics** tracking consumption over time**Request rate metrics** showing API call frequency**Error rate metrics** for monitoring API failures\n\nMore details about the metrics can be found [here](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/).\n\nValidating Your OpenAI Monitoring Setup\n\n**Validate your traces, logs, and metrics in SigNoz:**\n\n- Trigger OpenAI API calls in your app. Make several API calls to generate some data. Then, wait for some time.\n- In SigNoz, open the\n`Services`\n\ntab. Hit the`Refresh`\n\nbutton on the top right corner, and your application should appear in the list of`Applications`\n\n. - Go to the\n`Traces`\n\ntab, and apply relevant filters to see your application's traces. - Check the\n`Logs`\n\ntab to see captured logs from your OpenAI calls. - Visit the\n`Metrics`\n\ntab to view token usage and performance metrics.\n\nCapturing Message Content (Optional)\n\nBy default, message content such as prompts and completions are not captured. To capture message content as log events, set the environment variable:\n\n```\nexport OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true\n```\n\n**Note:** Be cautious when enabling this in production as it may capture sensitive user data. This feature is already included in the run command above.\n\nTroubleshooting your installation\n\n[Troubleshooting your installation](#troubleshooting-your-installation)\n\nSpans are not being reported\n\nIf spans are not being reported to SigNoz, try enabling debug exporter which writes the JSON formatted trace data to the console by setting env var `OTEL_TRACES_EXPORTER=console`\n\n.\n\n```\nOTEL_SERVICE_NAME=my-openai-app \\\nOTEL_TRACES_EXPORTER=console \\\nopentelemetry-instrument python app.py\n```\n\nYou should see trace data in your console output that looks like:\n\n```\n{\n  \"name\": \"chat_completions_create\",\n  \"context\": {\n    \"trace_id\": \"0xedb7caf0c8b082a9578460a201759193\",\n    \"span_id\": \"0x57cf7eee198e1fed\",\n    \"trace_state\": \"[]\"\n  },\n  \"kind\": \"SpanKind.CLIENT\",\n  \"parent_id\": null,\n  \"start_time\": \"2025-01-15T10:30:00.804758Z\",\n  \"end_time\": \"2025-01-15T10:30:01.204805Z\",\n  \"status\": {\n    \"status_code\": \"UNSET\"\n  },\n  \"attributes\": {\n    \"gen_ai.system\": \"openai\",\n    \"gen_ai.request.model\": \"gpt-4o-mini\",\n    \"gen_ai.usage.total_tokens\": 150\n  },\n  \"events\": [],\n  \"links\": [],\n  \"resource\": {\n    \"telemetry.sdk.language\": \"python\",\n    \"telemetry.sdk.name\": \"opentelemetry\",\n    \"telemetry.sdk.version\": \"1.30.0\",\n    \"service.name\": \"my-openai-app\"\n  }\n}\n```\n\nCommon Issues\n\nIf you don't see your telemetry data:\n\n**Check your OpenAI API key**- Make sure`OPENAI_API_KEY`\n\nenvironment variable is set**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\n\nOpenAI Monitoring Dashboard\n\nYou can also check out our custom OpenAI dashboard [here](https://signoz.io/docs/dashboards/dashboard-templates/openai-dashboard/) which provides specialized visualizations for monitoring your OpenAI usage in applications. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.", "url": "https://wpnews.pro/news/openai-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/openai-monitoring", "published_at": "2026-05-24 00:00:00+00:00", "updated_at": "2026-05-26 14:17:52.710380+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "ai-infrastructure", "mlops"], "entities": ["OpenAI", "SigNoz", "OpenTelemetry", "Python"], "alternates": {"html": "https://wpnews.pro/news/openai-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/openai-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/openai-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/openai-monitoring-with-opentelemetry.jsonld"}}