Skip to content

Conversation

@jsuereth
Copy link
Contributor

DO NOT MERGE: This is a work in progress for discussion.

This modifies the resolved telemetry schema (and template values) to look like the V2 definition schema.

With this PR you can resolve into the new schema via a new flag to check how it looks, e.g.

weaver registry resolve --v2 > test.yaml

Here's a sample of the new layout:

attributes:
  - key: android.app.state
    type:
      ...
signals:
  metrics:
  - name: aspnetcore.authentication.authenticate.duration
    instrument: histogram
    unit: s
    ...
  spans:
  - type: aws.client
    ...
  events:
  - name: app.jank
    ...
  entities:
  - type: android
    ...
refinements:
  metrics:
  - id: ...refinement id...
    ...full metric definition...
  spans:
    - id: ...refinement id...
    ...full span definition...
  events:
    - id: ...refinement id...
    ...full event definition...

Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

left some comments, but looks great overall!


assert!(diff_dir("expected_output/test", "observed_output/test").unwrap());

// TODO - Remove this.
Copy link
Member

Choose a reason for hiding this comment

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

is it ok to remove 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.

I'm still using this to test/demo. I was going to remove after we lock-in on the details of the schema.

instrument: metric.instrument,
unit: metric.unit,
attributes,
entity_associations: metric.entity_associations,
Copy link
Member

Choose a reason for hiding this comment

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

not blocking, we can follow-up: we're checking that attributes exist, but not checking it for entities, it seems inconsistent.

Comment on lines 37 to 56
/// A list of span signal definitions.
pub spans: Vec<Span>,

/// A list of metric signal definitions.
pub metrics: Vec<Metric>,

/// A list of event signal definitions.
pub events: Vec<Event>,

/// A list of entity signal definitions.
pub entities: Vec<Entity>,

/// A list of span refinements.
pub span_refinements: Vec<SpanRefinement>,

/// A list of metric refinements.
pub metric_refinements: Vec<MetricRefinement>,

/// A list of event refinements.
pub event_refinements: Vec<EventRefinement>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be beneficial to group the definitions based on the base namespace ie db then at the top level we just have an array of namespaces. This concept and the use case for namespaces is described in more detail in https://github.com/open-telemetry/weaver/pull/867/files but I would start off with just the name + signals being the only properties of the namespace as the rest could be added via non-breaking changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still not convinced. I see the registry itself as a namespace going forward, but this is something that needs more discussion going forward.

e.g. in instance where we want a "bundle of things" would it be easier to create a registry to describe that bundle? That registry would come with some nice properties, like versioning, isolated codegen, docs, etc.

I think I'd like to move to point where, e.g. an implementation specific registry exists in OTEL for any implementation. I think this may give us some nice properties:

  • Implementation-specific concerns can live near the instrumentation
  • Implementations can document exactly what they provide, while guaranteeing conformance to semconv
  • Implementations would document semconv version explicitly via their dependency to semconv repo. We could allow these to "hold back" while we do major evolutions (e.g. current RPC efforts).

There's obviously downsides too, but it's something I'd like us to consider / think through.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like what you are thinking with regards to implementations being their own registry, but I am torn about the core sem conv registry being split. I can see it helping but also making things harder. Let's discuss implementations as standalone registry in a seperate thread.

If we look at how the namespace value would be used in the core registry, it would enable a single entry point to be provided for the namespace ie db which lists everything in that namespace rather than splitting it into a seperate entry point per signal type like we do now.

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.

Wow, it took me quite some time to go through all of this. Thanks for the massive refactoring of the semconv schema and everything that comes with it!

Sorry for the number of comments. A lot of them are just copy/paste issues or typos. There are probably only a handful that really concern the approach or the decisions made. Apologies in advance if some of these points or answers have already been discussed in the SIG meetings; I haven't been very present in those lately.

/// The type of the entity.
pub r#type: SignalId,

/// List of attributes that belong to this event.
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment would benefit from being updated to match the field below :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies, I was rushing for the demo, I'll clean all these up - Didn't want this to be a full review, more of "check the direction" review.

