Skip to content

Set service.namespace and service.instance.id in pod logs feature #1738

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

petewall
Copy link
Collaborator

@petewall petewall commented Jul 7, 2025

No description provided.

@petewall petewall requested review from a team and rlankfo as code owners July 7, 2025 20:10
@petewall petewall requested a review from nevermind89x July 7, 2025 20:10
@petewall petewall linked an issue Jul 7, 2025 that may be closed by this pull request
@petewall petewall self-assigned this Jul 7, 2025
@cyrille-leclerc
Copy link
Collaborator

My understanding is that this PR sets the pod log label:

service_name=firstNonNull(k8s.pod.annotation["resource.opentelemetry.io/service.namespace"], k8s.namespace.name)

This logic is compliant with Semantic conventions 1.35.0 / Non-normative / K8s attributes
Specify resource attributes using Kubernetes annotations
, it's what we want.

@cyrille-leclerc
Copy link
Collaborator

Should we review our logic to set service_instance_id and ensure that it also complies with Semantic conventions 1.35.0 / Non-normative / K8s attributes - Specify resource attributes using Kubernetes annotations?

@cyrille-leclerc
Copy link
Collaborator

Do we have a documentation PR to explain this evolution?

@petewall
Copy link
Collaborator Author

Should we review our logic to set service_instance_id and ensure that it also complies with Semantic conventions 1.35.0 / Non-normative / K8s attributes - Specify resource attributes using Kubernetes annotations?

Good call. We can set that, even if we don't pass it through by default. It would be a highly cardinal label, since it includes pod name. Perhaps its set as structured metadata?

@cyrille-leclerc
Copy link
Collaborator

Should we review our logic to set service_instance_id and ensure that it also complies with Semantic conventions 1.35.0 / Non-normative / K8s attributes - Specify resource attributes using Kubernetes annotations?

Good call. We can set that, even if we don't pass it through by default. It would be a highly cardinal label, since it includes pod name. Perhaps its set as structured metadata?

We don't store it as a structured metadata?
IMO his is yet another reason to embrace OTel pod logs making gathermedhod: filelog the default.

@petewall petewall force-pushed the feat/set-service-namespace-for-pod-logs branch from 636e2c4 to be0ccfe Compare July 14, 2025 16:22
@petewall petewall changed the title set service_namespace explicitly Set service.name and service.instance.id in pod logs feature Jul 16, 2025
@petewall petewall force-pushed the feat/set-service-namespace-for-pod-logs branch from ef584f7 to c688234 Compare July 16, 2025 20:34
@petewall petewall changed the title Set service.name and service.instance.id in pod logs feature Set service.namespace and service.instance.id in pod logs feature Jul 22, 2025
@petewall petewall force-pushed the feat/set-service-namespace-for-pod-logs branch from c688234 to 6ea64db Compare July 22, 2025 19:35
petewall added 5 commits July 22, 2025 17:07
Signed-off-by: Pete Wall <[email protected]>
Updates the k8s-monitoring platform test to check for this in structured metadata

Signed-off-by: Pete Wall <[email protected]>
Signed-off-by: Pete Wall <[email protected]>
@petewall petewall force-pushed the feat/set-service-namespace-for-pod-logs branch from 6ea64db to 53e39d5 Compare July 22, 2025 22:07
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.

Ensure that service_namespace is always set for podlogs
3 participants