Skip to content

Rule: Support native --rule-file auto-reload in thanos rule #8794

Description

@yosshi825

Is your proposal related to a problem?

thanos rule supports reloading rule files via SIGHUP or POST /-/reload, but it does not automatically detect updates to files specified by --rule-file.

This is particularly inconvenient in Kubernetes environments where rule files are managed via ConfigMap or Secret. Even when a mounted file is updated automatically, thanos rule does not pick up the change on its own, so users still need an external reloader sidecar just to detect the file change and call /-/reload.

The --rule-file flag description itself also notes this current limitation:

Note that rules are not automatically detected, use SIGHUP or do HTTP POST /-/reload to re-read them.

Describe the solution you'd like

It would be very helpful if thanos rule had a native auto-reload mechanism for files specified by --rule-file.

For example, an optional mechanism that:

  • watches rule files on disk
  • detects updates automatically
  • reloads rules without requiring an external sidecar
  • keeps the current behavior if the updated rule files are invalid

A feature similar in spirit to Prometheus --enable-feature=auto-reload-config would be ideal.

Describe alternatives you've considered

The current workaround is to use an external reloader sidecar or watcher process that detects file changes and then triggers SIGHUP or POST /-/reload.

This works, but it adds operational complexity, especially in Kubernetes deployments where mounted ConfigMap / Secret updates are common.

I also looked at existing behavior in other Thanos components. Notably, thanos receive already supports automatic reload for --receive.hashrings-file, so there is already a precedent in Thanos for native file-watching and dynamic reload behavior.

Additional context

This would be especially useful for Kubernetes deployments where rule files are updated through mounted ConfigMaps or Secrets.

It would also make thanos rule more consistent with other systems that already support native config/rule auto-reload.

Reference for the Prometheus feature mentioned above:
Prometheus: Auto Reload Config

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions