Skip to content

Conversation

@lquerel
Copy link
Contributor

@lquerel lquerel commented May 27, 2025

This bug does not appear when:

  • resolving a single registry
  • resolving two registries without calling gc_unreferenced_attribute_refs

When two registries are involved and gc_unreferenced_attribute_refs is called (i.e., without the --include-unreferenced parameter), resolution sometimes succeeds and sometimes fails. The intermittent success occurs because HashMap ordering in Rust is random, and the small number of elements in the test frequently resulted in the expected outcome. Additionally, the initial test was insufficiently robust.

The source of the bug lies in the AttributeCatalog::gc_unreferenced_attribute_refs method, which returned the correct mapping but did not internally modify the catalog as intended... Pretty bad!

Closes #750

@lquerel lquerel self-assigned this May 27, 2025
@lquerel lquerel added the bug Something isn't working label May 27, 2025
Comment on lines +498 to +501
assert_eq!(metric.attributes.len(), 3);
assert!(attr_names.contains("auction.name"));
assert!(attr_names.contains("auction.id"));
assert!(attr_names.contains("error.type"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous version of this was definitely not strong enough...

@lquerel lquerel marked this pull request as ready for review May 27, 2025 06:08
@lquerel lquerel requested a review from a team as a code owner May 27, 2025 06:08
Copy link
Contributor

@jerbly jerbly left a comment

Choose a reason for hiding this comment

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

Probably worth mentioning this fix in the changelog.

@lquerel lquerel merged commit e5b5a3a into open-telemetry:main May 27, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Dual registry resolves incorrectly

3 participants