Skip to content

Commit

Permalink
Add metrics port (#125)
Browse files Browse the repository at this point in the history
* Add metrics port to headless service

https://docs.graylog.org/docs/metrics 
indicates that metrics for Prometheus are now provided on port 9833 if enabled
So if metrics are enabled we need to advertise this endpoint.
Might as well use the headless service so we always get all the nodes info

* change back the name property

Oops changed the name of the service monitor when I didn't mean to.

* Change to the name of a port that is advertized in the serviec

prometheus-operator/prometheus-operator#2515
describes how serviceMonitors port specifications have been confusing
port is now string only, so we cannot use an int to refer to the port.
Lets use a name that we declare when we create the headless Service

* to be clear specify targetPort

* expose the metrics port if enabled

* use the standard selector lables like the rest of the chart

Signed-off-by: Ken Hahn <[email protected]>

* Bumping the version

Signed-off-by: Ken Hahn <[email protected]>
  • Loading branch information
yokhahn authored Aug 30, 2022
1 parent 6564595 commit edbbe03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/graylog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: graylog
home: https://www.graylog.org
version: 2.1.4
version: 2.1.5
appVersion: 4.2.7
description: Graylog is the centralized log management solution built to open standards for capturing, storing, and enabling real-time analysis of terabytes of machine data.
keywords:
Expand Down
5 changes: 5 additions & 0 deletions charts/graylog/templates/headless-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ spec:
ports:
- name: graylog
port: 9000
{{- if .Values.graylog.metrics.enabled }}
- name: metrics
port: 9833
targetPort: 9833
{{- end }}
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
Expand Down
5 changes: 2 additions & 3 deletions charts/graylog/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- end }}
spec:
endpoints:
- port: 9833
- port: metrics
path: /metrics
{{- if .Values.graylog.metrics.serviceMonitor.interval }}
interval: {{ .Values.graylog.metrics.serviceMonitor.interval }}
Expand All @@ -24,6 +24,5 @@ spec:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "graylog.fullname" . }}
release: {{ .Release.Name }}
{{ include "graylog.selectorLabels" . | indent 6 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/graylog/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ spec:
ports:
- containerPort: 9000
name: graylog
{{- if .Values.graylog.metrics.enabled }}
- containerPort: 9833
name: metrics
{{- end }}
{{- range .Values.graylog.service.ports }}
- containerPort: {{ .port }}
name: {{ .name}}
Expand Down

0 comments on commit edbbe03

Please sign in to comment.