Troubleshooting the instrumentation
When using OpenTelemetry instrumentation, you may encounter two main types of issues: problems with instrumentation injection into workloads, and problems with instrumentation libraries generating telemetry data. This document provides troubleshooting methods for both types of issues.
TOC
OverviewTroubleshooting instrumentation injection into your workloadChecking the Instrumentation objectChecking the init-containerChecking resource deployment orderSearching for errors in Operator logsVerifying pod annotationsChecking injected environment variablesVerifying instrumentation librariesTroubleshooting telemetry data generation by the instrumentation librariesVerifying the endpoint configurationChecking application logs for errorsVerifying Collector is receiving dataOverview
Instrumentation troubleshooting primarily focuses on the following aspects:
- Injection issues: Whether instrumentation is successfully injected into application pods
- Data generation issues: Whether instrumentation libraries correctly generate and send telemetry data
Troubleshooting instrumentation injection into your workload
When instrumentation fails to inject correctly into workloads, you can perform the following checks to diagnose the problem.
Checking the Instrumentation object
First verify that the Instrumentation object was successfully created:
If you do not see the expected Instrumentation object, check:
- Whether the Instrumentation resource was correctly created
- Whether the namespace is correct
- Whether there are error messages in the Operator logs
Checking the init-container
Verify that the opentelemetry-auto-instrumentation init-container started successfully:
View detailed pod information:
In the output, look for the init-container section and confirm:
- Whether the init-container exists
- Whether the init-container completed successfully
- Whether there are any errors or warnings
Checking resource deployment order
Ensure resources are deployed in the correct order:
- First deploy the Instrumentation object
- Then deploy or restart application pods
If application pods were created before the Instrumentation object, instrumentation will not be injected. You need to restart the pods:
Searching for errors in Operator logs
Check the Operator logs for instrumentation-related errors:
Common errors include:
- Configuration validation failures
- Insufficient permissions
- Resource conflicts
Verifying pod annotations
Confirm that application pods have the correct instrumentation annotations:
You should see annotations similar to the following:
If annotations are missing or incorrect:
- Check the annotations configuration in the Deployment or Pod template
- Confirm the annotation namespace and language type are correct
- Verify the Instrumentation object configuration
Checking injected environment variables
Verify that instrumentation correctly injected environment variables:
You should see OpenTelemetry-related environment variables, such as:
Verifying instrumentation libraries
Check whether instrumentation libraries were correctly installed in the container:
This directory should contain instrumentation libraries and related files.
Troubleshooting telemetry data generation by the instrumentation libraries
If instrumentation was successfully injected but is not generating telemetry data, you can troubleshoot using the following methods.
Verifying the endpoint configuration
Confirm that instrumentation is sending data to the correct endpoint:
Example output
If the command output is empty, the exporter endpoint might be configured through OpenTelemetry environment variables (such as OTEL_EXPORTER_OTLP_ENDPOINT) instead. Check the environment variables defined in the Instrumentation resource:
The default endpoint is http://localhost:4317. If you are using a custom Collector endpoint, ensure:
- The endpoint address is correct
- The Collector Service is accessible
- Port configuration is correct (gRPC uses 4317, HTTP uses 4318)
Checking application logs for errors
Check application logs for instrumentation-related error messages:
Look for OpenTelemetry-related errors, such as:
- Connection failures
- Authentication errors
- Configuration errors
- Library loading failures
Verifying Collector is receiving data
Confirm whether the Collector is receiving telemetry data:
Check Collector logs
If the Debug Exporter is enabled, you should be able to see received data.
Check Collector metrics
Then access http://localhost:8888/metrics and look for:
otelcol_receiver_accepted_spans: Should be greater than 0otelcol_receiver_refused_spans: Should be 0 or very small