thanos-io / thanos

Highly available Prometheus setup with long term storage capabilities. A CNCF Incubating project.
https://thanos.io
Apache License 2.0
13.01k stars 2.08k forks source link

REST API For update Rules #7116

Open ink1337 opened 7 months ago

ink1337 commented 7 months ago

Hi, It would be very helpful to have methods: POST and DELETE as REST API endpoints for the Alerting Rules/Recording Rules in the Ruler component. Similar to the Cortex: POST /api/v1/rules/{namespace} DELETE /api/v1/rules/{namespace}. I am working with Kuberenetes and I need to update Alerting Rules/Recording Rules in the runtime and I can't find proper way to do that.

ink1337 commented 7 months ago

Please let me know if it is even possible:)

yeya24 commented 7 months ago

Hi @ink1337 , There is no API for that right now.

I am working with Kuberenetes and I need to update Alerting Rules/Recording Rules in the runtime and I can't find proper way to do that.

If you are using k8s then you can run Prometheus Operator, which allows you to run Thanos Ruler and you can create/update/delete rules using k8s API.

ink1337 commented 7 months ago

Thank you for your answer @yeya24 ! By:

allows you to run Thanos Ruler and you can create/update/delete rules using k8s API.

do you mean editing PrometheusRule objects directly via the k8s API?

To clarify, I have a service on k8s that should configure Thanos rules at runtime, as is possible via the cortex. I am also trying to understand the idea of sidecar for thanos, capable of editing rule file and exposing REST API for it. I am not sure if i am on the right track...

There is no API for that right now.

So, is there a chance for it to be delivered in the future?

yeya24 commented 7 months ago

do you mean editing PrometheusRule objects directly via the k8s API?

Yes.

To clarify, I have a service on k8s that should configure Thanos rules at runtime, as is possible via the cortex. I am also trying to understand the idea of sidecar for thanos, capable of editing rule file and exposing REST API for it. I am not sure if i am on the right track...

I think you can do that. It is similar to how the PrometheusRule works in the operator actually.

So, is there a chance for it to be delivered in the future?

No one is currently working on it right now I believe. Contribution is welcomed and we need a proper design for this feature first.