-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allow opamp extension to include resource attributes automatically #38994
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
Allow opamp extension to include resource attributes automatically #38994
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Maybe this needs a bit of coverage in the README.md file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look ok, just one question about the go mod change
…tor-contrib into enable-resource-attr-copying
…tor-contrib into enable-resource-attr-copying
@jaronoff97 I am trying this PR's changes and it seems that something's wrong and Here's what I am trying:
The attribute I even added a small log to check if things were okay, but I don't see it in my logs: resourceAttrs := make(map[string]string, set.Resource.Attributes().Len())
set.Resource.Attributes().Range(func(k string, v pcommon.Value) bool {
set.Logger.Info(fmt.Sprintf("Resource attribute %s: %s", k, v.Str()))
resourceAttrs[k] = v.Str()
return true
}) |
@douglascamata interesting... i have a test for this exact case here. How did you build the opamp extension for your collector? |
@jaronoff97 I cloned your branch and built the Collector image from there. Here's a snippet of the configuration of my opamp extension: opamp:
agent_description:
include_resource_attributes: true
non_identifying_attributes:
k8s.node.name: ${env:KUBE_NODE_NAME}
server:
http:
endpoint: ${env:OPAMP_SERVER_URL}
headers:
Authorization: Bearer ${env:CORALOGIX_PRIVATE_KEY}
polling_interval: 2m I can confirm that I see my custom attribute in my metrics pipeline, where the resource detection processor is used. |
oh i see why now, you're using the resource attributes processor which adds resource attributes to the telemetry collected by the collector, but not to the collector itself. You'd need to set the resource in the service telemetry like so:
|
Ahhh, I see, @jaronoff97. I am personally going after enriching the OpAMP agent attributes with the same data collected by the resource detection processor. I understand now that this is unrelated. 👍 |
Sorry for the confusion. |
No problem, as far as your issue goes I believe there's a way to do what you'd like via env vars, but that's a different topic. I believe what you can for that is somethign like this but referencing an environment variable with the |
@jaronoff97 I will need a lot more than that. I want also all those cloud metadata attributes from AWS, Azure, etc. |
@douglascamata let's continue this discussion in slack, there's some features you should be able to take advantage of. (tag me in the #otel-config-file channel in the CNCF slack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what's going on with the go.mod change, but if CI passes, I assume it's good. Overall looks good to me.
…opentelemetry-collector-contrib into enable-resource-attr-copying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jaronoff97
@jaronoff97 please resolve the conflicts and we can get this merged 👍🏻 |
…tor-contrib into enable-resource-attr-copying
@codeboten should be g2g! 🙇 |
…tor-contrib into enable-resource-attr-copying
resolve the conflicts, should be good for a merge again! 🙇 |
…pen-telemetry#38994) #### Description Introduces a new config struct element `IncludeResourceAttributes` which when enabled (default is false) copies the set resource attributes from the agent into the non-identifying attributes in the agent description message. #### Link to tracking issue Fixes open-telemetry#37487 #### Testing Unit #### Documentation n/a --------- Co-authored-by: Evan Bradley <[email protected]>
…pen-telemetry#38994) #### Description Introduces a new config struct element `IncludeResourceAttributes` which when enabled (default is false) copies the set resource attributes from the agent into the non-identifying attributes in the agent description message. #### Link to tracking issue Fixes open-telemetry#37487 #### Testing Unit #### Documentation n/a --------- Co-authored-by: Evan Bradley <[email protected]>
Description
Introduces a new config struct element
IncludeResourceAttributes
which when enabled (default is false) copies the set resource attributes from the agent into the non-identifying attributes in the agent description message.Link to tracking issue
Fixes #37487
Testing
Unit
Documentation
n/a