Skip to content

Commit

Permalink
Always collect metrics about top backend requests
Browse files Browse the repository at this point in the history
Previously, it was only done in debug mode. This makes some tabs in
`tctl top` empty, when auth server is not in debug mode.
  • Loading branch information
Andrew Lytvynov committed Sep 15, 2020
1 parent cdcb24f commit e589366
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 0 additions & 6 deletions lib/backend/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ import (
type ReporterConfig struct {
// Backend is a backend to wrap
Backend Backend
// TrackTopRequests turns on tracking of top
// requests on
TrackTopRequests bool
// Component is a component name to report
Component string
}
Expand Down Expand Up @@ -221,9 +218,6 @@ func (s *Reporter) Migrate(ctx context.Context) error { return s.Backend.Migrate

// trackRequests tracks top requests, endKey is supplied for ranges
func (s *Reporter) trackRequest(opType OpType, key []byte, endKey []byte) {
if !s.TrackTopRequests {
return
}
if len(key) == 0 {
return
}
Expand Down
10 changes: 4 additions & 6 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,9 +1320,8 @@ func (process *TeleportProcess) newAccessCache(cfg accessCacheConfig) (*cache.Ca
cacheBackend = liteBackend
}
reporter, err := backend.NewReporter(backend.ReporterConfig{
Component: teleport.ComponentCache,
Backend: cacheBackend,
TrackTopRequests: process.Config.Debug,
Component: teleport.ComponentCache,
Backend: cacheBackend,
})
if err != nil {
return nil, trace.Wrap(err)
Expand Down Expand Up @@ -2392,9 +2391,8 @@ func (process *TeleportProcess) initAuthStorage() (bk backend.Backend, err error
return nil, trace.Wrap(err)
}
reporter, err := backend.NewReporter(backend.ReporterConfig{
Component: teleport.ComponentBackend,
Backend: backend.NewSanitizer(bk),
TrackTopRequests: process.Config.Debug,
Component: teleport.ComponentBackend,
Backend: backend.NewSanitizer(bk),
})
if err != nil {
return nil, trace.Wrap(err)
Expand Down

0 comments on commit e589366

Please sign in to comment.