Improve error logging for OTLP gRPC exporter

Open Beginner friendly
#4,393 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
grpc, python
Domain
observability

Research direction

Start by reading exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py around lines 341-347, where failed metric exports are logged. Compare the trace and log gRPC exporters as suggested, then verify that failed exports log the error details rather than only the status code.

Written by the indexing model from the issue text.

Description

feature-request
Is your feature request related to a problem?

I used the gRPC exporter, and it failed to export to my backend (this was my fault). I got the following error, even when debug logging was enabled:

ERROR:opentelemetry.exporter.otlp.proto.grpc.exporter:Failed to export metrics to <endpoint>, error code: StatusCode.INVALID_ARGUMENT

It looks like the error message is not being logged here:

https://github.com/open-telemetry/opentelemetry-python/blob/58f2d161d4b772ce6e62d9f40ba9de16445f4193/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py#L341-L347

Describe the solution you'd like

I would like to log the error's details.

Describe alternatives you've considered

No response

Additional Context

This may also apply to the trace or log grpc exporter. I haven't checked

Would you like to implement a fix?

No

Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
5d 29m
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-python

All issues in open-telemetry/opentelemetry-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.