-
Notifications
You must be signed in to change notification settings - Fork 803
Closed
Labels
Description
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:
Lines 121 to 135 in 7bd0895
| 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