Skip to content

Commit caea647

Browse files
feat(helm): Add prometheus servicemonitor to medcat-service-helm (#67)
1 parent 4b056ff commit caea647

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

helm-charts/medcat-service-helm/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ You should see the NVIDIA GPU device listing if the GPU is properly accessible.
132132
| autoscaling.minReplicas | int | `1` | |
133133
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
134134
| env.APP_ENABLE_DEMO_UI | bool | `true` | |
135-
| env.APP_ENABLE_METRICS | bool | `false` | Observability Env Vars |
135+
| env.APP_ENABLE_METRICS | bool | `true` | Observability Env Vars |
136136
| env.APP_ENABLE_TRACING | bool | `false` | |
137137
| env.APP_MEDCAT_MODEL_PACK | string | `"/cat/models/examples/example-medcat-v2-model-pack.zip"` | This defines the Model Pack used by the medcat service Example (download on startup): uncomment `ENABLE_MODEL_DOWNLOAD` and the `MODEL_*` URLs below. Example (DeID mode): uncomment `DEID_MODE`/`DEID_REDACT` and use the DeID model pack referenced below. |
138138
| env.OTEL_EXPERIMENTAL_RESOURCE_DETECTORS | string | `"containerid,os"` | |
@@ -184,6 +184,12 @@ You should see the NVIDIA GPU device listing if the GPU is properly accessible.
184184
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
185185
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
186186
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
187+
| serviceMonitor | object | `{"enabled":false,"interval":"10s","labels":{},"path":"/metrics","scheme":"http","tlsConfig":{}}` | Create a Prometheus ServiceMonitor for the medcat service. Requires the Prometheus Operator to be installed Ensure APP_ENABLE_METRICS is set to true to expose the /metrics endpoint. |
188+
| serviceMonitor.enabled | bool | `false` | Set to true to enable creation of a ServiceMonitor resource |
189+
| serviceMonitor.interval | string | `"10s"` | Frequency at which Prometheus will scrape metrics. |
190+
| serviceMonitor.labels | object | `{}` | Additional labels to be added to the ServiceMonitor |
191+
| serviceMonitor.path | string | `"/metrics"` | HTTP path where metrics are exposed. |
192+
| serviceMonitor.scheme | string | `"http"` | Scheme to use for scraping. |
187193
| startupProbe.failureThreshold | int | `30` | |
188194
| startupProbe.httpGet.path | string | `"/api/health/ready"` | |
189195
| startupProbe.httpGet.port | string | `"http"` | |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- if .Values.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "medcat-service.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "medcat-service.labels" . | nindent 4 }}
9+
{{- with .Values.serviceMonitor.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
selector:
14+
matchLabels:
15+
{{- include "medcat-service.selectorLabels" . | nindent 6 }}
16+
endpoints:
17+
- port: http
18+
interval: {{ .Values.serviceMonitor.interval }}
19+
path: {{ .Values.serviceMonitor.path }}
20+
scheme: {{ .Values.serviceMonitor.scheme }}
21+
{{- with .Values.serviceMonitor.tlsConfig }}
22+
tlsConfig:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
{{- end }}

helm-charts/medcat-service-helm/values.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ env:
5555
# APP_TORCH_THREADS: "-1"
5656

5757
# -- Observability Env Vars
58-
APP_ENABLE_METRICS: false
58+
APP_ENABLE_METRICS: true
5959
APP_ENABLE_TRACING: false
6060
OTEL_EXPORTER_OTLP_ENDPOINT: "http://<unused>:4317"
6161
OTEL_SERVICE_NAME: "medcat-service"
@@ -252,3 +252,18 @@ extraInitContainers: []
252252

253253
# -- Additional manifests to deploy to kubernetes. Can be templated
254254
extraManifests: []
255+
256+
# -- Create a Prometheus ServiceMonitor for the medcat service. Requires the Prometheus Operator to be installed
257+
# Ensure APP_ENABLE_METRICS is set to true to expose the /metrics endpoint.
258+
serviceMonitor:
259+
# -- Set to true to enable creation of a ServiceMonitor resource
260+
enabled: false
261+
# -- HTTP path where metrics are exposed.
262+
path: /metrics
263+
# -- Scheme to use for scraping.
264+
scheme: http
265+
# -- Frequency at which Prometheus will scrape metrics.
266+
interval: 10s
267+
# -- Additional labels to be added to the ServiceMonitor
268+
labels: {}
269+
tlsConfig: {}

0 commit comments

Comments
 (0)