Skip to content

Update All k8s Otel attributes using k8s.*.name standard #1988

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 95 additions & 2 deletions entity-types/infra-container/definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,99 @@ synthesis:
otel.library.name:
entityTagName: instrumentation.name
# kube-state-metrics data via opentelemetry prometheusReceiver
- compositeIdentifier:
separator: ":"
attributes:
- k8s.cluster.name
- k8s.namespace.name
- k8s.pod.name
- k8s.container.name
encodeIdentifierInGUID: true
name: k8s.container.name
conditions:
# kube-state-metrics container prefix
- attribute: metricName
prefix: kube_pod_container_
# identifier attributes
- attribute: k8s.container.name
present: true
- attribute: k8s.pod.name
present: true
- attribute: k8s.namespace.name
present: true
- attribute: k8s.cluster.name
present: true
# open telemetry
- attribute: newrelic.source
value: 'api.metrics.otlp'
# if service.name is present, handle as one
- attribute: service.name
present: false
# value added for test entities only
- attribute: newrelicOnly
value: "true"
tags:
container_id:
entityTagNames: [k8s.containerId]
multiValue: false
image:
entityTagNames: [k8s.containerImage]
k8s.container.name:
entityTagNames: [k8s.containerName]
k8s.pod.name:
entityTagNames: [k8s.podName]
k8s.namespace.name:
entityTagNames: [k8s.namespaceName]
k8s.cluster.name:
entityTagNames: [k8s.clusterName]
k8s.deployment.name:
entityTagNames: [k8s.deploymentName]
# cAdvisor data via opentelemetry prometheusReceiver
- compositeIdentifier:
separator: ":"
attributes:
- k8s.cluster.name
- k8s.namespace.name
- k8s.pod.name
- k8s.container.name
encodeIdentifierInGUID: true
name: container
conditions:
# cadvisor container prefix
- attribute: metricName
prefix: container_
# identifier attributes
- attribute: k8s.container.name
present: true
- attribute: k8s.pod.name
present: true
- attribute: k8s.namespace.name
present: true
- attribute: k8s.cluster.name
present: true
# open telemetry
- attribute: newrelic.source
value: 'api.metrics.otlp'
# if service.name is present, handle as one
- attribute: service.name
present: false
# value added for test entities only
- attribute: newrelicOnly
value: "true"
tags:
k8s.container.name:
entityTagNames: [k8s.containerName]
k8s.pod.name:
entityTagNames: [k8s.podName]
k8s.namespace.name:
entityTagNames: [k8s.namespaceName]
k8s.cluster.name:
entityTagNames: [k8s.clusterName]
k8s.node.name:
entityTagNames: [k8s.nodeName]
k8s.deployment.name:
entityTagNames: [k8s.deploymentName]
# kube-state-metrics data via opentelemetry prometheusReceiver preview
- compositeIdentifier:
separator: ":"
attributes:
Expand Down Expand Up @@ -85,7 +178,7 @@ synthesis:
entityTagNames: [k8s.clusterName]
k8s.deployment.name:
entityTagNames: [k8s.deploymentName]
# cAdvisor data via opentelemetry prometheusReceiver
# cAdvisor data via opentelemetry prometheusReceiver preview
- compositeIdentifier:
separator: ":"
attributes:
Expand Down Expand Up @@ -130,7 +223,7 @@ synthesis:
entityTagNames: [k8s.nodeName]
k8s.deployment.name:
entityTagNames: [k8s.deploymentName]
# kubeletstatsreceiver data via opentelemetry
# kubeletstatsreceiver data via opentelemetry preview
- compositeIdentifier:
separator: ":"
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"k8s.cluster.name": "farm",
"namespace": "orchards",
"pod": "tree-afge",
"container": "peach-332",
"newrelic.source": "api.metrics.otlp",
"newrelicOnly": "true",
"metricName": "kube_pod_container_status_ready",
"kube_pod_container_status_ready": {"type":"gauge","count":1,"sum":1.0,"min":1.0,"max":1.0,"latest":1.0},
"k8s.deployment.name": "my-otel-demo-cartservice"
},
{
"k8s.cluster.name": "universe",
"namespace": "solar-system",
"pod": "earth",
"container": "verdant-forest",
"newrelic.source": "api.metrics.otlp",
"newrelicOnly": "true",
"metricName": "kube_pod_container_info",
"kube_pod_container_info": {"type":"gauge","count":1,"sum":1.0,"min":1.0,"max":1.0,"latest":1.0},
"description": "[STABLE] Information about a container in a pod.",
"otel.library.name": "otelcol/prometheusreceiver",
"otel.library.version": "0.91.0",
"instrumentation.provider": "opentelemetry",
"image":"sha256:1f337e7e6242ffe8cb590da7fa41ed409b8f759bcb075767b74d3861c9d25cc0",
"image_id":"gke.gcr.io/foo@sha256:3aaf29f6967aafd47e50007eedc9c2ac78a202a213f43af92e0b9ccfebc63636",
"image_spec":"gke.gcr.io/foo@sha256:3aaf29f6967aafd47e50007eedc9c2ac78a202a213f43af92e0b9ccfebc63636",
"net.host.port": "8080",
"net.host.name": "11.11.1.11",
"service.instance.id": "11.11.1.11:8080",
"http.scheme": "http",
"container_id": "containerd://b413084f553d6c30d4f96e7ceeef60d858ec9dbce93d93d945afd15398fb5f0d",
"k8s.deployment.name": "my-otel-demo-adservice"
}
]
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
[
{
"instrumentation.provider": "opentelemetry",
"job_label": "kube-state-metrics",
"k8s.cluster.name": "farm",
"k8s.container.name": "peach-332",
"namespace": "orchards",
"pod": "tree-afge",
"container": "peach-332",
"k8s.namespace.name": "orchards",
"k8s.pod.name": "spring-tesing-1011",
"kube_pod_container_status_ready": {
"type": "gauge",
"count": 1,
"sum": 1,
"min": 1,
"max": 1,
"latest": 1
},
"metricName": "kube_pod_container_status_ready",
"newrelic.source": "api.metrics.otlp",
"newrelicOnly": "true",
"metricName": "kube_pod_container_status_ready",
"kube_pod_container_status_ready": {"type":"gauge","count":1,"sum":1.0,"min":1.0,"max":1.0,"latest":1.0},
"k8s.deployment.name": "my-otel-demo-cartservice"
"otel.library.name": "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver",
"otel.library.version": "0.121.0"
},
{
"k8s.cluster.name": "universe",
"namespace": "solar-system",
"pod": "earth",
"container": "verdant-forest",
"container_id": "containerd://101",
"image": "ghcr.io/testing/spring-tesing:latest",
"image_id": "ghcr.io/testing/spring-tesing@sha256:10101",
"image_spec": "ghcr.io/testing/spring-tesing:latest",
"instrumentation.provider": "opentelemetry",
"job_label": "kube-state-metrics",
"k8s.cluster.name": "farm",
"k8s.container.name": "spring-tesing",
"k8s.namespace.name": "default",
"k8s.pod.name": "spring-tesing-1011",
"kube_pod_container_info": {
"type": "gauge",
"count": 1,
"sum": 1,
"min": 1,
"max": 1,
"latest": 1
},
"metricName": "kube_pod_container_info",
"newrelic.source": "api.metrics.otlp",
"newrelicOnly": "true",
"metricName": "kube_pod_container_info",
"kube_pod_container_info": {"type":"gauge","count":1,"sum":1.0,"min":1.0,"max":1.0,"latest":1.0},
"description": "[STABLE] Information about a container in a pod.",
"otel.library.name": "otelcol/prometheusreceiver",
"otel.library.version": "0.91.0",
"instrumentation.provider": "opentelemetry",
"image":"sha256:1f337e7e6242ffe8cb590da7fa41ed409b8f759bcb075767b74d3861c9d25cc0",
"image_id":"gke.gcr.io/foo@sha256:3aaf29f6967aafd47e50007eedc9c2ac78a202a213f43af92e0b9ccfebc63636",
"image_spec":"gke.gcr.io/foo@sha256:3aaf29f6967aafd47e50007eedc9c2ac78a202a213f43af92e0b9ccfebc63636",
"net.host.port": "8080",
"net.host.name": "11.11.1.11",
"service.instance.id": "11.11.1.11:8080",
"http.scheme": "http",
"container_id": "containerd://b413084f553d6c30d4f96e7ceeef60d858ec9dbce93d93d945afd15398fb5f0d",
"k8s.deployment.name": "my-otel-demo-adservice"
}
]
"otel.library.name": "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver",
"otel.library.version": "0.121.0"
}
]
4 changes: 3 additions & 1 deletion entity-types/infra-host/definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ goldenTags:
- cloud.platform
synthesis:
rules:
# opentelemetry host data from k8s-otel-collector
# opentelemetry host data from k8s-otel-collector preview
- identifier: k8s.node.name
name: k8s.node.name
legacyFeatures:
Expand Down Expand Up @@ -91,6 +91,7 @@ synthesis:
host.image.id:
host.image.version:
instrumentation.provider:
k8s.cluster.name:
# opentelemetry host data from opentelemetry-collector
- identifier: host.id
name: host.name
Expand Down Expand Up @@ -124,6 +125,7 @@ synthesis:
host.image.id:
host.image.version:
instrumentation.provider:
k8s.cluster.name:
# opentelemetry host data from opentelemetry-collector
- identifier: host.id
name: host.name
Expand Down
39 changes: 38 additions & 1 deletion entity-types/infra-kubernetes_cronjob/definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,44 @@ goldenTags:
synthesis:
rules:
# kube-state-metrics data via opentelemetry prometheusReceiver
- compositeIdentifier:
separator: ":"
attributes:
- k8s.cluster.name
- k8s.namespace.name
- k8s.cronjob.name
encodeIdentifierInGUID: true
name: k8s.cronjob.name
conditions:
# kube-state-metrics cronjob prefix
- attribute: metricName
prefix: kube_cronjob_
# identifier attributes
- attribute: k8s.cronjob.name
present: true
- attribute: k8s.namespace.name
present: true
- attribute: k8s.cluster.name
present: true
# open telemetry
- attribute: newrelic.source
value: "api.metrics.otlp"
# if service.name is present, it's a service
- attribute: service.name
present: false
# value added for test entities only
- attribute: newrelicOnly
value: "true"
tags:
k8s.cronjob.name:
entityTagNames: [k8s.cronjobName]
k8s.namespace.name:
entityTagNames: [k8s.namespaceName]
k8s.cluster.name:
entityTagNames: [k8s.clusterName]
schedule:
entityTagNames: [k8s.cronjob.schedule]
# kube-state-metrics data via opentelemetry prometheusReceiver preview
- compositeIdentifier:
separator: ":"
attributes:
Expand Down Expand Up @@ -51,7 +89,6 @@ synthesis:
entityTagNames: [k8s.clusterName]
schedule:
entityTagNames: [k8s.cronjob.schedule]

