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

Return noop instrument if name is invalid #4383

Merged
merged 5 commits into from
Apr 20, 2022

Conversation

jack-berg
Copy link
Member

Resolves #4378.

I think returning a noop instrument is the least wrong solution:

  • Throwing an exception is not in line with API patterns
  • If we log a warning but allowed the invalid name to be used, we'd put the burden on exporters to figure out how to handle metrics that break the rules.
  • If we log a warning an transform the name to be valid, we'd be making up unspecified rules, and could cause unexpected conflicts with other metrics.

@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #4383 (5bfd124) into main (c2d8f6a) will increase coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 5bfd124 differs from pull request most recent head 31d80b0. Consider uploading reports for the commit 31d80b0 to get more accurate results

@@             Coverage Diff              @@
##               main    #4383      +/-   ##
============================================
+ Coverage     89.94%   90.00%   +0.05%     
- Complexity     4908     4920      +12     
============================================
  Files           567      567              
  Lines         15199    15219      +20     
  Branches       1465     1465              
============================================
+ Hits          13671    13698      +27     
+ Misses         1058     1051       -7     
  Partials        470      470              
Impacted Files Coverage Δ
.../io/opentelemetry/api/internal/ValidationUtil.java 100.00% <100.00%> (ø)
...ava/io/opentelemetry/api/metrics/DefaultMeter.java 100.00% <100.00%> (ø)
...in/java/io/opentelemetry/sdk/metrics/SdkMeter.java 100.00% <100.00%> (ø)
...emetry/api/baggage/propagation/PercentEscaper.java 84.21% <0.00%> (+4.51%) ⬆️
...ava/io/opentelemetry/sdk/internal/RateLimiter.java 100.00% <0.00%> (+5.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2d8f6a...31d80b0. Read the comment docs.

@jack-berg jack-berg closed this Apr 19, 2022
@jack-berg jack-berg reopened this Apr 19, 2022
@jack-berg jack-berg merged commit 98369a5 into open-telemetry:main Apr 20, 2022
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.

Enforce metric instrument naming rule
4 participants