Skip to content

Commit

Permalink
[demo] Use k8sattributesprocessor instead of env vars
Browse files Browse the repository at this point in the history
Signed-off-by: Goutham <[email protected]>
  • Loading branch information
gouthamve committed Jun 25, 2023
1 parent b8a3fea commit 9432678
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
6 changes: 3 additions & 3 deletions charts/opentelemetry-demo/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies:
- name: opentelemetry-collector
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.55.1
version: 0.57.2
- name: jaeger
repository: https://jaegertracing.github.io/helm-charts
version: 0.69.1
Expand All @@ -11,5 +11,5 @@ dependencies:
- name: grafana
repository: https://grafana.github.io/helm-charts
version: 6.52.8
digest: sha256:ea20e40b7172424213cf43690bee2880ea4e2ae6863651bc94e1a02e16bfc3ef
generated: "2023-05-01T21:40:06.422733-04:00"
digest: sha256:29bfb18c99b19d1f1476b543b7a87b4a72b605407e2e5db87ffa81932feccfa9
generated: "2023-06-25T12:06:30.93777+02:00"
4 changes: 2 additions & 2 deletions charts/opentelemetry-demo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
type: application
name: opentelemetry-demo
version: 0.22.3
version: 0.22.4
description: opentelemetry demo helm chart
home: https://opentelemetry.io/
sources:
Expand All @@ -14,7 +14,7 @@ icon: https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png
appVersion: "1.4.0"
dependencies:
- name: opentelemetry-collector
version: 0.55.1
version: 0.57.2
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
condition: opentelemetry-collector.enabled
- name: jaeger
Expand Down
34 changes: 11 additions & 23 deletions charts/opentelemetry-demo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,12 @@ default:
fieldRef:
apiVersion: v1
fieldPath: "metadata.labels['app.kubernetes.io/component']"
- name: OTEL_K8S_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OTEL_K8S_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OTEL_K8S_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OTEL_K8S_POD_UID
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.uid
- name: OTEL_COLLECTOR_NAME
value: '{{ include "otel-demo.name" . }}-otelcol'
- name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
value: cumulative
- name: OTEL_RESOURCE_ATTRIBUTES
value: service.name=$(OTEL_SERVICE_NAME),service.instance.id=$(OTEL_K8S_POD_UID),service.namespace=opentelemetry-demo,k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.node.name=$(OTEL_K8S_NODE_NAME),k8s.pod.name=$(OTEL_K8S_POD_NAME)
value: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo
# Allows overriding and additions to .Values.default.env
envOverrides: []
# - name: OTEL_K8S_NODE_NAME
Expand Down Expand Up @@ -596,6 +576,9 @@ opentelemetry-collector:
enabled: true
nameOverride: otelcol
mode: deployment
presets:
kubernetesAttributes:
enabled: true
resources:
limits:
memory: 125Mi
Expand Down Expand Up @@ -642,6 +625,11 @@ opentelemetry-collector:
enable_open_metrics: true

processors:
resource:
attributes:
- key: service.instance.id
from_attribute: k8s.pod.uid
action: insert
# we can remove when this is fixed: https://github.com/open-telemetry/opentelemetry-demo/issues/737
transform:
metric_statements:
Expand All @@ -661,11 +649,11 @@ opentelemetry-collector:
service:
pipelines:
traces:
processors: [memory_limiter, batch]
processors: [memory_limiter, resource, batch]
exporters: [otlp, logging, spanmetrics]
metrics:
receivers: [otlp, spanmetrics]
processors: [memory_limiter, filter/ottl, transform, batch]
processors: [memory_limiter, filter/ottl, resource, transform, batch]
exporters: [prometheus, logging]

jaeger:
Expand Down

0 comments on commit 9432678

Please sign in to comment.