Skip to content

Add basic example showing how to use various metric instruments #1062

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

Merged
merged 4 commits into from
May 15, 2023

Conversation

cijothomas
Copy link
Member

Towards #1060

Changes

Adds a example which showcases the usage of various instruments. The stdout exporter is used to display metrics.
There'll be a separate PR which shows common customizations, like changing temporality, using views, changing interval etc.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@cijothomas cijothomas requested a review from a team May 11, 2023 19:24
@codecov
Copy link

codecov bot commented May 11, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.1 ⚠️

Comparison is base (ecf0dda) 54.9% compared to head (4269069) 54.9%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1062     +/-   ##
=======================================
- Coverage   54.9%   54.9%   -0.1%     
=======================================
  Files        151     151             
  Lines      18242   18245      +3     
=======================================
  Hits       10025   10025             
- Misses      8217    8220      +3     
Impacted Files Coverage Δ
...try-api/src/metrics/instruments/up_down_counter.rs 26.6% <0.0%> (-1.2%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@TommyCpp TommyCpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reaonable to me. I understand we have too many examples at this point but with the new metrics example I think this one will be really benificial for users. We can probably clean up some other examples to reduce maintaince burdan

@cijothomas
Copy link
Member Author

Looks reaonable to me. I understand we have too many examples at this point but with the new metrics example I think this one will be really benificial for users. We can probably clean up some other examples to reduce maintaince burdan

Agree. I'll be able to help with some cleanups/consolidation of the examples.

@cijothomas
Copy link
Member Author

@TommyCpp Could you merge please?

@TommyCpp TommyCpp merged commit bdb777b into open-telemetry:main May 15, 2023
@cijothomas cijothomas deleted the cijothomas/metric-example1 branch May 15, 2023 17:00
@gautamg795
Copy link

Does your example of recording data to a histogram here use the ExponentialBucketHistogram type under the hood, or is it using an explicitly bucketed histogram with some default value for the buckets?

@cijothomas
Copy link
Member Author

Does your example of recording data to a histogram here use the ExponentialBucketHistogram type under the hood, or is it using an explicitly bucketed histogram with some default value for the buckets?

It follows the spec, which states that the default is ExplicitBucket aggregation, using the default buckets.
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-sdk/src/metrics/reader.rs#L154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants