open-telemetry / open-telemetry/opentelemetry-python-contrib
The stack trace is missing when an exception is thrown.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Hi,
I'm using datadog and collect span with some intrumentation (httpx, wsgi), but when an exception is raised, the stacktrace is missing in datadog.
I looked at the instrumentation code and saw that the command span.record_exception(exception) was missing here:
if exception:
if span.is_recording() and _report_new(
self._sem_conv_opt_in_mode
):
span.set_attribute(
ERROR_TYPE, type(exception).__qualname__
)
metric_attributes[ERROR_TYPE] = type(
exception
).__qualname__
raise exception.with_traceback(exception.__traceback__)
What do you think? I'm not a coding expert, but if it seems relevant to you, I'd be happy to submit a pull request.
Thanks a lot,
Axel
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/init.py around the exception-handling code at the linked line. Review how the command span handles the exception and verify the related instrumentation tests, if present. Done means exceptions raised there produce a stack trace in the collected Datadog span.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100