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

Geth: enable prometheus metric on start-geth + service monitor template #151

Merged
merged 9 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/rollup/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.7.8
version: 0.7.9

# 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
4 changes: 3 additions & 1 deletion charts/rollup/files/scripts/start-geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ exec geth --datadir $data_dir/ --networkid=$evm_network_id \
--http --http.addr "0.0.0.0" --http.port $executor_host_http_port --http.corsdomain='*' --http.vhosts "*" --http.api eth,net,web3,debug,txpool \
--ws --ws.addr "0.0.0.0" --ws.port $executor_host_ws_port --ws.origins='*' \
--grpc --grpc.addr "0.0.0.0" --grpc.port $executor_host_grpc_port \
{{ if .Values.config.rollup.archiveNode }}--gcmode "archive" --txlookuplimit "0" {{- end }}
{{ if .Values.config.rollup.archiveNode }}--gcmode "archive" --txlookuplimit "0" {{- end }} \
{{ if .Values.config.rollup.metrics.enabled }} --metrics --metrics.addr "0.0.0.0" --metrics.port {{ .Values.ports.metrics }} {{- end }}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have some spaces on this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed you were correct between 0" --metrics

24 changes: 24 additions & 0 deletions charts/rollup/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "rollup.name" -}}
{{- default .Values.config.rollup.name | trunc 63 | trimSuffix "-" }}-astria-dev-cluster
{{- end }}

{{/*
Common labels
*/}}
{{- define "rollup.labels" -}}
{{ include "rollup.selectorLabels" . }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have the seperate labels if it just includes selector labels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary, just makes easy to merge both if we have complicated labels or selector

{{- end }}

{{/*
Selector labels
*/}}
{{- define "rollup.selectorLabels" -}}
app: {{ include "rollup.name" . }}
name: geth-metrics
{{- end }}



{{/*
Return if ingress is stable.
*/}}
Expand Down
4 changes: 4 additions & 0 deletions charts/rollup/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ spec:
name: ws-rpc
- containerPort: {{ .Values.ports.executionGRPC }}
name: execution-grpc
{{- if .Values.config.rollup.metrics.enabled }}
- containerPort: {{ .Values.ports.metrics }}
name: geth-metrics
{{- end }}
- name: composer
image: {{ .Values.images.composer }}
command: [ "/usr/local/bin/astria-composer" ]
Expand Down
15 changes: 15 additions & 0 deletions charts/rollup/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ spec:
- name: blockscout-svc
port: {{ .Values.ports.blockscout }}
targetPort: blockscout
---
{{- if .Values.config.rollup.metrics.enabled }}
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.config.rollup.name }}-metrics
namespace: {{ .Values.global.namespace }}
spec:
selector:
app: {{ .Values.config.rollup.name }}-astria-dev-cluster
ports:
- name: geth-metrics
port: {{ .Values.ports.metrics }}
targetPort: geth-metrics
{{- end }}
28 changes: 28 additions & 0 deletions charts/rollup/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.config.rollup.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: geth-metrics
labels:
{{- include "rollup.labels" . | nindent 4 }}
{{- with .Values.config.rollup.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: geth-metrics
namespaceSelector:
matchNames:
- {{ .Values.global.namespace }}
selector:
matchLabels:
app: {{ .Values.config.rollup.name }}-astria-dev-cluster
endpoints:
- port: {{ .Values.config.rollup.serviceMonitor.port }}
path: /debug/metrics/prometheus
{{- with .Values.config.rollup.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.config.rollup.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ config:
# The block height of the Ethereum L1 chain that the
# OptimismPortal contract was deployed at.
initialEthereumL1BlockHeight: 1
metrics:
# set to enable prometheus metrics
enabled: false
serviceMonitor:
# set to enable port svc and service monitor
enabled: false
port: 6060
additionalLabels:
release: kube-prometheus-stack

faucet:
proxyCount: 1
Expand Down Expand Up @@ -219,3 +228,4 @@ ports:
gossipnet: 2451
faucet: 8080
blockscout: 4000
metrics: 6060