Skip to content

Commit

Permalink
fix: drop MetricInterface and adjust interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
shipperizer committed Aug 22, 2023
1 parent b47dcf7 commit 50542f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
7 changes: 2 additions & 5 deletions internal/monitoring/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package monitoring

type MonitorInterface interface {
GetService() string
GetResponseTimeMetric(map[string]string) (MetricInterface, error)
}

type MetricInterface interface {
Observe(float64)
SetResponseTimeMetric(map[string]string, float64) error
SetDependencyAvailability(map[string]string, float64) error
}
10 changes: 1 addition & 9 deletions internal/monitoring/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ func (mdw *Middleware) ResponseTime() func(http.Handler) http.Handler {
"status": fmt.Sprint(ww.Status()),
}

m, err := mdw.monitor.GetResponseTimeMetric(tags)

if err != nil {
mdw.logger.Debugf("error fetching metric: %s; keep going....", err)

return
}

m.Observe(time.Since(startTime).Seconds())
mdw.monitor.SetResponseTimeMetric(tags, time.Since(startTime).Seconds())
},
)
}
Expand Down

0 comments on commit 50542f6

Please sign in to comment.