diff --git a/charts/sequencer/Chart.yaml b/charts/sequencer/Chart.yaml index 77956f3..4201656 100644 --- a/charts/sequencer/Chart.yaml +++ b/charts/sequencer/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.8.4 +version: 0.8.5 # 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/sequencer/files/cometbft/config/config.toml b/charts/sequencer/files/cometbft/config/config.toml index f28706e..d7e410a 100644 --- a/charts/sequencer/files/cometbft/config/config.toml +++ b/charts/sequencer/files/cometbft/config/config.toml @@ -456,7 +456,7 @@ psql-conn = "" # When true, Prometheus metrics are served under /metrics on # PrometheusListenAddr. # Check out the documentation for the list of available metrics. -prometheus = false +prometheus = true # Address to listen for Prometheus collector(s) connections prometheus_listen_addr = ":26660" diff --git a/charts/sequencer/templates/_helpers.tpl b/charts/sequencer/templates/_helpers.tpl index d6e21c6..d330515 100644 --- a/charts/sequencer/templates/_helpers.tpl +++ b/charts/sequencer/templates/_helpers.tpl @@ -30,3 +30,26 @@ Return the appropriate apiVersion for ingress. {{- print "extensions/v1beta1" }} {{- end }} {{- end }} + + +{{/* +Expand the name of the chart. +*/}} +{{- define "sequencer.name" -}} +{{- default .Values.config.moniker | trunc 63 | trimSuffix "-" }}-sequencer +{{- end }} + +{{/* +Common labels +*/}} +{{- define "sequencer.labels" -}} +{{ include "sequencer.selectorLabels" . }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "sequencer.selectorLabels" -}} +app: {{ include "sequencer.name" . }} +name: {{ .Values.config.moniker }}-sequencer-metrics +{{- end }} diff --git a/charts/sequencer/templates/service.yaml b/charts/sequencer/templates/service.yaml index 574f68e..8842a92 100644 --- a/charts/sequencer/templates/service.yaml +++ b/charts/sequencer/templates/service.yaml @@ -34,3 +34,17 @@ spec: type: NodePort {{- end }} --- +{{- if .Values.serviceMonitor.enabled }} +kind: Service +apiVersion: v1 +metadata: + name: {{ .Values.config.moniker }}-sequencer-metrics + namespace: {{ .Values.global.namespace }} +spec: + selector: + app: {{ .Values.config.moniker }}-sequencer + ports: + - name: cometbft-metrics + port: {{ .Values.ports.cometBFTMETRICS }} + targetPort: cometbft-metrics +{{- end }} diff --git a/charts/sequencer/templates/servicemonitor.yaml b/charts/sequencer/templates/servicemonitor.yaml new file mode 100644 index 0000000..8340ffc --- /dev/null +++ b/charts/sequencer/templates/servicemonitor.yaml @@ -0,0 +1,28 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: cometbft-metrics + labels: + {{- include "sequencer.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + jobLabel: cometbft-metrics + namespaceSelector: + matchNames: + - {{ .Values.global.namespace }} + selector: + matchLabels: + {{- include "sequencer.selectorLabels" . | nindent 6 }} + endpoints: + - port: {{ .Values.serviceMonitor.port }} + path: /metrics + {{- with .Values.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} +{{- end }} diff --git a/charts/sequencer/templates/statefulsets.yaml b/charts/sequencer/templates/statefulsets.yaml index 0d92505..0e981ee 100644 --- a/charts/sequencer/templates/statefulsets.yaml +++ b/charts/sequencer/templates/statefulsets.yaml @@ -66,6 +66,10 @@ spec: name: cometbft-p2p - containerPort: {{ .Values.ports.cometBFTRPC }} name: cometbft-rpc + {{- if .Values.serviceMonitor.enabled }} + - containerPort: {{ .Values.ports.cometBFTMETRICS }} + name: cometbft-metrics + {{- end }} volumes: - name: cometbft-config-volume configMap: diff --git a/charts/sequencer/values.yaml b/charts/sequencer/values.yaml index 82ed72d..b881d0b 100644 --- a/charts/sequencer/values.yaml +++ b/charts/sequencer/values.yaml @@ -80,9 +80,17 @@ images: ports: cometBFTP2P: 26656 cometBFTRPC: 26657 + cometBFTMETRICS: 26660 sequencerABCI: 26658 relayerRPC: 2450 +# ServiceMonitor configuration +serviceMonitor: + enabled: false + port: 26660 + additionalLabels: + release: kube-prometheus-stack + storage: enabled: false local: true