promhippie / github_exporter

Prometheus exporter for GitHub
https://promhippie.github.io/github_exporter/
Apache License 2.0
93 stars 13 forks source link

Custom workflow labels #339

Open al-vovk opened 2 weeks ago

al-vovk commented 2 weeks ago

Hi there, is there any way to add custom labels to workflow metrics?

I was using this (https://promhippie.github.io/github_exporter/#getting-started) reference doc to set the exporter, and it mentioned the following ENV variable:

GITHUB_EXPORTER_WORKFLOWS_LABELS
List of labels used for workflows, comma-separated list, defaults to owner, repo, workflow, event, name, status, branch, number, run

Is it possible to enrich the default set of labels, or is this ENV variable there to reduce cardinality?

I would like to tie the runner_name from the webhook payload to the workflow metrics to gain insight into our self-hosted runner's usage.

tboerger commented 2 weeks ago

Generally this variable exist to reduce cardinality, but it could also get extended.

This list of available labels is defined at https://github.com/promhippie/github_exporter/blob/master/pkg/config/config.go#L93 while the mapping is handled by https://github.com/promhippie/github_exporter/blob/master/pkg/store/types.go#L27.

If the webhook parses more flags and stores it within the database this could be extended to get mapped.