# Infrastructure event data via opentelemetry
# - compositeIdentifier:
# separator: ":"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"instrumentation.provider": "opentelemetry",
"job_label": "kube-state-metrics",
"k8s.cluster.name": "farm",
"k8s.namespace.name": "tree",
"k8s.cronjob.name": "apple-tree-cronjob",
"kube_cronjob_created": {
"type": "gauge",
"count": 1,
"sum": 1,
"min": 1,
"max": 1,
"latest": 1
},
"metricName": "kube_cronjob_created",
"newrelic.source": "api.metrics.otlp",
"newrelicOnly": "true",
"otel.library.name": "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver",
"otel.library.version": "0.121.0"
}
]
38 changes: 37 additions & 1 deletion entity-types/infra-kubernetes_daemonset/definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,42 @@ goldenTags:
synthesis:
rules:
# kube-state-metrics data via opentelemetry prometheusReceiver
- compositeIdentifier:
separator: ":"
attributes:
- k8s.cluster.name
- k8s.namespace.name
- k8s.daemonset.name
encodeIdentifierInGUID: true
name: k8s.daemonset.name
conditions:
# kube-state-metrics daemonset prefix
- attribute: metricName
prefix: kube_daemonset_
# identifier attributes
- attribute: k8s.daemonset.name
present: true
- attribute: k8s.namespace.name
present: true
- attribute: k8s.cluster.name
present: true
# open telemetry
- attribute: newrelic.source
value: 'api.metrics.otlp'
# if service.name is present, it's a service
- attribute: service.name
present: false
# value added for test entities only
- attribute: newrelicOnly
value: "true"
tags:
k8s.daemonset.name:
entityTagNames: [k8s.daemonsetName]
k8s.namespace.name:
entityTagNames: [k8s.namespaceName]
k8s.cluster.name:
entityTagNames: [k8s.clusterName]
# kube-state-metrics data via opentelemetry prometheusReceiver preview
- compositeIdentifier:
separator: ":"
attributes:
Expand Down Expand Up @@ -109,4 +145,4 @@ synthesis:
provider.awsRegion:
entityTagName: aws.region
prefixedTags:
label.:
label.:
Loading