-
Notifications
You must be signed in to change notification settings - Fork 7
Mark Pods deployed by k8s collector with "sw.k8s.deployedbycollector" #1242
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
Changes from all commits
e7d035b
6883bc8
4e16ef5
2a45325
8e031f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to test whether this actually works, because the all container metrics (
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why do we instrument telemetry by anything at all here? We updated all pods that we deploy and all pods that are deployed by subcharts, so why do we need to update k8sattributes config at all?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to extract a resource attribute out of the label. There are multiple ways how to achieve that. I used this one as it makes it unified with what I did in the manifest collection pipeline. And it allowed to me to add also the sanity check for to sure the resource attribute is not set in case of incorrect namespace.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, clarified async. We will keep this backup there until we make sure that event collector and ingenstion of entity state events from manifest cannot be disabled. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,34 @@ extensions: | |
|
|
||
| processors: | ||
| k8sattributes: | ||
| {{ include "common.k8s-instrumentation" . | indent 4 }} | ||
| auth_type: "serviceAccount" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this copy paste, but probably there's no other way.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd actually prefer to remove most of the deduplicated code, as it only complicates investigations of what each pipeline does and what data it really depends on. Not all of the shared configuration is really used by all of the pipelines, that reference it. |
||
| passthrough: false | ||
| extract: | ||
| metadata: | ||
| - k8s.pod.name | ||
| - k8s.deployment.name | ||
| - k8s.replicaset.name | ||
| - k8s.daemonset.name | ||
| - k8s.job.name | ||
| - k8s.cronjob.name | ||
| - k8s.statefulset.name | ||
| - k8s.node.name | ||
| labels: | ||
| - tag_name: sw.k8s.deployedbycollector | ||
| key: swo.cloud.solarwinds.com/deployed-with-k8s-collector | ||
| from: pod | ||
| pod_association: | ||
| - sources: | ||
| - from: resource_attribute | ||
| name: k8s.pod.name | ||
| - from: resource_attribute | ||
| name: k8s.namespace.name | ||
| - sources: | ||
| - from: resource_attribute | ||
| name: k8s.pod.ip | ||
| - from: resource_attribute | ||
| name: k8s.namespace.name | ||
|
|
||
| memory_limiter: | ||
| {{ toYaml .Values.otel.metrics.memory_limiter | indent 4 }} | ||
| transform: | ||
|
|
@@ -939,6 +966,15 @@ processors: | |
| )' | ||
| {{- end }} | ||
|
|
||
| transform/remove_deployed_by_collector_label_if_from_different_namespace: | ||
| error_mode: ignore | ||
| metric_statements: | ||
| - conditions: | ||
| - resource.attributes["sw.k8s.deployedbycollector"] == "true" | ||
| and resource.attributes["k8s.namespace.name"] != "{{ .Release.Namespace }}" | ||
| statements: | ||
| - delete_key(resource.attributes, "sw.k8s.deployedbycollector") | ||
|
|
||
| connectors: | ||
| forward/prometheus: {} | ||
| forward/metric-exporter: {} | ||
|
|
@@ -1241,6 +1277,7 @@ service: | |
| - groupbyattrs/all | ||
| - resource/metrics | ||
| - k8sattributes | ||
| - transform/remove_deployed_by_collector_label_if_from_different_namespace | ||
| - transform/cleanup_attributes_for_nonexisting_entities | ||
| {{- if eq (include "isNamespacesFilterEnabled" .) "true" }} | ||
| - filter/namespaces | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file depend on solarwinds/solarwinds-otel-collector-contrib#220