-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruler: skips rule files based on their names without any error/warning log. #4232
Comments
I would like to work on this issue suggest me way to proceed |
@wiardvanrij I'd take this one if it's not being worked on |
SolutionHi, I'm trying to fix it out. Line 358 in f4a5904
newFn := filepath.Join(m.workDir, s.String(), strings.TrimLeft(fn, m.workDir)) to newFn := filepath.Join(m.workDir, s.String(), filepath.Base(fn))
What do you think? reappearThe bug reappear: package main
import (
"fmt"
"strings"
)
func main() {
// source code:
// newFn := filepath.Join(m.workDir, s.String(), strings.TrimLeft(fn, m.workDir))
// s.String() = "ABORT"
fn := "/opt/programs/thanos-0.19.0.linux-amd64/rules/test.yml" // fn
fn1 := "/opt/programs/thanos-0.19.0.linux-amd64/rules/test1.yml" // fn1
workdir := "/opt/programs/thanos-0.19.0.linux-amd64/ruler_data/.tmp-rules" // m.workDir
fmt.Println(strings.TrimLeft(fn, workdir))
fmt.Println(strings.TrimLeft(fn1, workdir))
} And they have the same output:
|
Signed-off-by: weidai218169 <weidai218169@sohu-inc.com>
Hey @daiwei233, please have a look at my proposed solution at #4468 and let me know your thoughts! I think best way here is to not trim / alter the filename, since the trimming does not seem to have the desired behavior and leaving the full filename in does not seem to pose an issue (I'm wondering what was the original intention behind using |
You are right, i think it will be work.#4468 |
Thanos version used:
thanos image: quay.io/thanos/thanos:v0.17.2
What happened:
We run thanos-rule with the following flag:
to load rules from all the yaml files we put under the above location.
We use
kustomize
configMapGenerator
to create a configMap with the needed files:and mount it under the passed location:
As a result, we can see all the rule files mounted in the pods:
Moreover, thanos ruler is able to see all 8 files on startup:
Thanos only loads rules from 6/8 files. In particular, the following:
The end result is that we are missing rules defined in 2 yaml files.
What you expected to happen:
Load all the rules, or give an error on why it failed to do so.
How to reproduce it (as minimally and precisely as possible):
Following our example should be sufficient here.
Full logs to relevant components:
No useful logs from thanos regarding this one. We were profiling the issue via trying different sets of our rule files.
Anything else we need to know:
A workaround is to prefix all mounted files with
_
, which seems to do the trick and allows the ruler to load all our rules fine.In particular, we believe that this behaviour is a result of:
thanos/pkg/rules/manager.go
Line 358 in f4a5904
Environment:
Kube version: v1.21.0
OS: Flatcar Container Linux by Kinvolk 2765.2.3 (Oklo)
kernel: 5.10.32-flatcar
container runtime: containerd://1.4.4
The text was updated successfully, but these errors were encountered: