Integrate with Prometheus

To allow Prometheus to scrape KVInsight metrics, add a scrape configuration to your prometheus.yml file. Use one of the two approaches given below:

Approach 1: Static Targets

Use this approach when the set of Storage Nodes is relatively stable.
scrape_configs:
  - job_name: "nosql"
    metrics_path: /metrics
    scheme: http
    honor_labels: true
    static_configs:
      - targets:
          - sn1.example.com:<port>
          - sn2.example.com:<port>
          - sn3.example.com:<port>

Approach 2: File-based (recommended for dynamic environments)

Use this approach when Storage Nodes may be added or removed over time.
scrape_configs:
  - job_name: "nosql"
    metrics_path: /metrics
    scheme: http
    honor_labels: true
    file_sd_configs:
      - files:
          - /etc/prometheus/targets/kvinsight-sn.json
        refresh_interval: 30s
Create or update the targets file (example: ./prometheus/targets/kvinsight-sn.json)
[
  { "targets": ["sn1.example.com:<port>"] },
  { "targets": ["sn2.example.com:<port>"] },
  { "targets": ["sn3.example.com:<port>"] }
]
KVInsight exports labels (for example, application and service_name) that are used for filtering and dashboards. Setting honor_labels: true helps ensure Prometheus preserves these labels as provided by the Storage Node.

For more information, refer to the Prometheus Documentation.