Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run opentelemetry-instrument with prometheus as metric exporter #2864

Closed
oxeye-schmil opened this issue Aug 7, 2022 · 12 comments · Fixed by #3413 or #3428
Closed

Cannot run opentelemetry-instrument with prometheus as metric exporter #2864

oxeye-schmil opened this issue Aug 7, 2022 · 12 comments · Fixed by #3413 or #3428
Assignees
Labels

Comments

@oxeye-schmil
Copy link

oxeye-schmil commented Aug 7, 2022

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 oxeye-schmil added the bug Something isn't working label Aug 7, 2022
@srikanthccv
Copy link
Member

[options.entry_points]
opentelemetry_metric_reader =
prometheus = opentelemetry.exporter.prometheus:PrometheusMetricReader

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.

@oxeye-schmil
Copy link
Author

[options.entry_points]
opentelemetry_metric_reader =
prometheus = opentelemetry.exporter.prometheus:PrometheusMetricReader

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

@srikanthccv
Copy link
Member

There is none for the auto instrumentation right now.

@srikanthccv
Copy link
Member

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 #2843 (comment)

@hendrikmakait
Copy link

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!

@srikanthccv
Copy link
Member

@hendrikmakait what proposal are you referring to?

@hendrikmakait
Copy link

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

@srikanthccv
Copy link
Member

Contributions are always welcome. I think @aabmass comment #2843 (comment) 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?

@lzchen
Copy link
Contributor

lzchen commented Jan 20, 2023

@srikanthccv

+1 to @aabmass 's approach.

@srikanthccv
Copy link
Member

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

@ocelotl ocelotl changed the title Cannot run opentelemetry-instrument with prometheus as meteric exporter Cannot run opentelemetry-instrument with prometheus as metric exporter Jun 2, 2023
@aabmass
Copy link
Member

aabmass commented Aug 23, 2023

I split the entrypoint work into a separate issue #3411 and I will work on it.

@aabmass
Copy link
Member

aabmass commented Sep 18, 2023

This one will be fixed by #3413

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment