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

Example shown in the document https://opentelemetry-python.readthedocs.io/en/stable/getting-started.html#adding-metrics doesn't work. #1390

Closed
vaibhavnsingh opened this issue Nov 18, 2020 · 0 comments · Fixed by #1433
Labels
1.10.0rc1 release candidate 1 for metrics GA bug Something isn't working metrics release:required-for-ga To be resolved before GA release

Comments

@vaibhavnsingh
Copy link

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on master.

I am using Python 3.8.1. Below are the details of the packages

opentelemetry-api 0.15b0
opentelemetry-exporter-jaeger 0.15b0
opentelemetry-instrumentation 0.15b0
opentelemetry-instrumentation-flask 0.15b0
opentelemetry-instrumentation-requests 0.15b0
opentelemetry-instrumentation-wsgi 0.15b0
opentelemetry-sdk 0.15b0

Steps to reproduce
I have just copied the code for the below URL
https://opentelemetry-python.readthedocs.io/en/stable/getting-started.html#adding-metrics

while executing it is giving me below error

File "metrics.py", line 19, in
requests_counter = meter.create_metric(
AttributeError: 'Meter' object has no attribute 'create_metric'

Below are few pointers to the issue
Output of print(type(meter)) : <class 'opentelemetry.sdk.metrics.Meter'>

Output of print(dir(meter)) : ['abstractmethods', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'slots', 'str', 'subclasshook', 'weakref', '_abc_impl', '_collect_metrics', '_collect_observers', 'collect', 'create_counter', 'create_updowncounter', 'create_valuerecorder', 'record_batch', 'register_sumobserver', 'register_updownsumobserver', 'register_valueobserver', 'register_view', 'unregister_observer', 'unregister_view']

Basically meter doesn't have a function "create_metric".
image

I checked the functions available for the object by using dir()

@vaibhavnsingh vaibhavnsingh added the bug Something isn't working label Nov 18, 2020
@lzchen lzchen added the metrics label Nov 19, 2020
@codeboten codeboten added release:required-for-ga To be resolved before GA release 1.10.0rc1 release candidate 1 for metrics GA labels Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.10.0rc1 release candidate 1 for metrics GA bug Something isn't working metrics release:required-for-ga To be resolved before GA release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants