Skip to content

Create utils package for instrumentors #610

@mauriciovasquezbernal

Description

@mauriciovasquezbernal

There are some operations that are common for different instrumentors. For instance, all the http integrations need to set the span status based on the http code, they need to extract headers and so on. Currently the code is being duplicated in the different integrations, for example:

def http_status_to_canonical_code(code: int, allow_redirect: bool = True):

https://github.com/open-telemetry/opentelemetry-python/pull/597/files#diff-4a13efb3e6ce8aec7f16f718cffaa7a3R142

It could be a good idea to create a package that includes these helpers.
One idea could be to create a generic utils package for all integrations, another idea could be to do that some more specific and create utils for http and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIssue or PR that needs/is extended discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions