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 service.instance.id with Pod name #2678

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

janario
Copy link
Contributor

@janario janario commented Feb 26, 2024

Description:

I'm using newrelic with opentelemetry and according to their documentation they rely on the service.instance.id to group jvm metrics.

https://opentelemetry.io/docs/specs/semconv/resource/#service-experimental

After a few explorations, I noticed that this was expected here open-telemetry/semantic-conventions#312

But while the pod is being created it may not have a name yet, which results on an absent property.

This PR will change it to be more dynamic at runtime.

Link to tracking Issue(s):

Testing:

Documentation:

https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/service.md

@yuriolisa
Copy link
Contributor

Could you please submit some unit tests for this PR?

@pavolloffay
Copy link
Member

It would be nice to see this in e2e tests

@pavolloffay
Copy link
Member

Could you please include it in the changelog?

@janario
Copy link
Contributor Author

janario commented Feb 28, 2024

I have a few more internal details that I'm validating but I plan to get back on this soon, maybe this or next week I hope

@janario janario changed the title Add service.instance.id with Pod name Draft: Add service.instance.id with Pod name Mar 6, 2024
@janario
Copy link
Contributor Author

janario commented Mar 6, 2024

Marking this as a draft, I plan to get back on this and a few other issues soon after some internal migration.

@janario janario force-pushed the fix/add-service-instance-id branch 2 times, most recently from 12b7786 to 66cf88b Compare April 3, 2024 19:49
Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

The change itself looks good to me. For consistency, I think this logic should be moved into the injectCommonSDKConfig function, where we handle these kinds of cases. I'd also like to see a unit test checking it.

@janario
Copy link
Contributor Author

janario commented Apr 4, 2024

The change itself looks good to me. For consistency, I think this logic should be moved into the injectCommonSDKConfig function, where we handle these kinds of cases. I'd also like to see a unit test checking it.

@swiatekm-sumo

hum moving would be a bit hard I guess since it would refac a few things 🤔

About the test, I've fixed/adjusted the other tests to consider the new attributes I guess in some ways they cover it already

Do you see some other test/adjustment that should be done?

@janario
Copy link
Contributor Author

janario commented Apr 4, 2024

@yuriolisa @pavolloffay @swiatekm-sumo

I'll create the changelog soon.
Can you pls give it another review and share your opinion on this? #2678 (comment)

So after the final change I close with the changelog.

janario added 7 commits April 5, 2024 13:18
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
@janario janario force-pushed the fix/add-service-instance-id branch from 4b6b09b to b42f7c6 Compare April 5, 2024 11:18
@janario janario changed the title Draft: Add service.instance.id with Pod name Add service.instance.id with Pod name Apr 5, 2024
Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

I think this looks good... @janario testing locally could you send some screenshots of new relic (or something else) showing this working as intended?

@janario
Copy link
Contributor Author

janario commented Apr 10, 2024

I think this looks good... @janario testing locally could you send some screenshots of new relic (or something else) showing this working as intended?

Sure,

By default without the attribute it doesn't show the JVM view of a service:

image

After having it starts to work:

image

image


In the end we were under evaluation between Newrelic and other options, and we choose for another option :-)
But I think it still worth to be fixed.

@jaronoff97 jaronoff97 requested a review from pavolloffay April 10, 2024 14:27
@janario
Copy link
Contributor Author

janario commented Apr 11, 2024

@pavolloffay did you have a chance to review this one? :-)

@janario
Copy link
Contributor Author

janario commented Apr 22, 2024

hi
Any updates here?

@pavolloffay pavolloffay merged commit 5bafbfd into open-telemetry:main Apr 25, 2024
31 checks passed
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* Add service.instance.id with Pod name

* Add e2e assert

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Fix tests

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Remove unnecessary `service.name`

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Rename var `someNamespace` - > `testNamespace`

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Fix tests

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Add changelog

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

---------

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
rubenvp8510 pushed a commit to rubenvp8510/opentelemetry-operator that referenced this pull request May 7, 2024
* Add service.instance.id with Pod name

* Add e2e assert

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Fix tests

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Remove unnecessary `service.name`

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Rename var `someNamespace` - > `testNamespace`

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Fix tests

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

* Add changelog

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>

---------

Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
@janario janario deleted the fix/add-service-instance-id branch May 9, 2024 09:18
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.

service.instance.id is not added because of empty podName
5 participants