Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Cometbft: enable prometheus exporter (#149)
Browse files Browse the repository at this point in the history
Co-authored-by: WafflesVonMaple <scott@astria.org>
  • Loading branch information
WafflesVonMaple and WafflesVonMaple authored Jan 9, 2024
1 parent cd95329 commit 56d229d
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/sequencer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/sequencer/files/cometbft/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 23 additions & 0 deletions charts/sequencer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
14 changes: 14 additions & 0 deletions charts/sequencer/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
28 changes: 28 additions & 0 deletions charts/sequencer/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
4 changes: 4 additions & 0 deletions charts/sequencer/templates/statefulsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions charts/sequencer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 56d229d

Please sign in to comment.