feat(api): Prometheus metrics for operators
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m23s
ci / test (pull_request) Successful in 12m59s
ci / build (pull_request) Canceled after 7m17s
ci / image (pull_request) Canceled after 0s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m23s
ci / test (pull_request) Successful in 12m59s
ci / build (pull_request) Canceled after 7m17s
ci / image (pull_request) Canceled after 0s
The API serves Prometheus metrics on a listener of its own (UPTIME_API_METRICS_LISTEN, default :9090, "off" disables it), so the public ingress never exposes them: - requests by route and status, with durations except for long polls and agent streams - dispatched checks, stored and rejected results per region, how late results arrive, live checkers and overdue checks per platform region - notification and subscriber mail deliveries, incidents opened and resolved - runs, duration and last success of the background jobs - platform totals (orgs, users, monitors by type, status pages, subscribers, open incidents, pending notifications), read at most every 15 seconds when scraped - the Postgres and Redis connection pools, Go runtime and build info The Helm chart exposes the port on the API service and can add a ServiceMonitor for the Prometheus Operator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
ab25c1f218
commit
e9984f8271
30 files changed
+1005
-20
No files matched your search
@@ -63,9 +63,15 @@ spec:
|
||||
args: [serve]
|
||||
env:
|
||||
{{- include "uptimesebi.platformEnv" (list . $secret) | nindent 12 }}
|
||||
- name: UPTIME_API_METRICS_LISTEN
|
||||
value: {{ if .Values.api.metrics.enabled }}{{ printf ":%v" .Values.api.metrics.port | quote }}{{ else }}"off"{{ end }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
{{- if .Values.api.metrics.enabled }}
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.api.metrics.port }}
|
||||
{{- end }}
|
||||
startupProbe:
|
||||
httpGet: {path: /healthz, port: http}
|
||||
periodSeconds: 2
|
||||
@@ -113,6 +119,11 @@ spec:
|
||||
- name: http
|
||||
port: {{ .Values.api.service.port }}
|
||||
targetPort: http
|
||||
{{- if .Values.api.metrics.enabled }}
|
||||
- name: metrics
|
||||
port: {{ .Values.api.metrics.port }}
|
||||
targetPort: metrics
|
||||
{{- end }}
|
||||
{{- if and .Values.api.podDisruptionBudget.enabled (gt (int .Values.api.replicas) 1) }}
|
||||
---
|
||||
apiVersion: policy/v1
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.api.metrics.enabled .Values.api.metrics.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "uptimesebi.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
{{- with .Values.api.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "uptimesebi.selector" (list . "api") | nindent 6 }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
interval: {{ .Values.api.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
@@ -126,6 +126,17 @@ api:
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
# Prometheus metrics on a port of their own, which the ingress never
|
||||
# exposes.
|
||||
metrics:
|
||||
enabled: true
|
||||
port: 9090
|
||||
# A ServiceMonitor for the Prometheus Operator (kube-prometheus-stack).
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
interval: 30s
|
||||
# Extra labels, for a Prometheus that selects ServiceMonitors by label.
|
||||
labels: {}
|
||||
# The API image is built for amd64 only; checkers and status page servers
|
||||
# run on arm64 and 32-bit ARM too. Also used by the migration job.
|
||||
nodeSelector:
|
||||
|
||||
Reference in new issue
Block a user