Skip to content

Commit af447d7

Browse files
committed
cleanup
1 parent b812be7 commit af447d7

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44

55
# Unreleased
66

7+
- Reject v2 entity refinements that change the base entity's identity. ([#TODO](https://github.com/open-telemetry/weaver/pull/TODO) by @lmolkova)
78
- Represent v2 entity refinements in the resolved and materialized schema, allow to refine identity attributes. ([#1588](https://github.com/open-telemetry/weaver/pull/1588) by @lmolkova)
89
- Support signal refinements over a published dependency. ([#1587](https://github.com/open-telemetry/weaver/pull/1587) by @lmolkova)
910
- Fix panic when a registry, policy, or template path uses a commit SHA. ([#1414](https://github.com/open-telemetry/weaver/pull/1414))

crates/weaver_resolver/src/registry.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,11 @@ fn resolve_extends_references(ureg: &mut UnresolvedRegistry) -> Result<(), Error
573573
errors.push(err);
574574
continue;
575575
}
576-
if unresolved_group.is_v2 && unresolved_group.group.r#type == GroupType::Entity {
576+
// Only meaningful when refining another entity
577+
if unresolved_group.is_v2
578+
&& unresolved_group.group.r#type == GroupType::Entity
579+
&& parent_summary.r#type == GroupType::Entity
580+
{
577581
fatal_errors.extend(entity_identity_refinement_errors(
578582
unresolved_group,
579583
extends,
@@ -744,7 +748,8 @@ fn resolve_extends_references(ureg: &mut UnresolvedRegistry) -> Result<(), Error
744748
}
745749
}
746750

747-
/// Errors when an entity refinement alters the identity of the base entity.
751+
/// Errors when an entity refinement alters the identity of the base entity
752+
/// (demoting, promoting, or adding an identity attribute).
748753
fn entity_identity_refinement_errors(
749754
group: &UnresolvedGroup,
750755
extends: &str,

crates/weaver_semconv/src/v2/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ impl SemConvSpecV2 {
125125
/// that is elevated to an error under `--future`.
126126
///
127127
/// It also rejects entities and entity refinements that list the same
128-
/// attribute under both `identity` and `description` — the two lists
129-
/// assign contradicting roles, so this is a fatal definition error.
128+
/// attribute under both `identity` and `description`.
130129
pub(crate) fn validate(self, provenance: &str) -> WResult<Self, Error> {
131130
let mut errors: Vec<Error> = vec![];
132131
let mut fatal_errors: Vec<Error> = vec![];

schemas/semconv-syntax.v2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ An entity refinement definition consists of the following properties:
415415
- `id` - Required. Uniquely identifies the entity refinement.
416416
- `ref` - Required. The name of the entity being refined.
417417
- `identity` - Optional. List of [attribute references](#attribute-reference) refining identity attributes of the entity. Attributes listed here have the identifying role, so an identity attribute of the base entity can be refined (`brief`, `note`, `examples`, etc.) while keeping its role. A refinement must **not change the identity** of the base entity: it may only list attribute keys the base entity already declares under `identity`.
418-
- `description` - Optional. The additional attributes to describe the Entity. Attributes listed here have the descriptive role.
418+
- `description` - Optional. The additional attributes to describe the Entity. Attributes listed here have the descriptive role. As with entity definitions, the same attribute must **not** appear under both `identity` and `description`.
419419
- `brief` - Optional. Refines the brief description of the signal.
420420
- `note` - Optional. Refines the more elaborate description of the signal.
421421
- `stability` - Optional. Refines the stability of the signal.

0 commit comments

Comments
 (0)