What problem do you want to solve?
If there's an exception in an auto-instrumentation, we currently log the exception and continue. I would like an option to fail faster and immediately re-raise the exception to the caller.
Here's where we currently swallow any instrumentation exceptions:
|
def initialize(): |
|
"""Setup auto-instrumentation, called by the sitecustomize module""" |
|
# prevents auto-instrumentation of subprocesses if code execs another python process |
|
if "PYTHONPATH" in environ: |
|
environ["PYTHONPATH"] = _python_path_without_directory( |
|
environ["PYTHONPATH"], dirname(abspath(__file__)), pathsep |
|
) |
|
|
|
try: |
|
distro = _load_distro() |
|
distro.configure() |
|
_load_configurators() |
|
_load_instrumentors(distro) |
|
except Exception: # pylint: disable=broad-except |
|
_logger.exception("Failed to auto initialize OpenTelemetry") |
With this, there's no way to say, fail startup of my service if there's an instrumentation problem.
Describe the solution you'd like
I'd like to be able to re-raise instrumentation exceptions and fail startup if there's a failure in this case:
from opentelemetry import autoinstrumentation
autoinstrumentation.initialize()
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
Yes
What problem do you want to solve?
If there's an exception in an auto-instrumentation, we currently log the exception and continue. I would like an option to fail faster and immediately re-raise the exception to the caller.
Here's where we currently swallow any instrumentation exceptions:
opentelemetry-python-contrib/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py
Lines 121 to 135 in 7bd0895
With this, there's no way to say, fail startup of my service if there's an instrumentation problem.
Describe the solution you'd like
I'd like to be able to re-raise instrumentation exceptions and fail startup if there's a failure in this case:
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
Yes