Skip to content

Commit

Permalink
fix: issue #72, now return aci_up == 0 if no metrics is returned from…
Browse files Browse the repository at this point in the history
… the call assuming apic or node is down.
  • Loading branch information
thenodon committed Nov 11, 2024
1 parent a56b401 commit d7439f0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aci-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ func (p aciAPI) CollectMetrics() (string, []MetricDefinition, error) {
}

end := time.Since(start)

if metrics == nil {
// if no metrics are returned the apic or node may be down
metrics = append(metrics, *p.up(0.0))
} else {
metrics = append(metrics, *p.up(1.0))
}

metrics = append(metrics, *p.scrape(end.Seconds()))
metrics = append(metrics, *p.up(1.0))
log.WithFields(log.Fields{
LogFieldRequestID: p.ctx.Value(LogFieldRequestID),
LogFieldExecTime: end.Microseconds(),
Expand Down

0 comments on commit d7439f0

Please sign in to comment.