Skip to content

Commit

Permalink
[eth-tx-summary-api] Adding metrics config
Browse files Browse the repository at this point in the history
  • Loading branch information
nzenchik committed Jun 5, 2024
1 parent 9da7ec1 commit 493d458
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/eth-tx-summary-api/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.1.0
version: 0.2.0

# 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
9 changes: 9 additions & 0 deletions charts/eth-tx-summary-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,22 @@ spec:
value: {{ .Values.service.port | quote }}
- name: DEFAULT_LOG_LEVEL
value: {{ .Values.config.logLevel | quote }}
{{- if .Values.metrics.enabled }}
- name: METRICS_PORT
values: {{ .Values.metrics.port | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "eth-tx-summary-api.fullname" . }}-env
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.port }}
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
path: /health
Expand Down
19 changes: 19 additions & 0 deletions charts/eth-tx-summary-api/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.metrics.prometheus.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "eth-tx-summary-api.fullname" . }}
labels:
{{- include "eth-tx-summary-api.labels" . | nindent 4 }}
spec:
endpoints:
- scrapeTimeout: 30s
port: metrics
path: /metrics
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "eth-tx-summary-api.fullname" . }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/eth-tx-summary-api/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ spec:
targetPort: http
protocol: TCP
name: http
{{- if .Values.metrics.enabled }}
- port: {{ .Values.metrics.port }}
targetPort: metrics
protocol: TCP
name: metrics
{{- end }}
selector:
{{- include "eth-tx-summary-api.selectorLabels" . | nindent 4 }}
6 changes: 6 additions & 0 deletions charts/eth-tx-summary-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ resources: {}
# cpu: 100m
# memory: 128Mi

metrics:
enabled: false
port: 9105
prometheus:
enabled: false

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
Expand Down

0 comments on commit 493d458

Please sign in to comment.