3
0
mirror of https://github.com/mastodon/chart synced 2025-05-18 04:53:21 +00:00

Add environment variables/sidecars for prometheus metrics

This commit is contained in:
Tim Campbell 2025-01-31 15:54:29 +01:00
parent 4f85998722
commit ddb9e13ae4
3 changed files with 74 additions and 0 deletions

View File

@ -206,6 +206,26 @@ spec:
- name: OTEL_SERVICE_NAME_SEPARATOR - name: OTEL_SERVICE_NAME_SEPARATOR
value: "{{ coalesce $context.Values.mastodon.sidekiq.otel.nameSeparator $context.Values.mastodon.otel.nameSeparator }}" value: "{{ coalesce $context.Values.mastodon.sidekiq.otel.nameSeparator $context.Values.mastodon.otel.nameSeparator }}"
{{- end }} {{- end }}
{{- if $context.Values.mastodon.metrics.prometheus.enabled }}
- name: MASTODON_PROMETHEUS_EXPORTER_ENABLED
value: "true"
- name: PROMETHEUS_EXPORTER_HOST
value: {{ $context.Values.mastodon.metrics.prometheus.host }}
- name: PROMETHEUS_EXPORTER_PORT
value: {{ $context.Values.mastodon.metrics.prometheus.port }}
{{- if $context.Values.mastodon.metrics.prometheus.sidekiq.detailed }}
- name: MASTODON_PROMETHEUS_EXPORTER_SIDEKIQ_DETAILED_METRICS
value: "true"
{{- end }}
{{- if $context.Values.mastodon.metrics.prometheus.sidekiq.local.enabled }}
- name: MASTODON_PROMETHEUS_EXPORTER_LOCAL
value: "true"
- name: MASTODON_PROMETHEUS_EXPORTER_HOST
value: {{ $context.Values.mastodon.metrics.prometheus.sidekiq.local.host }}
- name: MASTODON_PROMETHEUS_EXPORTER_PORT
value: {{ $context.Values.mastodon.metrics.prometheus.sidekiq.local.port }}
{{- end }}
{{- end }}
volumeMounts: volumeMounts:
{{- if (not $context.Values.mastodon.s3.enabled) }} {{- if (not $context.Values.mastodon.s3.enabled) }}
- name: assets - name: assets

View File

@ -196,6 +196,20 @@ spec:
- name: OTEL_SERVICE_NAME_SEPARATOR - name: OTEL_SERVICE_NAME_SEPARATOR
value: "{{ coalesce .Values.mastodon.web.otel.nameSeparator .Values.mastodon.otel.nameSeparator }}" value: "{{ coalesce .Values.mastodon.web.otel.nameSeparator .Values.mastodon.otel.nameSeparator }}"
{{- end }} {{- end }}
{{- if .Values.mastodon.metrics.prometheus.enabled }}
- name: MASTODON_PROMETHEUS_EXPORTER_ENABLED
value: "true"
- name: PROMETHEUS_EXPORTER_HOST
value: {{ $.Values.mastodon.metrics.prometheus.host }}
- name: PROMETHEUS_EXPORTER_PORT
value: {{ .Values.mastodon.metrics.prometheus.port }}
{{- if .Values.mastodon.metrics.prometheus.web.detailed }}
- name: MASTODON_PROMETHEUS_EXPORTER_WEB_DETAILED_METRICS
value: "true"
{{- end }}
{{- end }}
- name: TEST_ENV_VALUE
value: {{ .Values.mastodon.metrics.statsd.address }}
volumeMounts: volumeMounts:
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}
- name: assets - name: assets
@ -233,6 +247,22 @@ spec:
resources: resources:
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.mastodon.metrics.prometheus.enabled }}
- name: prometheus-exporter
image: "{{ coalesce .Values.mastodon.web.image.repository .Values.image.repository }}:{{ coalesce .Values.mastodon.web.image.tag .Values.image.tag .Chart.AppVersion }}"
command:
- ./bin/prometheus_exporter
resources:
requests:
cpu: "0.1"
memory: "180M"
limits:
cpu: "0.5"
memory: "250M"
ports:
- name: prometheus
containerPort: {{ .Values.mastodon.metrics.prometheus.port }}
{{- end }}
{{- include "mastodon.statsdExporterContainer" $ | indent 8 }} {{- include "mastodon.statsdExporterContainer" $ | indent 8 }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:

View File

@ -431,6 +431,30 @@ mastodon:
enabled: false enabled: false
port: 9102 port: 9102
# Settings for Prometheus metrics.
# For more information, see:
# https://docs.joinmastodon.org/admin/config/#prometheus
prometheus:
enabled: false
# Host & port to send metrics to
host: localhost
port: 9394
# Prometheus for web pods
web:
# Collect per-controller/action metrics for every request
detailed: false
# Prometheus for sidekiq pods
sidekiq:
# Collect per-job metrics for every job
detailed: false
# Use a local in-process exporter instead
local:
enabled: true
host: localhost
port: 9394
# Open Telemetry configuration for all deployments. Component-specific # Open Telemetry configuration for all deployments. Component-specific
# configuration will override these values. # configuration will override these values.
otel: otel: