{"id":364,"library":"opentelemetry-exporter-otlp-proto-http","title":"OpenTelemetry Collector Protobuf over HTTP Exporter","description":"The OpenTelemetry Exporter for sending telemetry data via HTTP using the OpenTelemetry Protocol. Current version is 1.40.0, released regularly as part of the OpenTelemetry project.","status":"active","version":"1.40.0","language":"python","source_language":"en","source_url":"https://github.com/open-telemetry/opentelemetry-python","tags":["opentelemetry","exporter","http"],"install":[{"cmd":"pip install opentelemetry-exporter-otlp-proto-http","lang":"bash","label":"Install OpenTelemetry Exporter"}],"dependencies":[{"reason":"Required for core OpenTelemetry features.","package":"opentelemetry-api","optional":false},{"reason":"Used for making HTTP requests.","package":"requests","optional":false}],"imports":[{"note":"Ensure the correct module path is used.","symbol":"OTLPExportSpanProcessor","correct":"from opentelemetry.exporter.otlp.proto.http import OTLPExportSpanProcessor"}],"quickstart":{"code":"import os\nfrom opentelemetry import metrics\nfrom opentelemetry.exporter.otlp.proto.http import OTLPMetricExporter\nfrom opentelemetry.sdk.metrics import MeterProvider\n\n# Set up OpenTelemetry\nmeter_provider = MeterProvider()\nmetrics.set_meter_provider(meter_provider)\n\n# Create an exporter\nexporter = OTLPMetricExporter(endpoint=os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4317'))\n\n# Use the exporter\nmeter = metrics.get_meter(__name__)\nmetric = meter.create_counter('example_counter')\nmetric.add(1)","lang":"python","description":"A simple OpenTelemetry setup with an OTLP exporter to send metrics."},"warnings":[{"fix":"Update to the new behavior for correct span context propagation.","message":"Changes to `start_span` and `start_as_current_span` behavior in NoOpTracer.","severity":"breaking","affected_versions":"1.40.0"},{"fix":"Use `opentelemetry-instrumentation-logging` instead.","message":"The `LoggingHandler` in `opentelemetry-sdk` is now deprecated.","severity":"deprecated","affected_versions":">=1.40.0"},{"fix":"Update the import statement to `from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter`.","message":"The import path for `OTLPMetricExporter` has changed. It is no longer directly available from `opentelemetry.exporter.otlp.proto.http`.","severity":"breaking","affected_versions":"opentelemetry-exporter-otlp>=1.11.0"},{"fix":"Import `OTLPMetricExporter` from `opentelemetry.exporter.otlp.proto.http.metric_exporter` instead.","message":"The `OTLPMetricExporter` has been moved from `opentelemetry.exporter.otlp.proto.http`.","severity":"breaking","affected_versions":">=1.40.0"}],"env_vars":null,"last_verified":"2026-05-12T13:18:34.877Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the necessary package using pip: `pip install opentelemetry-exporter-otlp-proto-http`. Ensure you are installing it in the same Python environment where your application is running.","cause":"This error occurs when the 'opentelemetry-exporter-otlp-proto-http' package is not installed in the Python environment, or there is a Python environment mismatch.","error":"ModuleNotFoundError: No module named 'opentelemetry.exporter.otlp.proto.http'"},{"fix":"Verify that your OpenTelemetry Collector or backend is running and configured to accept OTLP/HTTP connections on the specified endpoint and port (typically port 4318). Ensure the Collector is listening on '0.0.0.0' for external connections. For the Python exporter, ensure the endpoint matches, e.g., `OTLPSpanExporter(endpoint='http://localhost:4318/v1/traces')`.","cause":"This often indicates a 'Connection refused' error where the OpenTelemetry Collector or backend is not running, is inaccessible, or the exporter is trying to connect to a port/protocol that the receiver is not configured for (e.g., sending HTTP to a gRPC port). A common cause is the Collector binding to 'localhost' (127.0.0.1) instead of '0.0.0.0'.","error":"Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost:4318"},{"fix":"Downgrade your 'protobuf' package to a compatible version, such as `protobuf==3.20.3`, or ensure all OpenTelemetry-related packages are installed with compatible versions. `pip install protobuf==3.20.3`.","cause":"This error typically arises from a version incompatibility between the 'protobuf' library and the 'opentelemetry-proto' or other OpenTelemetry packages. It often happens when 'protobuf' v4.x is installed while a dependency expects v3.x, or vice versa.","error":"TypeError: Descriptors cannot not be created directly."},{"fix":"Configure the OTLP exporter with the correct authentication headers as required by your OpenTelemetry Collector or observability backend. For example, when creating the exporter: `OTLPSpanExporter(endpoint=\"https://your-otlp-endpoint\", headers={\"x-api-key\": \"YOUR_API_KEY\"})`.","cause":"This error indicates an authentication failure where the OTLP/HTTP exporter is attempting to send data to a backend that requires authentication, but the provided API key, token, or authentication headers are missing, invalid, or incorrectly configured.","error":"Failed to export spans. Server responded with HTTP status code 401"}],"ecosystem":"pypi","meta_description":null,"install_score":0,"install_tag":"stale","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}