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

Rename metric instruments to match feature-freeze API specification #2202

Merged
merged 18 commits into from Sep 1, 2021

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Aug 26, 2021

This renames ValueRecorder to Histogram, ValueObserver to GaugeObserver, SumObserver to CounterObserver, and UpDownSumObserver to UpDownCounterObserver.

The API was marked "feature-freeze" here: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md

This updates getting-started.md with an up-to-date example of getting started with the metrics API.

This is otherwise not a functional change.

Note: The OTel-Go metrics API is still considered experimental and subject to change in the future. We discussed making this change ASAP to avoid confusing new users who review the API specification and will not understand these legacy names.

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #2202 (cea4420) into main (1f527a5) will not change coverage.
The diff coverage is 58.5%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2202   +/-   ##
=====================================
  Coverage   72.9%   72.9%           
=====================================
  Files        176     176           
  Lines      12162   12162           
=====================================
  Hits        8868    8868           
  Misses      3055    3055           
  Partials     239     239           
Impacted Files Coverage Δ
...tlp/otlpmetric/internal/otlpmetrictest/otlptest.go 0.0% <0.0%> (ø)
metric/metric_sdkapi.go 100.0% <ø> (ø)
metric/sdkapi/instrumentkind_string.go 40.0% <ø> (ø)
metric/metric.go 56.4% <50.0%> (ø)
metric/metric_instrument.go 86.4% <86.6%> (ø)
bridge/opencensus/exporter.go 100.0% <100.0%> (ø)
metric/sdkapi/instrumentkind.go 100.0% <100.0%> (ø)
sdk/export/metric/metric.go 44.6% <100.0%> (ø)
sdk/metric/aggregator/aggregator.go 100.0% <100.0%> (ø)
sdk/metric/selector/simple/simple.go 100.0% <100.0%> (ø)

Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Looks good overall with two minor nitpicks about the CHANGELOG. Nothing blocking.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@evantorrie evantorrie left a comment

Choose a reason for hiding this comment

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

Looks good vis. a vis. syntactical changes.

My comments are nearly all regarding the "human-readable" and variable names in tests. For consistency, I would prefer to see all the names of test instruments changed in the same way we've changed the code names, e.g. we shouldn't see

valuerecorder := ...

or

NewInt64Histogram("valuerecorder.int", ...)

in the test code. but rather

histogram := ...

and

NewInt64Histogram("histogram.int", ...)

The same comment applies to the other name changes.

CHANGELOG.md Outdated Show resolved Hide resolved
exporters/otlp/otlpmetric/exporter_test.go Outdated Show resolved Hide resolved
exporters/otlp/otlpmetric/exporter_test.go Outdated Show resolved Hide resolved
exporters/otlp/otlpmetric/exporter_test.go Outdated Show resolved Hide resolved
sdk/metric/correct_test.go Outdated Show resolved Hide resolved
sdk/metric/correct_test.go Outdated Show resolved Hide resolved
sdk/metric/correct_test.go Outdated Show resolved Hide resolved
sdk/metric/correct_test.go Outdated Show resolved Hide resolved
sdk/metric/selector/simple/simple_test.go Outdated Show resolved Hide resolved
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Renames look good, just one question regarding additive vs adding, but otherwise I agree this change will greatly reduce confusion.

example/prometheus/main.go Outdated Show resolved Hide resolved
metric/doc.go Show resolved Hide resolved
@jmacd jmacd changed the title Rename metric instruments to match stable API specification Rename metric instruments to match feature-freeze API specification Aug 31, 2021
@jmacd
Copy link
Contributor Author

jmacd commented Aug 31, 2021

I removed the change in getting-started.md because @MrAlias's #2203 removes the example that would be changed.

@jmacd
Copy link
Contributor Author

jmacd commented Aug 31, 2021

Thank you ❤️ @evantorrie for the fixes. I went through and found a few more and have generally tidied up the PR.

Copy link
Contributor

@evantorrie evantorrie left a comment

Choose a reason for hiding this comment

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

LGTM

@Aneurysm9 Aneurysm9 merged commit a7b9d02 into open-telemetry:main Sep 1, 2021
@jmacd jmacd deleted the jmacd/rename_inst branch October 1, 2021 07:02
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.

None yet

5 participants