Skip to content

Conversation

@jackgopack4
Copy link

PR by Bits for Dev Agent Session

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


Description

This change adds a new field collector_resource_attributes to the OtelCollector struct in the internal payload, which is populated with resource attributes from TelemetrySettings.Resource. The resource attributes are formatted as a list of strings in the format ["key1:value1", "key2:value2"...] and sorted alphabetically by key for consistency.

The implementation follows the pattern used in extension/opampextension/opamp_agent.go for accessing and storing resource attributes.

Link to tracking issue

Fixes

Testing

Added comprehensive test coverage:

  • TestCollectorResourceAttributesArePopulated() verifies that resource attributes are correctly collected from TelemetrySettings, sorted alphabetically, and stored in the extension
  • TestOtelCollectorResourceAttributesJSON() validates that the resource attributes are properly serialized and deserialized in JSON payloads

Documentation

The field is self-documenting through the code comments explaining the format and source of the resource attributes.

@datadog-official
Copy link

Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]

You can ask for changes by mentioning @DataDog in a comment.

@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants