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

Update metric use the new API #3170

Merged
merged 7 commits into from
Jan 27, 2023

Conversation

MadVikingGod
Copy link
Contributor

@MadVikingGod MadVikingGod commented Jan 19, 2023

With the landing of the new metric API uses of the old api need to be adjusted.

This PR can't be considered until there is a release of the metric API, but will be needed when these versions are updated to that release.

If you would like to test it you can use this go.work: https://gist.githubusercontent.com/MadVikingGod/0045dd54a9fba8f8104459f79454e4ad/raw/50da79ebea42f3d176e7ecb00cc3b34aa4741187/go.work

@MrAlias
Copy link
Contributor

MrAlias commented Jan 19, 2023

For reference: #2589

Something like go get pkgname@commit should allow you to pull in the latest in main from otel.

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Merging #3170 (34eaffb) into main (fe23c1f) will increase coverage by 3.2%.
The diff coverage is 11.3%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3170     +/-   ##
=======================================
+ Coverage   69.3%   72.5%   +3.2%     
=======================================
  Files        147     149      +2     
  Lines       6885    6905     +20     
=======================================
+ Hits        4775    5013    +238     
+ Misses      1995    1763    -232     
- Partials     115     129     +14     
Impacted Files Coverage Δ
...entation/google.golang.org/grpc/otelgrpc/config.go 65.1% <0.0%> (ø)
instrumentation/host/host.go 0.0% <0.0%> (ø)
instrumentation/runtime/runtime.go 0.0% <0.0%> (ø)
...ion/github.com/gocql/gocql/otelgocql/instrument.go 62.5% <100.0%> (+62.5%) ⬆️
instrumentation/net/http/otelhttp/handler.go 84.3% <100.0%> (ø)
...ion/google.golang.org/grpc/otelgrpc/interceptor.go 84.5% <0.0%> (-1.0%) ⬇️
.../github.com/gocql/gocql/otelgocql/internal/cass.go 95.1% <0.0%> (ø)
...n/github.com/gocql/gocql/otelgocql/test/version.go 0.0% <0.0%> (ø)
...ntation/github.com/gocql/gocql/otelgocql/config.go 67.3% <0.0%> (+67.3%) ⬆️
... and 3 more

@@ -120,7 +118,7 @@ func Start(opts ...Option) error {

func (r *runtime) register() error {
startTime := time.Now()
uptime, err := r.meter.AsyncInt64().UpDownCounter(
uptime, err := r.meter.Int64ObservableUpDownCounter(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's worth opening a separate PR, but I noticed this should be just an async counter since it's monotonic. Potentially worth changing as part of switching to new API:

Suggested change
uptime, err := r.meter.Int64ObservableUpDownCounter(
uptime, err := r.meter.Int64ObservableCounter(

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest fixing this in a follow-up PR.

@MadVikingGod MadVikingGod merged commit 405e2e4 into open-telemetry:main Jan 27, 2023
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

5 participants