Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import and use metrics in python in the new versions of opentelemetry packages

I'm just starting in telemetry and I got stuck trying to use metrics in the new versions of opentelemetry-api and opentelemetry-sdk.

What I have found

1 - Documentation

This is a old getting started (do not try those scripts, not up to date)

https://open-telemetry.github.io/opentelemetry-python/getting-started.html

And this is the latest getting started

https://opentelemetry-python.readthedocs.io/en/latest/sdk/sdk.html

As you see, in the latest there is no information about metrics just tracing.

2 - The packages

As you see in this image in the version 1.10a0 of the opentelemetry there is the metrics module, while in the current version 1.4 there is no module metrics (see image).

The problem

To use metrics one must run pip install opentelemetry-instumentation-system-metrics by doing this the pip uninstall opentelemetry api and sdk and reinstall old version. (see image). When it happens I am able to import the metrics module, but the tracing does not work anymore.

Question Where is the metrics module in the new version of opentelemetry? How can I instrument metrics in the latest version of opentelemetry?

like image 374
Lucas Avatar asked Jul 22 '21 23:07

Lucas


1 Answers

You can't as of now. There is ongoing prototype https://github.com/open-telemetry/opentelemetry-python/pull/1887 for metrics API&SDK based on specification which itself is not stable yet. There is no guaranteed timeline when metrics will be release for end user instrumentation. You may safely assume that it will take few more months to get stable release but there should be alpha-beta release much earlier.

like image 177
Srikanth Chekuri Avatar answered Oct 19 '22 17:10

Srikanth Chekuri