coralogix / telemetry-shippers

Coralogix's way to ship our best practices when it comes to interaction with our platform.
Apache License 2.0
14 stars 19 forks source link

[otel-integration] add k8s metadata to opentelemetry collector metrics #414

Closed povilasv closed 4 months ago

povilasv commented 4 months ago

Description

Fixes ES-221

Currently otel collector metrics are missing metadata because they are statically scraped by ip address, which makes it hard to identify / build dashboard for them.

This makes adjustment to resource attributes before k8sattributes is run, making k8s attributes appear.


otelcol_exporter_queue_size{
cx_application_name="default",
cx_otel_integration_name="coralogix-integration-helm",
cx_subsystem_name="coralogix-opentelemetry-agent",
exporter="coralogix",
host_id="e1429cc2d6d74c80b61d6663fd614ab4",
host_name="172.19.0.2",
http_scheme="http",
job="opentelemetry-collector",
k8s_cluster_name="kind",
k8s_daemonset_name="coralogix-opentelemetry-agent",
k8s_namespace_name="default",
k8s_node_name="kind-control-plane",
k8s_pod_name="coralogix-opentelemetry-agent-5khbh",
net_host_name="172.19.0.2",
net_host_port="8888",
os_type="linux",
service_instance_id="172.19.0.2:8888",
service_name="opentelemetry-collector",
service_version="0.101.0"
}

vs

otelcol_exporter_queue_size{
cx_application_name="otel",
cx_otel_integration_name="coralogix-integration-helm",
cx_subsystem_name="opentelemetry-collector",
exporter="coralogix",
host_id="e1429cc2d6d74c80b61d6663fd614ab4",
host_name="172.19.0.2",
http_scheme="http",
job="opentelemetry-collector",
k8s_cluster_name="kind",
k8s_node_name="kind-control-plane",
net_host_name="172.19.0.2",
net_host_port="8888",
os_type="linux",
service_instance_id="172.19.0.2:8888",
service_name="opentelemetry-collector",
service_version="0.101.0"
}

How Has This Been Tested?

kind cluster

Checklist: