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

Capture some pod labels by default #189

Closed
mtwo opened this issue Sep 3, 2021 · 2 comments
Closed

Capture some pod labels by default #189

mtwo opened this issue Sep 3, 2021 · 2 comments

Comments

@mtwo
Copy link

mtwo commented Sep 3, 2021

A common use case that I've heard at customer meetings is applying a common set of pod labels as dimensions / annotations on metrics, traces, and logs. Users can custom-define these labels, and there are often too many to efficiently apply all of them, but it would be nice if the Collector captured some common / built-in ones. For example, Datadog's agent does a nice job of this: https://docs.datadoghq.com/agent/kubernetes/tag/?tab=containerizedagent

@mstumpfx
Copy link

mstumpfx commented Sep 7, 2021

Hi @mtwo

By default, at least for metrics, we do capture labels as signalfx properties that are synced onto resource UID dimensions.

For example, for pod labels we sync this onto the k8s.pod.uid dimension. In the signalfx product you should be able to navigate to the Menu --> Metrics --> Metadata Finder --> search for your k8s UID by typing k8s.pod.uid: $your_pod_uid and you should be able to find a list of properties synced onto this dimension.

The way this works in the code (since this is undocumented sort of I'll write some of this out) is that a receiver may implement a metadata exporter. The Signalfx exporter implements a consume metadata function which ends up exporting this metadata to our backend. This is enabled by default in our chart already.
In the k8s cluster receiver, each resource type is watched for updates and when updated specific sets of metadata is synced which you can view here. You can use that function as a jumping off point to see what properties we sync for various resources onto what dimensions.

Specifically for pod labels, you can see this is added here along with some other properties, such as the owners reference of the pod (e.g. Daemonset, StatefulSet ...)

We do not capture annotations at this time, that would be an enhancement to the k8sclusterreceiver in contrib.

dmitryax added a commit that referenced this issue Sep 14, 2021
This change is the first step towards moving away from fluentd logs collection.

Fluentd "kubernetes_metadata_filter" plugin is known as a performance bottleneck in k8s logs collection with fluentd. So moving away from it already gives performance benefits. Also it mitigates issues when fluentd ends up hammering k8s API. 

This change is compatible with otel gateway, if `otelCollector.enabled=true` all logs are forwarded through the gateway and logs enrichment is happening there reducing load on k8s API.

Drawbacks:

- `container.image.name` logs attribute cannot be provided at the moment until this issue is resolved: open-telemetry/opentelemetry-collector-contrib#5235

Additional changes:

- Extra attribute added by default `k8s.pod.labels.app`. Value for this attribute is taken from pod's "app" label if it's set. The change is needed to support istio use case. We also want to enable more of these attributes going forward #189.
dmitryax added a commit that referenced this issue Sep 14, 2021
* Move k8s metadata enrichment from fluentd to otel-collector

This change is the first step towards moving away from fluentd logs collection.

Fluentd "kubernetes_metadata_filter" plugin is known as a performance bottleneck in k8s logs collection with fluentd. So moving away from it already gives performance benefits. Also it mitigates issues when fluentd ends up hammering k8s API. 

This change is compatible with otel gateway, if `otelCollector.enabled=true` all logs are forwarded through the gateway and logs enrichment is happening there reducing load on k8s API.

Drawbacks:

- `container.image.name` logs attribute cannot be provided at the moment until this issue is resolved: open-telemetry/opentelemetry-collector-contrib#5235

Additional changes:

- Extra attribute added by default `k8s.pod.labels.app`. Value for this attribute is taken from pod's "app" label if it's set. The change is needed to support istio use case. We also want to enable more of these attributes going forward #189.
@atoulme
Copy link
Contributor

atoulme commented Aug 17, 2022

Closing this issue as inactive. Please reopen if this is still being worked on.

@atoulme atoulme closed this as completed Aug 17, 2022
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

No branches or pull requests

3 participants