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

Add resource attributes to collector sidecar #832

Merged
merged 10 commits into from
Apr 28, 2022

Conversation

rubenvp8510
Copy link
Contributor

@rubenvp8510 rubenvp8510 commented Apr 21, 2022

This PR adds an env var OTEL_RESOURCE_ATTRIBUTES to the sidecar pod, this envvar contains the k8s attributes of the pod, this is to be used for example with the resource detector processor to attach k8s attributes to spans,logs and metrics.

Updates #573

Signed-off-by: Ruben Vargas [email protected]

@rubenvp8510 rubenvp8510 requested a review from a team April 21, 2022 13:06
@rubenvp8510
Copy link
Contributor Author

@pavolloffay What do you think?

pkg/sidecar/attributes.go Outdated Show resolved Hide resolved
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

It looks good. It's worth modifying e2e test to check if the variable is set.

pkg/sidecar/attributes.go Outdated Show resolved Hide resolved
pkg/sidecar/attributes.go Outdated Show resolved Hide resolved
pkg/sidecar/attributes.go Outdated Show resolved Hide resolved
pkg/sidecar/attributes.go Outdated Show resolved Hide resolved
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
@rubenvp8510 rubenvp8510 requested a review from pavolloffay April 23, 2022 17:02
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

LGTM great work. The PR looks good to me.

Could you please document this behavior in readme or perhaps in the api/crd (if it makes sense)?

@rubenvp8510 rubenvp8510 requested a review from pavolloffay April 26, 2022 22:26
@rubenvp8510
Copy link
Contributor Author

Updated the README

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Signed-off-by: Ruben Vargas <[email protected]>
@rubenvp8510
Copy link
Contributor Author

Done!

@pavolloffay pavolloffay merged commit 928e9e4 into open-telemetry:main Apr 28, 2022
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* Add resource attributes to collector sidecar

Signed-off-by: Ruben Vargas <[email protected]>

* Update getAttributesEnv comments.

Co-authored-by: Ben B. <[email protected]>

* Use semconv package for attribute names

Signed-off-by: Ruben Vargas <[email protected]>

* Make env var names consistent

Signed-off-by: Ruben Vargas <[email protected]>

* Improve comments

Signed-off-by: Ruben Vargas <[email protected]>

* Rename attributes function

Signed-off-by: Ruben Vargas <[email protected]>

* fix import order

Signed-off-by: Ruben Vargas <[email protected]>

* Verify env vars on sidecar e2e test

Signed-off-by: Ruben Vargas <[email protected]>

* Update readme mentioning OTEL_RESOURCE_ATTRIBUTES env var on sidecar mode

Signed-off-by: Ruben Vargas <[email protected]>

* README Improvments

Signed-off-by: Ruben Vargas <[email protected]>

Co-authored-by: Ben B. <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants