Skip to content

Commit

Permalink
Merge pull request #24 from gmlexx/main
Browse files Browse the repository at this point in the history
Add opentelemetry autoinstrumentation example of go program for grafana
  • Loading branch information
gmlexx authored Jan 7, 2025
2 parents 5e0c44d + 00d75cb commit 42a100b
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 5 deletions.
23 changes: 23 additions & 0 deletions charts/kof-collectors/templates/opentelemetry/instrumentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.kof.instrumentation.enabled }}
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: kof-instrumentation
namespace: {{ .Release.Namespace }}
spec:
exporter:
endpoint: "http://{{ .Release.Name}}-node-exporter-collector:4318"
propagators:
- tracecontext
- baggage
sampler:
type: parentbased_traceidratio
argument: "1"
go:
image: ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:v0.19.0-alpha
resourceRequirements:
limits:
memory: 128Mi
requests:
memory: 128Mi
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,20 @@ spec:
authenticator: basicauth/logs
logs_endpoint: {{ .Values.kof.logs.endpoint }}
debug:
verbosity: detailed
verbosity: basic

service:
extensions:
- basicauth/metrics
- basicauth/logs
pipelines:
traces:
receivers:
- otlp
processors:
- batch
exporters:
- debug
logs:
exporters:
- otlphttp
Expand Down
2 changes: 2 additions & 0 deletions charts/kof-collectors/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ kof:
credentials_secret_name: grafana-admin-credentials
username_key: GF_SECURITY_ADMIN_USER
password_key: GF_SECURITY_ADMIN_PASSWORD
instrumentation:
enabled: true
prometheus-node-exporter:
enabled: true
hostNetwork: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ rules:
- update
- watch
- apiGroups:
- ""
- "events.k8s.io"
resources:
- events
verbs:
- create
- patch
- get
- list
- watch
- apiGroups:
- ""
resources:
- namespaces
- events
verbs:
- get
- list
- watch
- create
- patch
- apiGroups:
- apps
resources:
Expand All @@ -54,6 +58,8 @@ rules:
- extensions
resources:
- replicasets
- daemonsets
- deployments
verbs:
- get
- list
Expand Down Expand Up @@ -99,8 +105,14 @@ rules:
- ""
resources:
- nodes
- nodes/spec
- pods/status
- namespaces
- namespaces/status
- secrets
- replicationcontrollers
- replicationcontrollers/status
- resourcequotas
verbs:
- get
- list
Expand All @@ -109,6 +121,7 @@ rules:
- batch
resources:
- jobs
- cronjobs
verbs:
- get
- list
Expand Down
2 changes: 2 additions & 0 deletions charts/kof-operators/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ opentelemetry-operator:
collectorImage:
repository: "otel/opentelemetry-collector-contrib"
createRbacPermissions: true
extraArgs:
- "--enable-go-instrumentation=true"
clusterRole:
create: false
admissionWebhooks:
Expand Down
6 changes: 6 additions & 0 deletions charts/kof-storage/templates/grafana/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ spec:
deployment:
spec:
template:
{{- if .Values.grafana.autoinstrumentation.enabled }}
metadata:
annotations:
instrumentation.opentelemetry.io/inject-go: "{{ .Release.Namespace }}/kof-instrumentation"
instrumentation.opentelemetry.io/otel-go-auto-target-exe: "/usr/share/grafana/bin/grafana"
{{- end }}
spec:
securityContext:
fsGroup: 472
Expand Down
2 changes: 2 additions & 0 deletions charts/kof-storage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ grafana:
ingress:
enabled: true
host: grafana.hmc0.example.net
autoinstrumentation:
enabled: true
victoria-metrics-operator:
enabled: true
crds:
Expand Down

0 comments on commit 42a100b

Please sign in to comment.