Skip to content

refactor(telemetry): instruments share one builder, and methods name themselves - #601

Merged
PiquelChips merged 1 commit into
mainfrom
refactor/544-tooling-telemetry
Nov 21, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
refactor/544-tooling-telemetry

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #544

Four bits of sourceorigin-telemetry repeated themselves or took a detour:

  • metrics.rs: Counter, Histogram and Gauge each spelled out the same ten lines to unpack their descriptor and build the instrument on the sourceorigin meter. A build! macro now does it once; each instrument names its kind and any extra builder call (with_boundaries, with_callback).
  • http/mod.rs: METHODS paired each Method with its name typed out again. It's now a static of Methods, and the name comes from Method::as_str. Being a static keeps the name 'static.
  • lib.rs: Telemetry::init built a placeholder SdkTracerProvider::default() only to overwrite it. It now collects the meter and logger, then builds Self once.
  • capture.rs: exported_text formatted span and event attributes with the same closure twice. They now share Capture::pairs.

What stays the same

  • Instrument names, units, descriptions and bucket boundaries: build! expands to the same builder chain, in the same order.
  • Method labels: Method::as_str in http 1.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's QUERY too.
  • Spans, log fields and the export setup. Providers are built in the same order, and the meter provider is still installed before the subscriber.

Testing

  • cargo clippy --locked -p sourceorigin-telemetry --all-targets, with and without --all-features, -D warnings: clean
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --all-features -p sourceorigin-telemetry: clean
  • cargo test --doc --all-features -p sourceorigin-telemetry: 1 passed
  • just test -p sourceorigin-telemetry --all-features: 3 passed. These check span names, route attributes and that nothing secret is exported.
  • just rust unused: clean

No 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

@PiquelChips
PiquelChips marked this pull request as draft November 20, 2026 08:38
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 46dd06c0-bd3f-4265-ba2e-4770f333ca44
Commits

Reviewing files that changed from the base of the PR and between 467e813 and b7327a8.

Files selected for processing: 4

  • crates/telemetry/src/capture.rs
  • crates/telemetry/src/http/mod.rs
  • crates/telemetry/src/lib.rs
  • crates/telemetry/src/metrics.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@PiquelChips PiquelChips added the refactor No behviour changes label Nov 20, 2026
@PiquelChips
PiquelChips marked this pull request as ready for review November 20, 2026 08:54
@PiquelChips
PiquelChips marked this pull request as draft November 21, 2026 14:00
@PiquelChips
PiquelChips marked this pull request as ready for review November 21, 2026 14:36
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit df2053a Nov 21, 2026
13 checks passed
@PiquelChips
PiquelChips deleted the refactor/544-tooling-telemetry branch November 21, 2026 16:53
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in sourceorigin.dev Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor No behviour changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant