Skip to content

Conversation

jooola
Copy link
Contributor

@jooola jooola commented Apr 28, 2025

Allows to filter the servers when sending the listing request to the API. This feature is only available when using the role=hcloud.

See https://docs.hetzner.cloud/#label-selector for details on how to use the label selector.

@jooola jooola force-pushed the hetzner-label-selector branch 2 times, most recently from 2e28fdb to 873cf52 Compare April 28, 2025 15:13
Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

I assume you cannot use __meta_hetzner_hcloud_label_xxx labels with relabeling to get rid of the unwanted targets.
Even if you just "don't" want to do that, it's still a legit feature as we already allow to do that for other SD.

I assume you did test this manually and I think the tests on hetznercloud/hcloud-go side are enough.

By the way, since you work at Hetzner, we’re looking for a point of contact to help review and validate API related changes. Would you or someone on your team be interested in helping us with that? (looking at the history https://github.com/prometheus/prometheus/commits/main/discovery/hetzner, it should be light workload)

@jooola jooola force-pushed the hetzner-label-selector branch from 873cf52 to 481d12a Compare April 30, 2025 07:23
Allows to filter the servers when sending the listing request to the API. This feature is only available when using the `role=hcloud`.

See https://docs.hetzner.cloud/#label-selector for details on how to use the label selector.

Signed-off-by: Jonas Lammler <jonas.lammler@hetzner-cloud.de>
@jooola jooola force-pushed the hetzner-label-selector branch from 481d12a to 08982b1 Compare April 30, 2025 07:24
@jooola
Copy link
Contributor Author

jooola commented Apr 30, 2025

I assume you cannot use __meta_hetzner_hcloud_label_xxx labels with relabeling to get rid of the unwanted targets. Even if you just "don't" want to do that, it's still a legit feature as we already allow to do that for other SD.

This is actually another valid option, but depending on the amount of server in a user's project, this should still reduce the load on both prometheus and our API by processing less data from the start.

By the way, since you work at Hetzner, we’re looking for a point of contact to help review and validate API related changes. Would you or someone on your team be interested in helping us with that?

Sure, you may contact me @jooola or @apricote for anything related to the hetzner service discovery.

I assume you did test this manually and I think the tests on hetznercloud/hcloud-go side are enough.

Indeed, I did test this manually.

I rebased the changes on top of the main branch.

Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks!
lgtm

@machine424 machine424 merged commit a002826 into prometheus:main Apr 30, 2025
27 checks passed
@jooola jooola deleted the hetzner-label-selector branch April 30, 2025 10:22
@jooola
Copy link
Contributor Author

jooola commented Apr 30, 2025

Awesome! Thanks for the reactivity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants