opentelemetry-python
opentelemetry-python copied to clipboard
Cannot run opentelemetry-instrument with prometheus as meteric exporter
Describe your environment Python 3.9.13 opentelemetry-api 1.12.0rc2 opentelemetry-distro 0.32b0 opentelemetry-exporter-prometheus 1.12.0rc1 opentelemetry-instrumentation 0.32b0 opentelemetry-instrumentation-flask 0.32b0 opentelemetry-instrumentation-logging 0.32b0 opentelemetry-sdk 1.12.0rc2
Steps to reproduce opentelemetry-instrument --traces_exporter console --metrics_exporter prometheus python3 ./main.py
What is the expected behavior? What did you expect to see?
What is the actual behavior? What did you see instead?
Configuration of configurator failed
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 105, in _load_configurators
entry_point.load()().configure(auto_instrumentation_version=__version__) # type: ignore
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 273, in configure
self._configure(**kwargs)
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 289, in _configure
_initialize_components(kwargs.get("auto_instrumentation_version"))
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 233, in _initialize_components
trace_exporters, metric_exporters, log_exporters = _import_exporters(
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 201, in _import_exporters
for (exporter_name, exporter_impl,) in _import_config_components(
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 170, in _import_config_components
raise RuntimeError(
RuntimeError: Requested component 'prometheus' not found in entry points for 'opentelemetry_metrics_exporter'
Failed to auto initialize opentelemetry
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 121, in initialize
_load_configurators()
File "/usr/local/lib/python3.9/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 109, in _load_configurators
raise exc
File "/usr/local/lib/python3.9/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 105, in _load_configurators
entry_point.load()().configure(auto_instrumentation_version=__version__) # type: ignore
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 273, in configure
self._configure(**kwargs)
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 289, in _configure
_initialize_components(kwargs.get("auto_instrumentation_version"))
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 233, in _initialize_components
trace_exporters, metric_exporters, log_exporters = _import_exporters(
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 201, in _import_exporters
for (exporter_name, exporter_impl,) in _import_config_components(
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opentelemetry/sdk/_configuration/__init__.py", line 170, in _import_config_components
raise RuntimeError(
RuntimeError: Requested component 'prometheus' not found in entry points for 'opentelemetry_metrics_exporter'
- Serving Flask app 'automatic' (lazy loading)
- Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
- Debug mode: off
- Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Additional context Add any other context about the problem here.
https://github.com/open-telemetry/opentelemetry-python/blob/0b4f247e9d401e94ec77f72ddfcf917298ea27e8/exporter/opentelemetry-exporter-prometheus/setup.cfg#L53-L55
I think it was discussed to name it opentelemetry_metric_reader
for Prometheus since it is an implementation of MetricReader
. We will probably have to update the configuration to code handle this case separately.
https://github.com/open-telemetry/opentelemetry-python/blob/0b4f247e9d401e94ec77f72ddfcf917298ea27e8/exporter/opentelemetry-exporter-prometheus/setup.cfg#L53-L55
I think it was discussed to name it
opentelemetry_metric_reader
for Prometheus since it is an implementation ofMetricReader
. We will probably have to update the configuration to code handle this case separately.
What's flag to use for running it correctly
There is none for the auto instrumentation right now.
Discussion during 11th Aug call.
We are probably going to change the way we load the (metric) exporters for auto instrumentation which works regardless of the implementation type (push exporter/ pull metric reader) of exporter. The original proposal https://github.com/open-telemetry/opentelemetry-python/pull/2843#issuecomment-1198417591
I ran across the same issue when evaluating the possibility of instrumenting Dask with OTel. Is there any update on the proposal from #2843? I'd be happy to help with the implementation!
@hendrikmakait what proposal are you referring to?
@srikanthccv: I'm referring to your comment above:
We are probably going to change the way we load the (metric) exporters for auto instrumentation which works regardless of the implementation type (push exporter/ pull metric reader) of exporter. The original proposal #2843 (comment)
Contributions are always welcome. I think @aabmass comment https://github.com/open-telemetry/opentelemetry-python/pull/2843#issuecomment-1198417591 is good way to approach this problem and it will support both push and pull exporter types. I would like to get the consensus on this from @open-telemetry/python-approvers before any work is actually started or if someone has any alternative methods?
@srikanthccv
+1 to @aabmass 's approach.
@hendrikmakait Please let us know if you would like to work on the implementation, and I will assign this to you. Feel free to ask any questions.
I split the entrypoint work into a separate issue https://github.com/open-telemetry/opentelemetry-python/issues/3411 and I will work on it.
This one will be fixed by https://github.com/open-telemetry/opentelemetry-python/pull/3413