Skip to content

Commit

Permalink
[LocalNet] Fix metrics scraping (#940)
Browse files Browse the repository at this point in the history
## Description

Fixes metrics scraping on LocalNet.

After quite a few changes to the LocalNet infrastructure, the metrics collection appeared broken on LocalNet.

<!-- reviewpad:summarize:start -->
### Summary generated by Reviewpad on 26 Jul 23 21:58 UTC
This pull request fixes the issue with metrics scraping on LocalNet. It updates the Tiltfile and statefulset.yaml files to add pod annotations for Prometheus scraping and specify the port for scraping.
<!-- reviewpad:summarize:end -->

## List of changes

- Changed `podAnnotations` helm chart value to always "quote" values in case they are not strings (K8s API expects strings only in annotations)
- Added annotations necessary for scraping of exporter endpoints by Prometheus on LocalNet
  • Loading branch information
okdas authored and red-0ne committed Aug 2, 2023
1 parent e0e9fd4 commit 2a226cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 8 additions & 0 deletions build/localnet/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ for x in range(localnet_config["validators"]["count"]):
"genesis.externalConfigMap.name=v1-localnet-genesis",
"genesis.externalConfigMap.key=genesis.json",
"postgresql.primary.persistence.enabled=false",
"podAnnotations.prometheus\\.io/scrape=true",
"podAnnotations.prometheus\\.io/port=9000",
"nodeType=validator",
],
values=[chart_dir + "/pocket-validator-overrides.yaml"] if os.path.exists(chart_dir + "/pocket-validator-overrides.yaml") else [],))
Expand All @@ -213,6 +215,8 @@ for x in range(localnet_config["servicers"]["count"]):
"genesis.externalConfigMap.name=v1-localnet-genesis",
"genesis.externalConfigMap.key=genesis.json",
"postgresql.primary.persistence.enabled=false",
"podAnnotations.prometheus\\.io/scrape=true",
"podAnnotations.prometheus\\.io/port=9000",
"config.servicer.enabled=true",
"nodeType=servicer",
],
Expand All @@ -237,6 +241,8 @@ for x in range(localnet_config["fishermen"]["count"]):
"genesis.externalConfigMap.name=v1-localnet-genesis",
"genesis.externalConfigMap.key=genesis.json",
"postgresql.primary.persistence.enabled=false",
"podAnnotations.prometheus\\.io/scrape=true",
"podAnnotations.prometheus\\.io/port=9000",
"config.fisherman.enabled=true",
"nodeType=fisherman",
],
Expand All @@ -261,6 +267,8 @@ for x in range(localnet_config["full_nodes"]["count"]):
"genesis.externalConfigMap.name=v1-localnet-genesis",
"genesis.externalConfigMap.key=genesis.json",
"postgresql.primary.persistence.enabled=false",
"podAnnotations.prometheus\\.io/scrape=true",
"podAnnotations.prometheus\\.io/port=9000",
"nodeType=full",
],
values=[chart_dir + "/pocket-full-node-overrides.yaml"] if os.path.exists(chart_dir + "/pocket-full-node-overrides.yaml") else [],))
Expand Down
11 changes: 6 additions & 5 deletions charts/pocket/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pocket.fullname" . }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "pocket.labels" . | nindent 4 }}
spec:
Expand All @@ -17,10 +13,15 @@ spec:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels:
{{- include "pocket.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down

0 comments on commit 2a226cc

Please sign in to comment.