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

Add support for zero or more callbacks #2601

Closed
ocelotl opened this issue Apr 13, 2022 · 2 comments · Fixed by #2602
Closed

Add support for zero or more callbacks #2601

ocelotl opened this issue Apr 13, 2022 · 2 comments · Fixed by #2602
Assignees
Labels
1.10.0rc1 release candidate 1 for metrics GA metrics

Comments

@ocelotl
Copy link
Contributor

ocelotl commented Apr 13, 2022

As stated by the spec:

Zero or more callback functions.

@ocelotl ocelotl added metrics 1.10.0rc1 release candidate 1 for metrics GA labels Apr 13, 2022
@ocelotl ocelotl self-assigned this Apr 13, 2022
ocelotl added a commit to ocelotl/opentelemetry-python that referenced this issue Apr 13, 2022
ocelotl added a commit that referenced this issue Apr 14, 2022
* Add support for zero or more callbacks

Fixes #2601

* Add changelog entry

* Update opentelemetry-api/src/opentelemetry/_metrics/__init__.py

Co-authored-by: Leighton Chen <lechen@microsoft.com>

* Update opentelemetry-api/src/opentelemetry/_metrics/__init__.py

Co-authored-by: Leighton Chen <lechen@microsoft.com>

Co-authored-by: Leighton Chen <lechen@microsoft.com>
@srikanthccv
Copy link
Member

@ocelotl
Thinking about this again, Should this be "one or more callbacks" instead of "zero or more callbacks"? What does it mean to create an instrument with zero callbacks?

@ocelotl
Copy link
Contributor Author

ocelotl commented Apr 19, 2022

@ocelotl Thinking about this again, Should this be "one or more callbacks" instead of "zero or more callbacks"? What does it mean to create an instrument with zero callbacks?

It means we can instrument that does nothing 😅

It is ok to have an instrument with zero callbacks (the spec specifically states this), such instrument is harmless, but the real reason is that in the future we plan to add another way to register callbacks (#2454). With this feature a zero-callback instrument could receive a callback later.

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 metrics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants