Skip to content
Snippets Groups Projects

Implementation of OpenMetrics

Merged Silversthorn requested to merge feature/openmetrics-implementation into dev

What does this MR do and why?

Adds metrics endpoints that provides OpenMetrics Compliant Data, for use with such products as Prometheus. Base set of metrics, any additional will be done on a per-request basis.

Screenshots or screen recordings

/metrics/
image

/metrics/servers/1/ (Number defining server id)
image

How to set up and validate locally

via terminal

export METRICS_TOKEN=<api_key>

curl -k https://<ip>:8443/metrics/?token=$METRICS_TOKEN            # Requires super user api key.
curl -k https://<ip>:8443/metrics/host/?token=$METRICS_TOKEN       # Requires super user api key.
curl -k https://<ip>:8443/metrics/servers/1/?token=$METRICS_TOKEN  # Requires super user or api key created by user with role for server.

via Prometheus

  - job_name: 'Crafty-metrics'
    scrape_interval: 1s
    static_configs:
      - targets:
          - '<ip>:8443'
    metrics_path: '/metrics/'
    params:
      token: ['token goes here']
    scheme: 'https'
    tls_config:
      insecure_skip_verify: true # If using crafty self signed

  - job_name: 'Crafty-host-metrics'
    scrape_interval: 1s
    static_configs:
      - targets:
          - '<ip>:8443'
    metrics_path: '/metrics/host/'
    params:
      token: ['token goes here']
    scheme: 'https'
    tls_config:
      insecure_skip_verify: true # If using crafty self signed

  - job_name: 'Crafty-server-metrics-1'
    scrape_interval: 1s
    static_configs:
      - targets:
          - '<ip>:8443'
    metrics_path: '/metrics/servers/1/' # UUID would be nice
    params:
      token: ['token goes here']
    scheme: 'https'
    tls_config:
      insecure_skip_verify: true # If using crafty self signed

Then use prometheus as as data source in Grafana, where you can use the metrics explorer to discover values.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • Have you checked this doesn't interfere/conflict/duplicate someone elses work?
  • Have you fully tested your changes?
  • Have you resolved any lint issues?
  • Have you assigned a reviewer?
  • Have you applied correct labels?
Edited by Iain Powrie

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading