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

opentelemetry_sdk: mistake in the docs? #2430

Open
cijothomas opened this issue Dec 14, 2024 Discussed in #2414 · 2 comments
Open

opentelemetry_sdk: mistake in the docs? #2430

cijothomas opened this issue Dec 14, 2024 Discussed in #2414 · 2 comments
Milestone

Comments

@cijothomas
Copy link
Member

Discussed in #2414

Originally posted by survived December 11, 2024
opentelemetry_sdk::Resource::new docs say that:

Values are de-duplicated by key, and the first key-value pair with a non-empty string value will be retained

However, looking at the code, it's not true: actually, the last key-value pair will be retained (no matter if value is empty or not):

pub fn new<T: IntoIterator<Item = KeyValue>>(kvs: T) -> Self {
let mut attrs = HashMap::new();
for kv in kvs {
attrs.insert(kv.key, kv.value);
}
Resource {
inner: Arc::new(ResourceInner {
attrs,
schema_url: None,
}),
}
}

@cijothomas cijothomas added this to the 0.28.0 milestone Dec 17, 2024
@cijothomas
Copy link
Member Author

@pitoniak32 could you help check given you have the most experience with Resource area.

@pitoniak32
Copy link
Contributor

@pitoniak32 could you help check given you have the most experience with Resource area.

yeah I can take a look

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

No branches or pull requests

2 participants