M
M
mazt_ser2021-05-14 17:04:37
Java
mazt_ser, 2021-05-14 17:04:37

How to monitor Java application data in prometheus deployed in openshift?

There is a variable in the program:

static final Counter exampleCounter = Counter.build()
            .name("exampleCounter")
            .help("example counter")
            .register();

Through timer.schedule() it increments once in a while.

There is get mapping, through which I checked that everything works. But I want to see a graph of changes in this data.

prometheus settings for openshift:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    k8s-app: prometheus-example-monitor
  name: prometheus-example-monitor
  namespace: ns1
spec:
  endpoints:
  - interval: 30s
    port: web
    scheme: http
  selector:
    matchLabels:
      app: prometheus-example-app

But I can't find the data I need in the program itself. What exactly is the problem? What request should be when asking the value of the metrics?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question