TykTechnologies / tyk-charts

Mozilla Public License 2.0
23 stars 16 forks source link

TT-12004 Need an option to add metricrelabling in podmonitor #226

Open utkarsh079 opened 8 months ago

utkarsh079 commented 8 months ago

In current helm chart, there is no option to add metric relabling. Since the podmonitor is deployed by chart, user does not have an easy option to do any kind of relabling of metrics Use case: we need to relable 'time_stamp' to 'timestamp'

Example:

{{ if has "prometheus" .Values.pump.backend }}
{{ if .Values.pump.prometheusPump.prometheusOperator.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: tyk-pump-podmonitor-{{ include "tyk-pump.fullname" . }}
  labels:
    {{- range $key, $value := .Values.pump.prometheusPump.prometheusOperator.podMonitorSelector }}
    {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  selector:
    matchLabels:
      app: pump-{{ include "tyk-pump.fullname" . }}
  podMetricsEndpoints:
    - port: tyk-pump-port
      {{- if .Values.prometheusPump.podMonitorSelector.metricRelabelings }}
      metricRelabelings:
      {{ tpl (toYaml .Values.prometheusPump.podMonitorSelector.metricRelabelings | indent 4) . }}
      {{- end }}
{{ end }}
{{ end }}
caroltyk commented 5 months ago

Thank you for raising this @utkarsh079 . We have added the request to our backlog for prioritisation. If you would like to submit a PR for this, we are happy to provide guidance.