Skip to content

Conversation

@jerbly
Copy link
Contributor

@jerbly jerbly commented Nov 23, 2025

Convert live-check to work with both v1 and v2 resolved registries. This has been achieved with enums and generics to limit the amount of code duplication since we'll have dual support for some time.

This approach also means that the interface to rego policies is very similar and will rarely require any changes. In fact all the rego policies for live-check in the tests are dual version compatible and therefore unchanged in this PR.

  • Initially working
  • Refactor duplications
  • v2 tests

@codecov
Copy link

codecov bot commented Nov 23, 2025

Codecov Report

❌ Patch coverage is 86.25954% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.6%. Comparing base (1511626) to head (2d9160a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/weaver_live_check/src/advice.rs 77.2% 10 Missing ⚠️
crates/weaver_live_check/src/lib.rs 85.9% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1022     +/-   ##
=======================================
- Coverage   78.7%   78.6%   -0.1%     
=======================================
  Files         82      82             
  Lines       6612    6701     +89     
=======================================
+ Hits        5204    5270     +66     
- Misses      1408    1431     +23     

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

@jerbly jerbly marked this pull request as ready for review November 24, 2025 01:14
@jerbly jerbly requested a review from a team as a code owner November 24, 2025 01:14
@jerbly jerbly changed the title [WIP] v2 live check Schema v2 live-check Nov 24, 2025
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! Wanted to check on V2 + custom rego policies

pub struct TypeAdvisor;

/// Trait to abstract over different attribute types for checking
trait CheckableAttribute {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I like this idea

}
_ => {
let _ = semconv_attributes.insert(attribute.name.clone(), attribute_rc);
VersionedRegistry::V2(registry) => {
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 how it's more clear what signals are supported here.

}

#[test]
fn test_custom_rego() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does custom rego policy work with V2? Does this need a test?

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, custom rego does work with V2. The test policies here were unchanged, and the builtin otel policies also. This is due to the way I provide the signal as input to the policy "untagged" by serde. If you happen to need one of the fields that has moved position in the JSON then you would need to fix your policy. We should fix this with documentation: #694

There are three more examples in these tests that exercise v1 and v2 with custom rego. This is the only one I didn't do that with because it doesn't look at the semconv attribute, only the sample so it's moot. However, I should make it a dual test for consistency. I'll do that now.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, cool, can you open a task on the tracking bug to update the docs for this then?

@jerbly jerbly merged commit 9cbfd91 into open-telemetry:main Nov 24, 2025
23 checks passed
@lquerel
Copy link
Contributor

lquerel commented Nov 25, 2025

Great!

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