Skip to content

Commit

Permalink
aiohttp-client: Allow overriding of span status (open-telemetry#1394)
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-borrmann-y42 authored Nov 7, 2022
1 parent 496d658 commit 7acc336
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix bug in Urllib instrumentation - add status code to span attributes only if the status code is not None.
([#1430](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1430))
- `opentelemetry-instrumentation-aiohttp-client` Allow overriding of status in response hook.
([#1394](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1394))
- `opentelemetry-instrumentation-pymysql` Fix dbapi connection instrument wrapper has no _sock member.
([#1424](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1424))
- `opentelemetry-instrumentation-dbapi` Fix the check for the connection already being instrumented in instrument_connection().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ async def on_request_exception(
if trace_config_ctx.span is None:
return

if callable(response_hook):
response_hook(trace_config_ctx.span, params)

if trace_config_ctx.span.is_recording() and params.exception:
trace_config_ctx.span.set_status(Status(StatusCode.ERROR))
trace_config_ctx.span.record_exception(params.exception)

if callable(response_hook):
response_hook(trace_config_ctx.span, params)

_end_trace(trace_config_ctx)

def _trace_config_ctx_factory(**kwargs):
Expand Down

0 comments on commit 7acc336

Please sign in to comment.