elasticsearch_exporter/pkg
Aaron Delaney 1d5d44be41
collector: add tasks API collection (#778)
* collector: add tasks API collection

This commit adds simple aggregation of Elasticsearch Tasks API.
There are 4 new metrics; though 3 are just bookkeeping.

elasticsearch_task_stats_action_total is a gague reporting the total
number of tasks running for a given action. Because there are no stats
endpoints available for this, this change introduces an aggregation step
to group the number of tasks by action name.

This metric is useful for ensuring long running actions of a specific
kind stay within a specific limit. Of particular use to me is
the action: 'indices:data/write/delete/byquery'.

In my usecase, our ES access patterns mean we have a predefined limit
of these actions running on the cluster.

This change also adds two new CLI flags to manage the collection of tasks API:

	--es.tasks (to enable task collection)
	--es.tasks.actions (to filter tasks by action param)

Issue #525 proposed addition of collection of these tasks.

Signed-off-by: Aaron Delaney <apd@arista.com>

* collector: use collector interface for tasks

Signed-off-by: Aaron Delaney <apd@arista.com>

* all: fix issues reported by golangci-lint

Signed-off-by: Aaron Delaney <apd@arista.com>

* collector: make task structs private to package

Signed-off-by: Aaron Delaney <apd@arista.com>

* Fix task stats metric name

Signed-off-by: Aaron Delaney <apd@arista.com>

* Fix tasks test

Signed-off-by: Aaron Delaney <apd@arista.com>

---------

Signed-off-by: Aaron Delaney <apd@arista.com>
2024-03-13 22:26:39 -04:00
..
clusterinfo collector: add tasks API collection (#778) 2024-03-13 22:26:39 -04:00
roundtripper Update build and cleanup 2023-03-23 09:51:33 +01:00