Skip to content

Allow attributes to be identifying or descriptive. #735

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jsuereth
Copy link
Contributor

@jsuereth jsuereth commented May 9, 2025

This is the next phase of open-telemetry/semantic-conventions#2246.

What this does:

  • Add role field to Attribute with options Identifying or Descriptive
  • Adds lineage tracking for role changes

What this does not do:

  • Update yaml schema for model files (Didn't have time to learn this one yet)
  • Add any weaver enforcement of rules around usage. I plan to add this in semconv initially, but not sure how much limits we'll have in weaver.
  • Add any JQ or JINJA helpers for role.

Why role

Why do we call this role? I did some investigation into names and actually thought LLM captured some considerations well, here's (snipped) output:

Why terms like "Type" or "Kind" might be less suitable:

AttributeType: This is commonly used to refer to the data type of the attribute (e.g., string, integer, boolean) (Source 4.2), and using it for this dimension could cause confusion.
AttributeKind: OpenTelemetry already uses "Kind" for spans (e.g., SpanKind with values like SERVER, CLIENT), so using it here might lead to ambiguity.

...

Rationale: "Role" is a widely understood term in data modeling, where attributes play specific roles (e.g., key, descriptor). This name signifies the function or part an attribute plays in defining or characterizing the signal or resource.

...

@@ -688,6 +693,8 @@
#[cfg(test)]
mod tests {
use std::error::Error;
use std::fs::{File, OpenOptions};

Check failure

Code scanning / clippy

unused import: File Error

unused import: File
@@ -688,6 +693,8 @@
#[cfg(test)]
mod tests {
use std::error::Error;
use std::fs::{File, OpenOptions};
use std::io::Write;

Check failure

Code scanning / clippy

unused import: std::io::Write Error

unused import: std::io::Write
@@ -793,23 +809,37 @@
)
.expect("Failed to deserialize expected attribute catalog");

// Write observed output.
let observed_attr_catalog_file = OpenOptions::new()
.create(true)

Check failure

Code scanning / clippy

file opened with create, but truncate behavior not defined Error

file opened with create, but truncate behavior not defined
// Check that the resolved registry matches the expected registry.
let expected_registry: Registry = serde_json::from_reader(
std::fs::File::open(format!("{}/expected-registry.json", test_dir))
.expect("Failed to open expected registry"),
)
.expect("Failed to deserialize expected registry");

// Write observed output.
let observed_registry_file = OpenOptions::new()
.create(true)

Check failure

Code scanning / clippy

file opened with create, but truncate behavior not defined Error

file opened with create, but truncate behavior not defined
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.

Made 2 minor comments, otherwise LGTM

@@ -87,6 +89,10 @@ pub struct Attribute {
/// Note: This is only used in a telemetry schema specification.
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<Value>,
/// Whether the attribute is identifying or descriptive.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a document describing the difference between these two roles that we could reference here?

Comment on lines +812 to +820
// Write observed output.
let observed_attr_catalog_file = OpenOptions::new()
.create(true)
.write(true)
.open(observed_output_dir.join("attribute-catalog.json"))
.expect("Failed to open observed output file");
serde_json::to_writer_pretty(observed_attr_catalog_file, &observed_attr_catalog)
.expect("Failed to write observed ouptut.");
// Compare values
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this? Debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, updating the test values for some of these really large files is easier to look at the new and validate, then copy over.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Thanks

@jsuereth jsuereth added this to Entities May 9, 2025
@jsuereth jsuereth moved this to In Progress in Entities May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants