Skip to content
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

Add more explicit logging RE recording rules #80

Merged
merged 1 commit into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cmd/promxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,22 @@ func main() {
logrus.Fatalf("Error loading config: %s", err)
}

// Our own checks on top of the config
checkConfig := func() error {
// check for any recording rules, if we find any lets log a fatal and stop
// https://github.com/jacksontj/promxy/issues/74
for _, rule := range ruleManager.Rules() {
if _, ok := rule.(*rules.RecordingRule); ok {
return fmt.Errorf("Promxy doesn't support recording rules: %s", rule)
}
}
return nil
}

if err := checkConfig(); err != nil {
logrus.Fatalf("Error checking config: %v", err)
}

close(reloadReady)

// Set up access logger
Expand Down Expand Up @@ -349,6 +365,9 @@ func main() {
if err := reloadConfig(reloadables...); err != nil {
log.Errorf("Error reloading config: %s", err)
}
if err := checkConfig(); err != nil {
logrus.Errorf("Error checking config: %v", err)
}
case syscall.SIGTERM, syscall.SIGINT:
log.Infof("promxy exiting")
cancel()
Expand Down
1 change: 1 addition & 0 deletions proxystorage/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (a *appenderStub) Commit() error { return nil }
func (a *appenderStub) Rollback() error { return nil }

func (p *ProxyStorage) Appender() (storage.Appender, error) {
logrus.Warning("Promxy cannot *write* metrics but is being asked to. This is likely due to a RecordingRule")
return &appenderStub{}, nil
}

Expand Down