Skip to content

Add ElasticsearchProber

John Mason requested to merge john-mason-elastic-migrations-exporter into master

Exports GitLab specific Elasticsearch metrics.

For generic operational metrics of Elasticsearch, see elasticsearch_exporter. https://github.com/prometheus-community/elasticsearch_exporter.

REF: gitlab-org/gitlab#340437 (closed)

How this works

The prober searches for migrations and maps the inferred state to an enum.

MIGRATION_STATE_MAP = {
  unknown:  -9,
  # failed: -1, (TODO)
  pending:   0,
  running:   1,
  halted:    2,
  completed: 3
}

Running this locally

Step 1) Add to config/gitlab-exporter.yml:

probes:
  # ...
  elasticsearch: &elasticsearch
    methods:
      - probe_migrations
    opts:
      - url: http://localhost:9200

Step 2) Start the web exporter:

bin/gitlab-exporter web -c config/gitlab-exporter.yml

Step 3) View metrics

curl -s localhost:9168/elasticsearch 

Example:


➜  gitlab-development-kit git:(main) curl -s localhost:9168/elasticsearch
elasticsearch_migrations_info{state="completed",name="20201105181100"} 1
elasticsearch_migrations_info{state="completed",name="20201116142400"} 1
elasticsearch_migrations_info{state="completed",name="20201123123400"} 1
elasticsearch_migrations_info{state="completed",name="20210112165500"} 1
elasticsearch_migrations_info{state="completed",name="20210127154600"} 1
elasticsearch_migrations_info{state="completed",name="20210128163600"} 1
elasticsearch_migrations_info{state="completed",name="20210302104500"} 1
elasticsearch_migrations_info{state="completed",name="20210421140400"} 1
elasticsearch_migrations_info{state="completed",name="20210429154500"} 1
elasticsearch_migrations_info{state="completed",name="20210510113500"} 1
Edited by John Mason

Merge request reports

Loading