Skip to content

Rework Resolution Engine to allow using resolved schema#1136

Merged
jsuereth merged 44 commits intoopen-telemetry:mainfrom
jsuereth:wip-resolve-from-resolved-schema
Jan 21, 2026
Merged

Rework Resolution Engine to allow using resolved schema#1136
jsuereth merged 44 commits intoopen-telemetry:mainfrom
jsuereth:wip-resolve-from-resolved-schema

Conversation

@jsuereth
Copy link
Contributor

@jsuereth jsuereth commented Jan 13, 2026

Reworks the resolution engine to allow using resolved schema as a dependency.

  • Breaks phases formally into Loaded and Resolved
  • Loaded can now work with a loaded ResolvedTelemetrySchema (v1 or v2) or a definition schema (raw / unresolved).
  • Resolve now takes loaded, and will recurse down dependencies as needed.

TODOS

  • Remove legacy resolve code from code base
  • Handle uniqueness of group / signal ids across dependencies
  • More tests

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 77.27273% with 110 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.1%. Comparing base (bf4c7a9) to head (aace775).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/weaver_semconv/src/lib.rs 28.0% 41 Missing ⚠️
crates/weaver_resolver/src/loader.rs 79.5% 30 Missing ⚠️
crates/weaver_resolver/src/error.rs 38.0% 13 Missing ⚠️
crates/weaver_resolver/src/dependency.rs 87.0% 12 Missing ⚠️
crates/weaver_resolver/src/lib.rs 83.7% 7 Missing ⚠️
crates/weaver_resolver/src/attribute.rs 92.5% 3 Missing ⚠️
crates/weaver_resolved_schema/src/lib.rs 50.0% 2 Missing ⚠️
crates/weaver_common/src/result.rs 85.7% 1 Missing ⚠️
crates/weaver_resolver/src/registry.rs 98.1% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1136     +/-   ##
=======================================
- Coverage   80.2%   80.1%   -0.2%     
=======================================
  Files        105     108      +3     
  Lines       8126    8428    +302     
=======================================
+ Hits        6523    6753    +230     
- Misses      1603    1675     +72     

☔ 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.

@jsuereth jsuereth changed the title [DRAFT] Rework Resolution Engine to allow using resolved schema Rework Resolution Engine to allow using resolved schema Jan 15, 2026
jsuereth and others added 4 commits January 16, 2026 17:57
Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
.map(|(a, ar)| (a.clone(), *ar))
.collect();
ordered.sort_by(|(ln, _), (rn, _)| ln.cmp(rn));
// assert_eq!(ordered.len(), self.attribute_refs.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

The kind of thing that could use debug_assert_eq!.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! I missed this before merging, I'll remember it going forward.


impl AttributeLookup for V1Schema {
fn lookup_attribute(&self, key: &str) -> Option<AttributeWithGroupId> {
// TODO - fast lookup, not a table scan...
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we originally had a map. Why did we lose that? It;s possible my memory is failing me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ordering. You switched to a linear order for serialization.

I'll need to lead a map on the side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ordering. You switched to a linear order for serialization.

I'll need to lead a map on the side.

Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

I only noticed a few fairly minor issues (the main one is potentially around the imports).
I know that in this PR you didn't try to optimize lookups in the registry/catalog, with find_map used in several places. I think that, in the long run, we'll need to address this, as it could become problematic, especially with support for multiple registries.

let registry_id: String = repo.id().to_string();
let manifest = repo.manifest().cloned();
let mut attr_catalog = AttributeCatalog::default();
// TODO - Do something with non_fatal_errors if we need to.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not merge the non fatal errors coming from the dependencies with the WResult returned by this method? It feels like, at the moment, we're simply dropping those errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are, there's a bug on this being the preferred default.

I can write in the flag that will allow ignoring/dropping or preserving, but I'm going to default to ignoring.

The issue at least before, was using current rules and rego policies on older repositories. That may be less of an issue pulling resolved registry but it's still not as useful as you'd think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are, there's a bug on this being the preferred default.

I can write in the flag that will allow ignoring/dropping or preserving, but I'm going to default to ignoring.

The issue at least before, was using current rules and rego policies on older repositories. That may be less of an issue pulling resolved registry but it's still not as useful as you'd think

let metrics_imports_matcher = build_globset(
current_registry_imports
.iter()
.find_map(|i| i.imports.metrics.as_ref()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we have imports across multiple files? With find_map here, we’re only finding the first one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. This is a temporary quick implementation while we only support one. This method will need to be fleshed out to support multiple later, but at least it's contained in one spot now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. This is a temporary quick implementation while we only support one. This method will need to be fleshed out to support multiple later, but at least it's contained in one spot now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hum. Maybe I misunderstood what you were trying to do here. It doesn't feel like this is about supporting multiple dependencies, but rather about the imports section in a semconv file, which allows defining a subset of metrics to import, the wildcard mechanism. Am I mistaken, or does using find_map prevent capturing all imports?

dependency_chain,
) {
WResult::Ok(d) => loaded_dependencies.push(d),
// TODO - Should we always ignore warnings on loaded dependencies?
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should ignore non-fatal errors on loaded dependencies. We don't really have any guaranties that they are well-formed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to previous behavior and have TODO around #1126.

PTAL at that issue and comment your thoughts. I'll defer fixing it.

@jsuereth jsuereth enabled auto-merge (squash) January 21, 2026 13:39
@jsuereth jsuereth merged commit 556e05f into open-telemetry:main Jan 21, 2026
21 checks passed
@jsuereth jsuereth deleted the wip-resolve-from-resolved-schema branch January 26, 2026 23:23
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.

3 participants