open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
222 stars 141 forks source link

Add `k8s.pod.ip` attribute #1160

Open ChrsMark opened 2 weeks ago

ChrsMark commented 2 weeks ago

Area(s)

area:k8s

Is your change request related to a problem? Please describe.

The k8s.pod.ip is already used by the Collector for the association of Pod's signals with the respective Pod's metadata. With https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/33440 the Collector will provide the option to explicitly expose this as an additional attribute as well.

Describe the solution you'd like

We would like to define a Semantic Convention to cover the k8s.pod.ip attribute.

Describe alternatives you've considered

No response

Additional context

One thing to consider here is that Pod's IP can change during Pod's existence. An interesting discussion/summary around this can be found at https://github.com/kubernetes/kubernetes/issues/108281#issuecomment-1058503524.

Having said this, the k8s.pod.ip will be mutable so it can't be a resource attribute similarly to the current status of a container discussed at https://github.com/open-telemetry/semantic-conventions/pull/997#issuecomment-2129538490.

However I wonder if this constraint is valid for all the Resource cases we want to cover in SemConv, and I think it is already violated in the k8s.pod.{label,annotation}.* case where a label or annotation can be overwritten. (same for host's IPs, I guess)

@open-telemetry/specs-semconv-approvers I would love your thoughts here.

lmolkova commented 2 weeks ago

@open-telemetry/semconv-k8s-approvers @jsuereth @tigrannajaryan please take a look

TylerHelmuth commented 2 weeks ago

The name and location seem right to me. We've been using this field as a resource attribute for many many years and had no issues.

mx-psi commented 2 weeks ago

Regarding mutability we have a bunch other attributes that are mutable as you point out (host.ip being one of them). If we have host.ip, we surely can have k8s.pod.ip as well. I think the Entities SIG will have to figure mutability out, but until that happens I am in favor of using this as used in the Collector.

tigrannajaryan commented 2 weeks ago

The concept of mutable attributes fits well with the upcoming concept of Entities. We plan to reflect this in the semconv in the future.