opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

Cannot run opentelemetry-instrument with prometheus as meteric exporter

Open oxeye-schmil opened this issue 2 years ago • 4 comments

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.

oxeye-schmil avatar Aug 07 '22 11:08 oxeye-schmil

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.

srikanthccv avatar Aug 07 '22 12:08 srikanthccv

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.

What's flag to use for running it correctly

oxeye-schmil avatar Aug 08 '22 14:08 oxeye-schmil

There is none for the auto instrumentation right now.

srikanthccv avatar Aug 08 '22 15:08 srikanthccv

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

srikanthccv avatar Aug 11 '22 17:08 srikanthccv

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 avatar Jan 16 '23 07:01 hendrikmakait

@hendrikmakait what proposal are you referring to?

srikanthccv avatar Jan 18 '23 14:01 srikanthccv

@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)

hendrikmakait avatar Jan 18 '23 14:01 hendrikmakait

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 avatar Jan 18 '23 16:01 srikanthccv

@srikanthccv

+1 to @aabmass 's approach.

lzchen avatar Jan 20 '23 18:01 lzchen

@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.

srikanthccv avatar Jan 20 '23 18:01 srikanthccv

I split the entrypoint work into a separate issue https://github.com/open-telemetry/opentelemetry-python/issues/3411 and I will work on it.

aabmass avatar Aug 23 '23 20:08 aabmass

This one will be fixed by https://github.com/open-telemetry/opentelemetry-python/pull/3413

aabmass avatar Sep 18 '23 14:09 aabmass