docs(api): concurrency, instrument name syntax, and histogram value range - #141
Open
michaelbushe wants to merge 1 commit into
Open
michaelbushe wants to merge 1 commit into
michaelbushe wants to merge 1 commit into
Conversation
…ange Three documentation requirements in metrics/api.md that the metrics API did not state. Concurrency (MUST, api.md Concurrency requirements): MeterProvider, Meter and Instrument must each document that implementations need to be safe for concurrent use by default. Added to APIMeterProvider, APIMeter and all seven instruments, using the wording already established for the trace and logs APIs. Instrument name syntax (SHOULD, api.md Synchronous Instrument API): the name parameter doc on all seven create* methods now states the rules, not empty, first character an ASCII letter, then letters, digits, _, ., - or /, at most 255 characters, compared case-insensitively, and says the API does not validate it. Histogram value range (SHOULD, api.md Record): record and recordWithMap now state the value is expected to be non-negative. No check was added; the same section says this API SHOULD NOT validate it. Fixes #72 Fixes #73 Fixes #74 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
michaelbushe
force-pushed
the
fix/metrics-api-docs
branch
from
September 13, 2026 21:32
da4009f to
3e3cc81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the three remaining P2 documentation items on #101. All three are in the metrics API, all are comments only, no behavior change.
Concurrency, MUST
metrics/api.md, Concurrency requirements requires MeterProvider, Meter and Instrument to each document that implementations need to be safe for concurrent use by default. Added to
APIMeterProvider,APIMeterand all seven instruments, using the wording #120 and #121 established for trace and logs so the three signals read the same.Instrument name syntax, SHOULD
Synchronous Instrument API: the API SHOULD be documented so users know
namemust conform to the syntax. The[name]doc on all sevencreate*methods now gives the rules and says this API does not validate them.That last clause matters now: #139 removed the empty-name throws from the no-op meter, because noop.md says the Meter MUST NOT validate any argument. The documentation is what tells users the rule, and SDK-side validation is dartastic_opentelemetry#170.
Histogram value range, SHOULD
Record: "The value is expected to be non-negative. This API SHOULD be documented in a way to communicate to users that this value is expected to be non-negative. This API SHOULD NOT validate this value."
recordandrecordWithMapnow say so. No check was added, per the second half of that requirement.APICounter.addalready carried the same note, so this makes the histogram consistent with it.Verification
dart analyzeclean,dart test1231 passing.create*methods carry the syntax note, both histogram record methods carry the range note.histogram.dart.🤖 Generated with Claude Code
Fixes #72
Fixes #73
Fixes #74