Repository navigation
refactor(telemetry): instruments share one builder, and methods name themselves - #601
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PiquelChips
marked this pull request as ready for review
November 20, 2026 08:54
PiquelChips
marked this pull request as draft
November 21, 2026 14:00
PiquelChips
marked this pull request as ready for review
November 21, 2026 14:36
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.
Part of #544
Four bits of
sourceorigin-telemetryrepeated themselves or took a detour:Counter,HistogramandGaugeeach spelled out the same ten lines to unpack their descriptor and build the instrument on thesourceoriginmeter. Abuild!macro now does it once; each instrument names its kind and any extra builder call (with_boundaries,with_callback).METHODSpaired eachMethodwith its name typed out again. It's now astaticofMethods, and the name comes fromMethod::as_str. Being astatickeeps the name'static.Telemetry::initbuilt a placeholderSdkTracerProvider::default()only to overwrite it. It now collects the meter and logger, then buildsSelfonce.exported_textformatted span and event attributes with the same closure twice. They now shareCapture::pairs.What stays the same
build!expands to the same builder chain, in the same order.Method::as_strinhttp1.4.2, the version Cargo.lock pins, returns exactly the nine names that were typed out. Any other method is still_OTHER; that holds for 1.5'sQUERYtoo.Testing
cargo clippy --locked -p sourceorigin-telemetry --all-targets, with and without--all-features,-D warnings: cleanRUSTDOCFLAGS='-D warnings' cargo doc --no-deps --all-features -p sourceorigin-telemetry: cleancargo test --doc --all-features -p sourceorigin-telemetry: 1 passedjust test -p sourceorigin-telemetry --all-features: 3 passed. These check span names, route attributes and that nothing secret is exported.just rust unused: cleanNo tests changed; no files outside the Tooling area.
Note
Written by Claude Opus 5.5 in Claude Code (via T3 Code), reviewed by Claude Opus 5.5