Skip to content

Commit cef38e3

Browse files
build: add telemetry configs (#848)
* build(app-proxy): add telemetry configs * update app-proxy env vars * build: add telemetry configs * refactor: rename anchor * refactor: remove redundant service name prefixes --------- Co-authored-by: Mikhail Klimko <[email protected]>
1 parent 9beab32 commit cef38e3

File tree

5 files changed

+113
-3
lines changed

5 files changed

+113
-3
lines changed

charts/gitops-runtime/templates/_components/cap-app-proxy/environment-variables/_main-container.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{{- define "cap-app-proxy.environment-variables.defaults" -}}
2+
{{- $accountId := .Values.global.codefresh.accountId -}}
3+
{{- $chartVersion := .Chart.Version -}}
4+
{{- $runtimeVersion := .Chart.AppVersion -}}
5+
{{- $runtimeName := .Values.global.runtime.name -}}
6+
{{- $appProxyName := "app-proxy" -}}
7+
{{- $appProxyVersion := .Values.image.tag | default "latest" -}}
28
ARGO_CD_URL:
39
valueFrom:
410
configMapKeyRef:
@@ -221,6 +227,10 @@ CACHE_PASSWORD:
221227
secretKeyRef:
222228
name: gitops-runtime-redis
223229
key: auth
230+
CF_SERVICE_NAME: {{ $appProxyName }}
231+
CF_SERVICE_VERSION: {{ $appProxyVersion }}
232+
OTEL_SERVICE_NAME: {{ $appProxyName }}
233+
OTEL_RESOURCE_ATTRIBUTES: {{ printf "service.name=%s,service.version=%s,service.namespace=%s,cf.account.id=%s,cf.gitops.runtime.name=%s,cf.gitops.runtime.version=%s,cf.gitops.runtime.chart.version=%s" $appProxyName $appProxyVersion "cf-gitops-runtime" $accountId $runtimeName $runtimeVersion $chartVersion }}
224234
{{ include "codefresh-gitops-runtime.get-proxy-env-vars" . }}
225235
{{- end -}}
226236

charts/gitops-runtime/templates/_components/gitops-operator/_env.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ WORKFLOW_MONITOR_POLLING_INTERVAL: {{ .Values.config.workflowMonitorPollingInter
2525
{{- end }}
2626

2727
{{- define "gitops-operator.resources.environment-variables.defaults" -}}
28+
{{- $accountId := .Values.global.codefresh.accountId -}}
29+
{{- $chartVersion := .Chart.Version -}}
30+
{{- $runtimeVersion := .Chart.AppVersion -}}
31+
{{- $runtimeName := .Values.global.runtime.name -}}
32+
{{- $gitopsOperatorVersion := .Values.image.tag | default "latest" -}}
33+
{{- $gitopsOperatorName := "gitops-operator" -}}
2834
AP_URL: http://cap-app-proxy:3017
2935
ARGO_CD_URL: argo-cd-server:80
3036
ARGO_WF_URL: http://argo-server:2746
@@ -45,4 +51,8 @@ RUNTIME_VERSION:
4551
configMapKeyRef:
4652
name: codefresh-cm
4753
key: version
54+
CF_SERVICE_NAME: {{ $gitopsOperatorName }}
55+
CF_SERVICE_VERSION: {{ $gitopsOperatorVersion }}
56+
OTEL_SERVICE_NAME: {{ $gitopsOperatorName }}
57+
OTEL_RESOURCE_ATTRIBUTES: {{ printf "service.name=%s,service.version=%s,service.namespace=%s,cf.account.id=%s,cf.gitops.runtime.name=%s,cf.gitops.runtime.version=%s,cf.gitops.runtime.chart.version=%s" $gitopsOperatorName $gitopsOperatorVersion "cf-gitops-runtime" $accountId $runtimeName $runtimeVersion $chartVersion }}
4858
{{- end -}}

charts/gitops-runtime/templates/event-reporters/cluster-event-reporter/_env.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ CODEFRESH_SSL_CERT_PATH: {{ printf "/app/config/codefresh-tls-certs/%s" $secretK
2323
{{- end }}
2424

2525
{{- define "cluster-event-reporter.resources.environment-variables.defaults" -}}
26+
{{- $accountId := .Values.global.codefresh.accountId -}}
27+
{{- $chartVersion := .Chart.Version -}}
28+
{{- $runtimeVersion := .Chart.AppVersion -}}
29+
{{- $runtimeName := .Values.global.runtime.name -}}
30+
{{- $eventReporterVersion := .Values.image.tag | default "latest" -}}
31+
{{- $eventReporterName := "cluster-event-reporter" -}}
2632
REPORTER_MODE: resource
2733
APP_QUEUE_SIZE:
2834
valueFrom:
@@ -186,4 +192,8 @@ RESOURCE_THREADINESS:
186192
name: cluster-event-reporter-cmd-params-cm
187193
key: resource.threadiness
188194
SERVICE_NAME: {{ include "cluster-event-reporter.fullname" . }}
195+
CF_SERVICE_NAME: {{ $eventReporterName }}
196+
CF_SERVICE_VERSION: {{ $eventReporterVersion }}
197+
OTEL_SERVICE_NAME: {{ $eventReporterName }}
198+
OTEL_RESOURCE_ATTRIBUTES: {{ printf "service.name=%s,service.version=%s,service.namespace=%s,cf.account.id=%s,cf.gitops.runtime.name=%s,cf.gitops.runtime.version=%s,cf.gitops.runtime.chart.version=%s" $eventReporterName $eventReporterVersion "cf-gitops-runtime" $accountId $runtimeName $runtimeVersion $chartVersion }}
189199
{{- end -}}

charts/gitops-runtime/templates/event-reporters/runtime-event-reporter/_env.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ CODEFRESH_SSL_CERT_PATH: {{ printf "/app/config/codefresh-tls-certs/%s" $secretK
2323
{{- end }}
2424

2525
{{- define "runtime-event-reporter.resources.environment-variables.defaults" -}}
26+
{{- $accountId := .Values.global.codefresh.accountId -}}
27+
{{- $chartVersion := .Chart.Version -}}
28+
{{- $runtimeVersion := .Chart.AppVersion -}}
29+
{{- $runtimeName := .Values.global.runtime.name -}}
30+
{{- $eventReporterVersion := .Values.image.tag | default "latest" -}}
31+
{{- $eventReporterName := "runtime-event-reporter" -}}
2632
REPORTER_MODE: app
2733
APP_QUEUE_SIZE:
2834
valueFrom:
@@ -186,4 +192,8 @@ RESOURCE_THREADINESS:
186192
name: runtime-event-reporter-cmd-params-cm
187193
key: resource.threadiness
188194
SERVICE_NAME: {{ include "runtime-event-reporter.fullname" . }}
195+
CF_SERVICE_NAME: {{ $eventReporterName }}
196+
CF_SERVICE_VERSION: {{ $eventReporterVersion }}
197+
OTEL_SERVICE_NAME: {{ $eventReporterName }}
198+
OTEL_RESOURCE_ATTRIBUTES: {{ printf "service.name=%s,service.version=%s,service.namespace=%s,cf.account.id=%s,cf.gitops.runtime.name=%s,cf.gitops.runtime.version=%s,cf.gitops.runtime.chart.version=%s" $eventReporterName $eventReporterVersion "cf-gitops-runtime" $accountId $runtimeName $runtimeVersion $chartVersion }}
189199
{{- end -}}

charts/gitops-runtime/values.yaml

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,45 @@ global:
189189
scrapeTimeout: 10s
190190
labels: {}
191191
config: {}
192+
193+
anchors:
194+
common-envs:
195+
# -- Telemetry configuration
196+
- &otel-config
197+
# -- Base endpoint URL for all OpenTelemetry signals.
198+
# Ref: https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
199+
OTEL_EXPORTER_OTLP_ENDPOINT: 'http://localhost:4317'
200+
# -- Specifies the OTLP transport protocol to be used for all telemetry data.
201+
# Ref: https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
202+
OTEL_EXPORTER_OTLP_PROTOCOL: 'grpc'
203+
# -- Specifies the compression algorithm to be used for all telemetry data.
204+
# Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/
205+
OTEL_EXPORTER_OTLP_COMPRESSION: 'gzip'
206+
# -- OTel Logs exporter to be used.
207+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
208+
OTEL_LOGS_EXPORTER: 'none'
209+
# -- OTel traces exporter to be used.
210+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
211+
OTEL_TRACES_EXPORTER: 'none'
212+
# -- OTel sampler to be used for traces.
213+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
214+
OTEL_TRACES_SAMPLER: 'parentbased_always_on'
215+
# -- OTel metrics exporter to be used. Set to "prometheus" to export metrics in Prometheus format. If set to "prometheus", it's recommended to set METRICS_SCRAPE_TIMEOUT_MS=4×scrape_interval.
216+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
217+
OTEL_METRICS_EXPORTER: 'none'
218+
# -- The time interval (in milliseconds) between the start of two export attempts for push metric exporters, such as "otlp".
219+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
220+
OTEL_METRIC_EXPORT_INTERVAL: '10000'
221+
# -- Maximum allowed time (in milliseconds) to export data for push metric exporters, such as "otlp".
222+
# Ref: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
223+
OTEL_METRIC_EXPORT_TIMEOUT: '5000'
224+
# -- Host used by the Prometheus OTel metrics exporter if OTEL_METRICS_EXPORTER=prometheus
225+
OTEL_EXPORTER_PROMETHEUS_HOST: '0.0.0.0'
226+
# -- Port used by the Prometheus OTel metrics exporter if OTEL_METRICS_EXPORTER=prometheus
227+
OTEL_EXPORTER_PROMETHEUS_PORT: '9464'
228+
# -- Emit the stable HTTP and networking OTel conventions if CF_TELEMETRY_OTEL_ALLOW_HTTP_INSTRUMENTATION=true.
229+
OTEL_SEMCONV_STABILITY_OPT_IN: 'http'
230+
192231
# -------------------------------------------------------------------------------------------------------------------------
193232
# Installer
194233
# -------------------------------------------------------------------------------------------------------------------------
@@ -530,7 +569,30 @@ app-proxy:
530569
clusterChunkSize: 50
531570
# -- Cors settings for app-proxy. This is the list of allowed domains for platform (comma separated).
532571
cors: "https://g.codefresh.io"
533-
env: {}
572+
env:
573+
<<:
574+
- *otel-config
575+
# -- Level of logging for app-proxy
576+
CF_TELEMETRY_LOGS_LEVEL: 'info'
577+
# -- Level for logging HTTP requests
578+
CF_TELEMETRY_LOGS_LEVEL_HTTP: 'debug'
579+
# -- Enable OpenTelemetry signals (logs, metrics, traces)
580+
CF_TELEMETRY_OTEL_ENABLE: 'false'
581+
# -- Enable OTel HTTP instrumentation.
582+
# Make sure to sanitize `url.full` and `url.query` span attributes on collector before enabling this flag, as it may contain sensitive information.
583+
CF_TELEMETRY_OTEL_ALLOW_HTTP_INSTRUMENTATION: 'false'
584+
# -- Enable Prometheus server
585+
CF_TELEMETRY_PROMETHEUS_ENABLE: 'false'
586+
# -- Enable collecting process metrics
587+
CF_TELEMETRY_PROMETHEUS_ENABLE_PROCESS_METRICS: 'false'
588+
# -- Host for Prometheus metrics server
589+
CF_TELEMETRY_PROMETHEUS_HOST: '0.0.0.0'
590+
# -- Port for Prometheus metrics server
591+
CF_TELEMETRY_PROMETHEUS_PORT: '9100'
592+
# -- Enable Pyroscope profiling. If enabled, the Pyroscope server address must be set in PYROSCOPE_SERVER_ADDRESS.
593+
CF_TELEMETRY_PYROSCOPE_ENABLE: 'false'
594+
# -- Pyroscope server address
595+
PYROSCOPE_SERVER_ADDRESS: ''
534596
serviceAccount:
535597
create: true
536598
annotations: {}
@@ -628,6 +690,8 @@ gitops-operator:
628690
repository: codefresh/codefresh-gitops-operator
629691
tag: "293f24f"
630692
env:
693+
<<:
694+
- *otel-config
631695
GITOPS_OPERATOR_VERSION: 0.11.1
632696
serviceAccount:
633697
create: true
@@ -793,8 +857,14 @@ redis:
793857
name: ""
794858
annotations: {}
795859
event-reporters:
796-
cluster-event-reporter: {}
797-
runtime-event-reporter: {}
860+
cluster-event-reporter:
861+
env:
862+
<<:
863+
- *otel-config
864+
runtime-event-reporter:
865+
env:
866+
<<:
867+
- *otel-config
798868
# -- Redis-HA subchart replaces custom redis deployment when `redis-ha.enabled=true`
799869
# Ref: https://github.com/DandyDeveloper/charts/blob/master/charts/redis-ha/values.yaml
800870
redis-ha:

0 commit comments

Comments
 (0)