Enabling discovery

Lightbend Console relies on Prometheus discovery for finding your application metric data. The following section describes how to do this by annotating Kubernetes resources.

Kubernetes annotations

To enable Lightbend Console to discover your workloads, you need to modify the PodSpec of the Kubernetes Deployment or similar resource so that Prometheus can determine how to scrape the metrics. Prometheus will scrape all named ports on a pod where the port name ends with metrics.

Named ports annotation example

Note that:

  • the port names end in metrics
  • the prometheus.io/port annotation is unset
  • the prometheus.io/scrape annotation is set to the string "true"
spec:
  template:
    metadata:
      annotations:
        prometheus.io/scrape: 'true'
    spec:
      containers:
      - name: multiple-metric-ports
        ports:
        - containerPort: 9001
          name: first-metrics
        - containerPort: 9002
          name: second-metrics

You can also use the prometheus.io/port annotation to tell Prometheus to scrape the port(s). In this case the port name doesn’t matter.

prometheus.io/port annotation example

spec:
  template:
    metadata:
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '9001'