Skip to content

Commit

Permalink
[otel-integration] add service.instance.id to collector metrics (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
povilasv authored Feb 19, 2025
1 parent c31609a commit 7de0a52
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 21 deletions.
6 changes: 5 additions & 1 deletion otel-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

## OpenTelemtry-Integration

### v0.0.144 / 2025-02-18
### v0.0.145 / 2025-02-18

- [Feat] Add agent type and service instance id to Otel Collector metrics
- [Fix] OpenTelemetry Windows error: ImagePullBackOff

### v0.0.144 / 2025-02-18
- [Fix] `spanMetrics.transformStatements` are correctly created even when
`spanMetrics.dbMetrics` is not enabled.

Expand Down
2 changes: 1 addition & 1 deletion otel-integration/k8s-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: otel-integration
description: OpenTelemetry Integration
version: 0.0.144
version: 0.0.145
keywords:
- OpenTelemetry Collector
- OpenTelemetry Agent
Expand Down
2 changes: 2 additions & 0 deletions otel-integration/k8s-helm/e2e-test/expected_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var expectedResourceAttributesPrometheusreceiver = map[string]string{
"service.instance.id": "",
"service.name": "opentelemetry-collector",
"url.scheme": "",
"cx_agent_type": "",
"service_instance_id": "",
}

var expectedMetrics map[string]bool = map[string]bool{
Expand Down
7 changes: 6 additions & 1 deletion otel-integration/k8s-helm/values-windows-tailsampling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ opentelemetry-agent-windows:
level: "{{ .Values.global.logLevel }}"
encoding: json
metrics:
address: ${env:MY_POD_IP}:8888
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
extensions:
- zpages
- pprof
Expand Down
9 changes: 4 additions & 5 deletions otel-integration/k8s-helm/values-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ opentelemetry-agent-windows:
repository: coralogixrepo/opentelemetry-collector-contrib-windows
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "0.116.0"
tag: "0.117.0"
# When digest is set to a non-empty value, images will be pulled by digest (regardless of tag value).
digest: ""

Expand Down Expand Up @@ -266,13 +266,12 @@ opentelemetry-agent-windows:
service:
telemetry:
resource:
# Supress this attribute, as we don't want the UUID of the collector to be sent,
# instead we rely on instance label generated by Prometheus receiver.
service.instance.id:
service.name:
service.name: "opentelemetry-collector"
cx.agent.type: "agent"
logs:
level: "{{ .Values.global.logLevel }}"
encoding: json

metrics:
address: ${env:MY_POD_IP}:8888
extensions:
Expand Down
42 changes: 29 additions & 13 deletions otel-integration/k8s-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global:
defaultSubsystemName: "integration"
logLevel: "warn"
collectionInterval: "30s"
version: "0.0.144"
version: "0.0.145"

extensions:
kubernetesDashboard:
Expand Down Expand Up @@ -298,11 +298,9 @@ opentelemetry-agent:
statements:
- set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service.instance.id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_instance_id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where attributes["service.name"] == "opentelemetry-collector"
- context: datapoint
statements:
- delete_key(attributes, "service_instance_id") where resource.attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where resource.attributes["service.name"] == "opentelemetry-collector"
k8sattributes:
filter:
Expand Down Expand Up @@ -351,11 +349,17 @@ opentelemetry-agent:
telemetry:
resource:
service.name: "opentelemetry-collector"
cx.agent.type: "agent"
logs:
level: "{{ .Values.global.logLevel }}"
encoding: json
metrics:
address: 0.0.0.0:8888
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
extensions:
- zpages
- pprof
Expand Down Expand Up @@ -591,11 +595,9 @@ opentelemetry-cluster-collector:
statements:
- set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service.instance.id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_instance_id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where attributes["service.name"] == "opentelemetry-collector"
- context: datapoint
statements:
- delete_key(attributes, "service_instance_id") where resource.attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where resource.attributes["service.name"] == "opentelemetry-collector"
resource/kube-events:
attributes:
Expand Down Expand Up @@ -709,11 +711,17 @@ opentelemetry-cluster-collector:
telemetry:
resource:
service.name: "opentelemetry-collector"
cx.agent.type: "cluster-collector"
logs:
level: "{{ .Values.global.logLevel }}"
encoding: json
metrics:
address: ${env:MY_POD_IP}:8888
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
extensions:
- zpages
- pprof
Expand Down Expand Up @@ -948,11 +956,9 @@ opentelemetry-gateway:
statements:
- set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service.instance.id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_instance_id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where attributes["service.name"] == "opentelemetry-collector"
- context: datapoint
statements:
- delete_key(attributes, "service_instance_id") where resource.attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where resource.attributes["service.name"] == "opentelemetry-collector"
receivers:
prometheus:
Expand All @@ -973,11 +979,17 @@ opentelemetry-gateway:
telemetry:
resource:
service.name: "opentelemetry-collector"
cx.agent.type: "gateway"
logs:
level: "{{ .Values.global.logLevel }}"
encoding: json
metrics:
address: ${env:MY_POD_IP}:8888
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
pipelines:
metrics:
exporters:
Expand Down Expand Up @@ -1141,11 +1153,9 @@ opentelemetry-receiver:
statements:
- set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service.instance.id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_instance_id") where attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where attributes["service.name"] == "opentelemetry-collector"
- context: datapoint
statements:
- delete_key(attributes, "service_instance_id") where resource.attributes["service.name"] == "opentelemetry-collector"
- delete_key(attributes, "service_name") where resource.attributes["service.name"] == "opentelemetry-collector"
receivers:
prometheus:
Expand All @@ -1166,11 +1176,17 @@ opentelemetry-receiver:
telemetry:
resource:
service.name: "opentelemetry-collector"
cx.agent.type: "receiver"
logs:
level: "{{ .Values.global.logLevel }}"
encoding: json
metrics:
address: ${env:MY_POD_IP}:8888
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
pipelines:
metrics/self_monitoring:
exporters:
Expand Down

0 comments on commit 7de0a52

Please sign in to comment.