Add storage count debug statement.

This commit is contained in:
Maximilian Paß
2022-08-06 13:13:46 +02:00
committed by Sebastian Serth
parent 6ddc6493d4
commit 770327cf64

View File

@ -3,11 +3,14 @@ package storage
import ( import (
influxdb2 "github.com/influxdata/influxdb-client-go/v2" influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"github.com/influxdata/influxdb-client-go/v2/api/write" "github.com/influxdata/influxdb-client-go/v2/api/write"
"github.com/openHPI/poseidon/pkg/logging"
"github.com/openHPI/poseidon/pkg/monitoring" "github.com/openHPI/poseidon/pkg/monitoring"
"strconv" "strconv"
"sync" "sync"
) )
var log = logging.GetLogger("storage")
// Storage is an interface for storing objects. // Storage is an interface for storing objects.
type Storage[T any] interface { type Storage[T any] interface {
// List returns all objects from the storage. // List returns all objects from the storage.
@ -135,7 +138,9 @@ func (s *localStorage[T]) Length() uint {
} }
func (s *localStorage[T]) unsafeLength() uint { func (s *localStorage[T]) unsafeLength() uint {
return uint(len(s.objects)) length := len(s.objects)
log.WithField("length_int", length).WithField("length_uint", uint(length)).Debug("Storage info")
return uint(length)
} }
func (s *localStorage[T]) sendMonitoringData(id string, o T, isDeletion bool, count uint) { func (s *localStorage[T]) sendMonitoringData(id string, o T, isDeletion bool, count uint) {