diff --git a/manifests/computeservice.yaml b/manifests/computeservice.yaml index 378e34b9b4345a3a65f848dbd7a3b3e3753b8a05..3e3b041ab20968ad0010eb06f7900faa7b649dc9 100644 --- a/manifests/computeservice.yaml +++ b/manifests/computeservice.yaml @@ -34,6 +34,7 @@ spec: ports: - containerPort: 8080 - containerPort: 9090 + - containerPort: 9192 env: - name: LOG_LEVEL value: "INFO" @@ -70,3 +71,7 @@ spec: protocol: TCP port: 9090 targetPort: 9090 + - name: metrics + protocol: TCP + port: 9192 + targetPort: 9192 diff --git a/manifests/servicemonitors.yaml b/manifests/servicemonitors.yaml index 3d38d59603918b7ea35004e580e21b8a03ce2878..f5da08182a4665b21607987ea97d9bf3cc5b7e21 100644 --- a/manifests/servicemonitors.yaml +++ b/manifests/servicemonitors.yaml @@ -301,3 +301,32 @@ spec: any: false matchNames: - tfs # namespace where the app is running +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + namespace: monitoring # namespace where prometheus is running + name: tfs-computeservice-metric + labels: + app: computeservice + #release: prometheus + #release: prom # name of the release + # ( VERY IMPORTANT: You need to know the correct release name by viewing + # the servicemonitor of Prometheus itself: Without the correct name, + # Prometheus cannot identify the metrics of the Flask app as the target.) +spec: + selector: + matchLabels: + # Target app service + #namespace: tfs + app: computeservice # same as above + #release: prometheus # same as above + endpoints: + - port: metrics # named port in target app + scheme: http + path: /metrics # path to scrape + interval: 5s # scrape interval + namespaceSelector: + any: false + matchNames: + - tfs # namespace where the app is running