Skip to content

Commit d83d5e0

Browse files
authored
fix(spectre): remove duplicate metrics service causing double scrape (#275)
* fix(spectre): remove duplicate metrics service causing double scrape The chart created two Services (spectre and spectre-metrics) both exposing port 9090 with the same selector labels. The ServiceMonitor matched both, producing two identical scrape jobs (spectre and spectre-metrics) with ~38.7K duplicate series. - Remove service-metrics.yaml (duplicate metrics-only service) - Add metrics port (9090) to default service.ports in values.yaml - Add metricRelabelings support to ServiceMonitor template - Bump chart version 0.3.4 → 0.3.5 * fix(spectre): skip metrics port in test-connection Metrics port 9090 is not available in CI kind cluster since spectre requires valid config/keys to start its metrics server. Only test the listen port for connectivity.
1 parent ec9888c commit d83d5e0

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

charts/spectre/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type: application
2222
# This is the chart version. This version number should be incremented each time you make changes
2323
# to the chart and its templates, including the app version.
2424
# Versions are expected to follow Semantic Versioning (https://semver.org/)
25-
version: 0.3.4
25+
version: 0.3.5
2626

2727
# This is the version number of the application being deployed. This version number should be
2828
# incremented each time you make changes to the application. Versions are not expected to

charts/spectre/templates/service-metrics.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

charts/spectre/templates/servicemonitor.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ spec:
3333
relabelings:
3434
{{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
3535
{{- end }}
36+
{{- if .Values.serviceMonitor.metricRelabelings }}
37+
metricRelabelings:
38+
{{- toYaml .Values.serviceMonitor.metricRelabelings | nindent 4 }}
39+
{{- end }}
3640
jobLabel: "{{ .Release.Name }}"
3741
selector:
3842
matchLabels:

charts/spectre/templates/tests/test-connection.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ spec:
1010
containers:
1111
{{- $serviceName := include "spectre.fullname" . }}
1212
{{- range $name, $config := .Values.service.ports }}
13+
{{- if ne $name "metrics" }}
1314
- name: nc-{{ $name }}
1415
image: busybox
1516
command: ['nc']
@@ -19,4 +20,5 @@ spec:
1920
- '{{ $serviceName }}'
2021
- '{{ $config.port }}'
2122
{{- end }}
23+
{{- end }}
2224
restartPolicy: Never

charts/spectre/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ securityContext: {}
102102
service:
103103
type: ClusterIP
104104
ports:
105+
metrics:
106+
port: 9090
107+
protocol: TCP
105108
listen:
106109
port: 8080
107110
protocol: TCP
@@ -184,6 +187,8 @@ serviceMonitor:
184187
scrapeTimeout: 60s
185188
# -- ServiceMonitor relabelings
186189
relabelings: []
190+
# -- ServiceMonitor metricRelabelings
191+
metricRelabelings: []
187192

188193
# -- Extra K8s manifests to deploy
189194
extraObjects: []

0 commit comments

Comments
 (0)