Skip to content

aiohttp client instrumentation: "leaking" attributes in metrics #3756

@sboisson

Description

@sboisson

Describe your environment

OS: Any
Python version: > Python 3.9
Package version: (e.g., 0.46.0)

What happened?

Report metrics with attributes from previous requests (like HTTP status or error type)

Steps to Reproduce

Use the same ClientSession for several requests.
After a 1st successful request (HTTP status 200), have a 2nd request raising an exception (ex: timeout)

Expected Result

Second request should not record a metric with HTTP status 200

Actual Result

The second request will record a metric with HTTP status 200 and a error.type set to TimeoutException

Additional context

This probably caused by metrics_attributes variable only created at creation of ClientSession an used in tracing all the requests made by this session
in opentelemetry.instrumentation.aiohttp_client.package:create_trace_config()

Would you like to implement a fix?

Yes

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions