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

feat: Added specific metric for graphite unavailability check result #766

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
1 change: 1 addition & 0 deletions checker/worker/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (worker *Checker) checkRemote() error {
remoteAvailable, err := source.(*remote.Remote).IsRemoteAvailable()
if !remoteAvailable {
worker.Logger.Infof("Remote API is unavailable. Stop checking remote triggers. Error: %s", err.Error())
worker.Metrics.RemoteAvailabilityCheckFailed.Mark(1)
} else {
worker.Logger.Debug("Checking remote triggers")
triggerIds, err := worker.Database.GetRemoteTriggerIDs()
Expand Down
12 changes: 7 additions & 5 deletions metrics/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import "github.com/moira-alert/moira"

// CheckerMetrics is a collection of metrics used in checker
type CheckerMetrics struct {
LocalMetrics *CheckMetrics
RemoteMetrics *CheckMetrics
MetricEventsChannelLen Histogram
UnusedTriggersCount Histogram
MetricEventsHandleTime Timer
LocalMetrics *CheckMetrics
RemoteMetrics *CheckMetrics
MetricEventsChannelLen Histogram
UnusedTriggersCount Histogram
MetricEventsHandleTime Timer
RemoteAvailabilityCheckFailed Meter
}

// GetCheckMetrics return check metrics dependent on given trigger type
Expand Down Expand Up @@ -37,6 +38,7 @@ func ConfigureCheckerMetrics(registry Registry, remoteEnabled bool) *CheckerMetr
}
if remoteEnabled {
m.RemoteMetrics = configureCheckMetrics(registry, "remote")
m.RemoteAvailabilityCheckFailed = registry.NewMeter("remote", "unavailable")
}
return m
}
Expand Down