Skip to content

Unifies output handling across all registry subcommands#1200

Merged
jerbly merged 14 commits intoopen-telemetry:mainfrom
jerbly:output-processor
Feb 15, 2026
Merged

Unifies output handling across all registry subcommands#1200
jerbly merged 14 commits intoopen-telemetry:mainfrom
jerbly:output-processor

Conversation

@jerbly
Copy link
Contributor

@jerbly jerbly commented Feb 14, 2026

Unifies output handling across all registry subcommands. Builtin output formats (json, yaml, jsonl) are now available in registry stats, registry diff, and registry resolve. registry stats also supports --templates for custom text output templates.

No breaking changes to the CLI. There is a future opportunity to unify the CLI with common terms following this PR.

  • Replaces scattered format handling across all registry subcommands with OutputProcessor, a unified output abstraction
  • OutputTarget enum models output destinations (Stdout/Stderr/File/Directory/Mute) with ergonomic helpers: from_optional_dir and from_optional_file
  • Makes TemplateEngine and OutputDirective crate-internal — external consumers go through OutputProcessor
  • Converts registry stats text format from hardcoded println! to a Jinja template
    • (Required the addition of numsort template filter for numeric key ordering)
  • Removes redundant diff JSON/YAML templates now handled by builtin serialization

@jerbly jerbly requested a review from a team as a code owner February 14, 2026 14:33
@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 87.17949% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.3%. Comparing base (6d9e359) to head (e99959d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/weaver_forge/src/output_processor.rs 84.5% 13 Missing ⚠️
crates/weaver_forge/src/extensions/util.rs 95.4% 1 Missing ⚠️
crates/weaver_semconv_gen/src/v1.rs 75.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1200   +/-   ##
=====================================
  Coverage   80.2%   80.3%           
=====================================
  Files        109     109           
  Lines       8769    8830   +61     
=====================================
+ Hits        7039    7092   +53     
- Misses      1730    1738    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

Overall looks great! Good cleanup. Two nits.

/// Try to parse a format name (already lowercased) into a builtin format.
fn from_name(name: &str) -> Option<Self> {
match name {
"json" => Some(BuiltinFormat::Json),
Copy link
Contributor

Choose a reason for hiding this comment

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

Something I was thinking for the existing weaver-packages test script -

Should we allow JQ filter expressions when we do built-in? E.g. I have a few JQ filter expressions I'm using to only pull in rego template output and I had to create a new diagnostic template for this, which MAY have the same JSON/YAML bug we saw previously.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course you could pre-process before outputting. But I guess we can include the pre-processing in the OutputProcessor? Let's do this in a subsequent PR.

As I said in the PR description, with this unification in place there's now more opportunity to standardize across subcommands including breaking changes to the CLI which would tidy up the interface. Perhaps we do this with that?

@jerbly jerbly enabled auto-merge (squash) February 15, 2026 19:17
@jerbly jerbly merged commit 8e5bf68 into open-telemetry:main Feb 15, 2026
21 checks passed
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.

2 participants