diff --git a/charts/tencentcloud-info-exporter/Chart.yaml b/charts/tencentcloud-info-exporter/Chart.yaml index ad989a6..88a8889 100644 --- a/charts/tencentcloud-info-exporter/Chart.yaml +++ b/charts/tencentcloud-info-exporter/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.2 +version: 0.2.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/tencentcloud-info-exporter/templates/scrapeconfig.yaml b/charts/tencentcloud-info-exporter/templates/scrapeconfig.yaml new file mode 100644 index 0000000..dbc1227 --- /dev/null +++ b/charts/tencentcloud-info-exporter/templates/scrapeconfig.yaml @@ -0,0 +1,23 @@ +{{- if .Values.scrapeConfig.enabled }} +apiVersion: monitoring.coreos.com/v1alpha1 +kind: ScrapeConfig +metadata: + labels: +{{ include "tencentcloud-info-exporter.labels" . | indent 4 }} + name: {{ template "tencentcloud-info-exporter.fullname" . }} +spec: + staticConfigs: + - targets: + - {{ include "tencentcloud-info-exporter.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.port }} + metricsPath: {{ .Values.scrapeConfig.telemetryPath }} +{{- if .Values.scrapeConfig.relabelings }} + relabelings: +{{ toYaml .Values.scrapeConfig.relabelings | indent 4 }} +{{- end }} +{{- if .Values.scrapeConfig.metricRelabelings }} + metricRelabelings: +{{ toYaml .Values.scrapeConfig.metricRelabelings | indent 4 }} +{{- end }} + scrapeInterval: {{ .Values.scrapeConfig.interval }} + scrapeTimeout: {{ .Values.scrapeConfig.timeout }} +{{- end }} diff --git a/charts/tencentcloud-info-exporter/values.yaml b/charts/tencentcloud-info-exporter/values.yaml index 79f5b6e..dce87f3 100644 --- a/charts/tencentcloud-info-exporter/values.yaml +++ b/charts/tencentcloud-info-exporter/values.yaml @@ -108,6 +108,22 @@ serviceMonitor: # targetLabels: [] # metricRelabelings: [] +scrapeConfig: + # Use https://prometheus-operator.dev/docs/user-guides/scrapeconfig/ to congfigure scrapeConfig + # It is advbised to use scrapeConfig instead of servicemonitor, as it is more flexible + # ServiceMonitor and scrapeConfig can be enabled at the same time, but it is not recommended + # When set true then use a ScrapeConfig to configure scraping + enabled: false + timeout: 10s + interval: 1m + telemetryPath: /metrics + relabelings: + - regex: 'container|endpoint|pod|service|instance' + action: "labeldrop" + metricRelabelings: + - regex: 'instance' + action: "labeldrop" + ## Custom PrometheusRules to be defined ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions