Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add display_name field #202

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/weaver_forge/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ pub struct ResolvedGroup {
/// The name of the event. If not specified, the prefix is used.
/// If prefix is empty (or unspecified), name is required.
pub name: Option<String>,

/// The lineage of the group.
#[serde(skip_serializing_if = "Option::is_none")]
pub lineage: Option<GroupLineage>,
/// The readable name for attribute groups used when generating registry tables.
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
}

impl ResolvedGroup {
Expand Down Expand Up @@ -153,6 +155,7 @@ impl ResolvedGroup {
unit: group.unit.clone(),
name: group.name.clone(),
lineage,
display_name: group.display_name.clone(),
})
}
}
Expand Down Expand Up @@ -211,6 +214,7 @@ impl ResolvedRegistry {
unit: group.unit.clone(),
name: group.name.clone(),
lineage,
display_name: group.display_name.clone(),
}
})
.collect();
Expand Down
4 changes: 3 additions & 1 deletion crates/weaver_resolved_schema/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ pub struct Group {
/// If prefix is empty (or unspecified), name is required.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,

/// The lineage of the group.
#[serde(skip_serializing_if = "Option::is_none")]
pub lineage: Option<GroupLineage>,
/// The readable name for attribute groups used when generating registry tables.
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
}

/// Common statistics for a group.
Expand Down
1 change: 1 addition & 0 deletions crates/weaver_resolver/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ fn group_from_spec(group: GroupSpecWithProvenance) -> UnresolvedGroup {
unit: group.spec.unit,
name: group.spec.name,
lineage: Some(GroupLineage::new(&group.provenance)),
display_name: group.spec.display_name,
},
attributes: attrs,
provenance: group.provenance,
Expand Down
1 change: 1 addition & 0 deletions crates/weaver_semconv/data/faas-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ groups:
- id: attributes.faas.common
type: attribute_group
brief: "Describes FaaS attributes."
display_name: "FaaS Attributes"
prefix: faas
attributes:
- id: trigger
Expand Down
4 changes: 4 additions & 0 deletions crates/weaver_semconv/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ pub struct GroupSpec {
/// The name of the event. If not specified, the prefix is used.
/// If prefix is empty (or unspecified), name is required.
pub name: Option<String>,
/// The readable name for attribute groups used when generating registry tables.
pub display_name: Option<String>,
}

impl GroupSpec {
Expand Down Expand Up @@ -331,6 +333,7 @@ mod tests {
instrument: None,
unit: None,
name: None,
display_name: None,
};
assert!(group.validate("<test>").is_ok());

Expand Down Expand Up @@ -430,6 +433,7 @@ mod tests {
instrument: None,
unit: None,
name: None,
display_name: None,
};
assert!(group.validate("<test>").is_ok());

Expand Down
2 changes: 2 additions & 0 deletions crates/weaver_semconv/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ mod tests {
deprecated: None,
events: vec![],
name: None,
display_name: Some("Group 1".to_owned()),
}],
},
),
Expand All @@ -283,6 +284,7 @@ mod tests {
deprecated: None,
events: vec![],
name: None,
display_name: Some("Group 2".to_owned()),
}],
},
),
Expand Down
Loading