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.
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:
opentelemetry-python/ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py
Line 90 in 7cb57c7
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.