I think the discussion on Attribute/AttributeRef is the thing to focus on in this review :)

Comment on lines 120 to 128
if let Some(a) = v2_catalog.convert_ref(attr) {
span_attributes.push(span::SpanAttributeRef {
base: a,
requirement_level: attr.requirement_level.clone(),
sampling_relevant: attr.sampling_relevant.clone(),
});
} else {
// TODO logic error!
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this dance, attribute-ref -> attribute -> attribute-ref, necessary because the comparison rules for attributes differ between v1 and v2?
That brings us back to my previous question about the rationale behind this difference. In any case, once we've fully migrated to v2, we shouldn't have this kind of thing anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - this actually leads to many less attributes in the catalog, but the catalog now matches almost exactly what we get in Semconv attribute registry.

A lot of this dance can be fully removed when we're directly doing resolve on V2.

/// the attribute is "recommended". When set to
/// "conditionally_required", the string provided as <condition> MUST
/// specify the conditions under which the attribute is required.
pub requirement_level: RequirementLevel,
Copy link
Contributor

Choose a reason for hiding this comment

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

I admit I'm not entirely clear on why requirement_level gets special treatment here. In what way is requirement_level more event-specific than note, examples, ..., in the context of a refinement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking of this via the "attribute registry" we have in otel.

Requirement level isn't an independent concept for any individual attribute, while examples, note is.
Requirement level only makes sense in the context of a specific signal (e.g. this metric requires this attribute). Additionally, requirement level is almost guaranteed to diverge between Metrics<->Spans/Events in some critical ways, due to cardinality constraints between the signals.

If you look at the existing semconv registries (e.g. attributes), you'll see we don't include requirement_level.

I feel pretty strongly we should NOT include requirement_level in either the attribute catalog/registry or outside of a signal context.

@jsuereth jsuereth force-pushed the wip-v2-resolved-schema branch from 67e6762 to 209883f Compare October 20, 2025 19:25
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 31.43508% with 301 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.2%. Comparing base (236de8c) to head (c69a92a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/weaver_forge/src/v2/registry.rs 0.0% 223 Missing ⚠️
crates/weaver_resolved_schema/src/v2/mod.rs 59.2% 68 Missing ⚠️
crates/weaver_resolved_schema/src/v2/registry.rs 0.0% 6 Missing ⚠️
crates/weaver_resolved_schema/src/lib.rs 33.3% 2 Missing ⚠️
crates/weaver_resolved_schema/src/v2/attribute.rs 0.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #980     +/-   ##
=======================================
- Coverage   78.3%   75.2%   -3.1%     
=======================================
  Files         77      82      +5     
  Lines       6122    6559    +437     
=======================================
+ Hits        4795    4934    +139     
- Misses      1327    1625    +298     

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

@jsuereth jsuereth marked this pull request as ready for review November 3, 2025 21:08
@jsuereth jsuereth requested a review from a team as a code owner November 3, 2025 21:08
@lmolkova
Copy link
Member

lmolkova commented Nov 3, 2025

testing this out on semconv and checking against problems identified for v1 in open-telemetry/semantic-conventions#2469

Resolved schema v2 - https://gist.githubusercontent.com/lmolkova/34dc5c0b0f583ca80681af3c9334238d/raw/d5b1ce469f149c1586b277cf3fe0f5772a480b72/semconv_schema_v2_copy.yaml

works fine now !

@lmolkova

This comment was marked as resolved.

value: None,
role: None,
});
assert_eq!(result.is_some(), true);

Check failure

Code scanning / clippy

used assert_eq! with a literal bool Error

used assert_eq! with a literal bool
value: None,
role: None,
});
assert_eq!(result2.is_some(), true);

Check failure

Code scanning / clippy

used assert_eq! with a literal bool Error

used assert_eq! with a literal bool
Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

I tested weaver registry resolve --v2 and it works. I'm in favor of merging it and following up

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.

4 participants