This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 4927258  feat: support adding metrics relabeling config (#579)
4927258 is described below

commit 4927258548799205ef9ca302b9b63abdf7e80cd5
Author: Abhishek Choudhary <[email protected]>
AuthorDate: Wed Jul 12 08:50:32 2023 +0545

    feat: support adding metrics relabeling config (#579)
---
 charts/apisix-ingress-controller/README.md                     | 3 ++-
 charts/apisix-ingress-controller/templates/servicemonitor.yaml | 1 +
 charts/apisix-ingress-controller/values.yaml                   | 3 +++
 charts/apisix/README.md                                        | 3 ++-
 charts/apisix/templates/service-monitor.yaml                   | 1 +
 charts/apisix/values.yaml                                      | 3 +++
 6 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/charts/apisix-ingress-controller/README.md 
b/charts/apisix-ingress-controller/README.md
index f35686a..e9736e5 100644
--- a/charts/apisix-ingress-controller/README.md
+++ b/charts/apisix-ingress-controller/README.md
@@ -159,7 +159,8 @@ The same for container level, you need to set:
 | serviceAccount.automountServiceAccountToken | bool | `true` | Whether 
automounting API credentials for a service account |
 | serviceAccount.create | bool | `true` | Specifies whether a ServiceAccount 
should be created |
 | serviceAccount.name | string | `""` | The name of the ServiceAccount to use. 
If not set and create is true, a name is generated using the fullname template |
-| serviceMonitor | object | 
`{"annotations":{},"enabled":false,"interval":"15s","labels":{},"namespace":"monitoring"}`
 | namespace: "ingress-apisix" |
+| serviceMonitor | object | 
`{"annotations":{},"enabled":false,"interval":"15s","labels":{},"metricRelabelings":{},"namespace":"monitoring"}`
 | namespace: "ingress-apisix" |
 | serviceMonitor.annotations | object | `{}` | @param 
serviceMonitor.annotations ServiceMonitor annotations |
 | serviceMonitor.labels | object | `{}` | @param serviceMonitor.labels 
ServiceMonitor extra labels |
+| serviceMonitor.metricRelabelings | object | `{}` | @param 
serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples 
before ingestion. ref: 
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
 |
 | tolerations | list | `[]` |  |
diff --git a/charts/apisix-ingress-controller/templates/servicemonitor.yaml 
b/charts/apisix-ingress-controller/templates/servicemonitor.yaml
index 1968d20..f8dd9dc 100644
--- a/charts/apisix-ingress-controller/templates/servicemonitor.yaml
+++ b/charts/apisix-ingress-controller/templates/servicemonitor.yaml
@@ -35,6 +35,7 @@ spec:
     {{- if .Values.serviceMonitor.interval }}
     interval: {{ .Values.serviceMonitor.interval }}
     {{- end }}
+    metricRelabelings: {{ .Values.serviceMonitor.metricRelabelings }}
   namespaceSelector:
     matchNames:
     - {{ template "apisix-ingress-controller.namespace" . }}
diff --git a/charts/apisix-ingress-controller/values.yaml 
b/charts/apisix-ingress-controller/values.yaml
index 8fcd598..266c828 100644
--- a/charts/apisix-ingress-controller/values.yaml
+++ b/charts/apisix-ingress-controller/values.yaml
@@ -173,6 +173,9 @@ serviceMonitor:
   labels: {}
   # -- @param serviceMonitor.annotations ServiceMonitor annotations
   annotations: {}
+  # -- @param serviceMonitor.metricRelabelings MetricRelabelConfigs to apply 
to samples before ingestion.
+  # ref: 
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
+  metricRelabelings: {}
 
 
 podSecurityContext: {}
diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 30e8201..58ae897 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -213,13 +213,14 @@ The command removes all the Kubernetes components 
associated with the chart and
 | serviceAccount.annotations | object | `{}` |  |
 | serviceAccount.create | bool | `false` |  |
 | serviceAccount.name | string | `""` |  |
-| serviceMonitor | object | 
`{"annotations":{},"containerPort":9091,"enabled":false,"interval":"15s","labels":{},"metricPrefix":"apisix_","name":"","namespace":"","path":"/apisix/prometheus/metrics"}`
 | Observability configuration. ref: 
https://apisix.apache.org/docs/apisix/plugins/prometheus/ |
+| serviceMonitor | object | 
`{"annotations":{},"containerPort":9091,"enabled":false,"interval":"15s","labels":{},"metricPrefix":"apisix_","metricRelabelings":{},"name":"","namespace":"","path":"/apisix/prometheus/metrics"}`
 | Observability configuration. ref: 
https://apisix.apache.org/docs/apisix/plugins/prometheus/ |
 | serviceMonitor.annotations | object | `{}` | @param 
serviceMonitor.annotations ServiceMonitor annotations |
 | serviceMonitor.containerPort | int | `9091` | container port where the 
metrics are exposed |
 | serviceMonitor.enabled | bool | `false` | Enable or disable Apache APISIX 
serviceMonitor |
 | serviceMonitor.interval | string | `"15s"` | interval at which metrics 
should be scraped |
 | serviceMonitor.labels | object | `{}` | @param serviceMonitor.labels 
ServiceMonitor extra labels |
 | serviceMonitor.metricPrefix | string | `"apisix_"` | prefix of the metrics |
+| serviceMonitor.metricRelabelings | object | `{}` | @param 
serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples 
before ingestion. ref: 
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
 |
 | serviceMonitor.name | string | `""` | name of the serviceMonitor, by 
default, it is the same as the apisix fullname |
 | serviceMonitor.namespace | string | `""` | namespace where the 
serviceMonitor is deployed, by default, it is the same as the namespace of the 
apisix |
 | serviceMonitor.path | string | `"/apisix/prometheus/metrics"` | path of the 
metrics endpoint |
diff --git a/charts/apisix/templates/service-monitor.yaml 
b/charts/apisix/templates/service-monitor.yaml
index b35b0d4..87f7ede 100644
--- a/charts/apisix/templates/service-monitor.yaml
+++ b/charts/apisix/templates/service-monitor.yaml
@@ -41,4 +41,5 @@ spec:
     targetPort: prometheus
     path: {{ .Values.serviceMonitor.path }}
     interval: {{ .Values.serviceMonitor.interval }}
+    metricRelabelings: {{ .Values.serviceMonitor.metricRelabelings }}
 {{- end }}
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 62d51d5..4603389 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -595,6 +595,9 @@ serviceMonitor:
   labels: {}
   # -- @param serviceMonitor.annotations ServiceMonitor annotations
   annotations: {}
+  # -- @param serviceMonitor.metricRelabelings MetricRelabelConfigs to apply 
to samples before ingestion.
+  # ref: 
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
+  metricRelabelings: {}
 
 # -- etcd configuration
 # use the FQDN address or the IP of the etcd

Reply via email to