satellite: set names for lrucache metrics

Fixes https://github.com/storj/storj/issues/5685

Change-Id: I9c19b7644b0cd3297448982b920c97abcdce9119
This commit is contained in:
Michal Niewrzal 2023-04-04 11:11:06 +02:00
parent 4f515e759d
commit 4c05293d8b
11 changed files with 31 additions and 21 deletions

4
go.mod
View File

@ -58,11 +58,11 @@ require (
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
gopkg.in/segmentio/analytics-go.v3 v3.1.0 gopkg.in/segmentio/analytics-go.v3 v3.1.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
storj.io/common v0.0.0-20230320162442-624d95b0fa7f storj.io/common v0.0.0-20230403133453-c41ac89d0a5f
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41
storj.io/private v0.0.0-20230310092705-eeeca888b55b storj.io/private v0.0.0-20230310092705-eeeca888b55b
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe
) )
require ( require (

8
go.sum
View File

@ -968,8 +968,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ= storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f h1:riYCjI+x1o3jZSXda9XwLHIEkqphR4Yl+Yqnkm5YKRU= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f h1:fR5zrhISJnu69erKyDZbNTqiZn047fVhYpKHEvLyonY=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg= storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU= storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU=
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4= storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=
@ -979,5 +979,5 @@ storj.io/picobuf v0.0.1 h1:ekEvxSQCbEjTVIi/qxj2za13SJyfRE37yE30IBkZeT0=
storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0= storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0=
storj.io/private v0.0.0-20230310092705-eeeca888b55b h1:6ehpQF+Miij0P6GjQgO7h6bXpF4dhwl8wxXS8eORtxY= storj.io/private v0.0.0-20230310092705-eeeca888b55b h1:6ehpQF+Miij0P6GjQgO7h6bXpF4dhwl8wxXS8eORtxY=
storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY= storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 h1:iWSOMIZArkHocAQcDQsP/9UvgFjJEh5WrP8ZtdquCkQ= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe h1:hQ8pFjgWW6ePpaPhCD3a41eyPnkPIRqJ0deyQc6UpL0=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww=

View File

@ -58,6 +58,7 @@ func NewProjectLimitCache(db ProjectLimitDB, defaultMaxUsage, defaultMaxBandwidt
state: lrucache.New(lrucache.Options{ state: lrucache.New(lrucache.Options{
Capacity: config.CacheCapacity, Capacity: config.CacheCapacity,
Expiration: config.CacheExpiration, Expiration: config.CacheExpiration,
Name: "accounting-projectlimit",
}), }),
} }
} }

View File

@ -22,7 +22,11 @@ type RateLimiter struct {
// NewRateLimiter is a constructor for RateLimiter. // NewRateLimiter is a constructor for RateLimiter.
func NewRateLimiter(interval time.Duration, burst, numLimits int) *RateLimiter { func NewRateLimiter(interval time.Duration, burst, numLimits int) *RateLimiter {
return &RateLimiter{ return &RateLimiter{
limiters: lrucache.New(lrucache.Options{Expiration: -1, Capacity: numLimits}), limiters: lrucache.New(lrucache.Options{
Expiration: -1,
Capacity: numLimits,
Name: "contact-ratelimit",
}),
interval: interval, interval: interval,
burst: burst, burst: burst,
} }

View File

@ -121,6 +121,7 @@ func NewEndpoint(log *zap.Logger, buckets *buckets.Service, metabaseDB *metabase
limiterCache: lrucache.New(lrucache.Options{ limiterCache: lrucache.New(lrucache.Options{
Capacity: config.RateLimiter.CacheCapacity, Capacity: config.RateLimiter.CacheCapacity,
Expiration: config.RateLimiter.CacheExpiration, Expiration: config.RateLimiter.CacheExpiration,
Name: "metainfo-ratelimit",
}), }),
encInlineSegmentSize: encInlineSegmentSize, encInlineSegmentSize: encInlineSegmentSize,
revocations: revocations, revocations: revocations,

View File

@ -49,9 +49,11 @@ func (db *ConsoleDB) ProjectMembers() console.ProjectMembers {
// APIKeys is a getter for APIKeys repository. // APIKeys is a getter for APIKeys repository.
func (db *ConsoleDB) APIKeys() console.APIKeys { func (db *ConsoleDB) APIKeys() console.APIKeys {
db.apikeysOnce.Do(func() { db.apikeysOnce.Do(func() {
options := db.apikeysLRUOptions
options.Name = "satellitedb-apikeys"
db.apikeys = &apikeys{ db.apikeys = &apikeys{
methods: db.methods, methods: db.methods,
lru: lrucache.New(db.apikeysLRUOptions), lru: lrucache.New(options),
db: db.db, db: db.db,
} }
}) })

View File

@ -218,9 +218,11 @@ func (dbc *satelliteDBCollection) ProjectAccounting() accounting.ProjectAccounti
func (dbc *satelliteDBCollection) Revocation() revocation.DB { func (dbc *satelliteDBCollection) Revocation() revocation.DB {
db := dbc.getByName("revocation") db := dbc.getByName("revocation")
db.revocationDBOnce.Do(func() { db.revocationDBOnce.Do(func() {
options := db.opts.RevocationLRUOptions
options.Name = "satellitedb-revocations"
db.revocationDB = &revocationDB{ db.revocationDB = &revocationDB{
db: db, db: db,
lru: lrucache.New(db.opts.RevocationLRUOptions), lru: lrucache.New(options),
methods: db, methods: db,
} }
}) })

View File

@ -9,11 +9,11 @@ require (
github.com/zeebo/errs v1.3.0 github.com/zeebo/errs v1.3.0
go.uber.org/zap v1.21.0 go.uber.org/zap v1.21.0
golang.org/x/sync v0.1.0 golang.org/x/sync v0.1.0
storj.io/common v0.0.0-20230320162442-624d95b0fa7f storj.io/common v0.0.0-20230403133453-c41ac89d0a5f
storj.io/private v0.0.0-20230310092705-eeeca888b55b storj.io/private v0.0.0-20230310092705-eeeca888b55b
storj.io/storj v1.63.1 storj.io/storj v1.63.1
storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0 storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe
) )
require ( require (

View File

@ -1223,8 +1223,8 @@ rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ= storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f h1:riYCjI+x1o3jZSXda9XwLHIEkqphR4Yl+Yqnkm5YKRU= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f h1:fR5zrhISJnu69erKyDZbNTqiZn047fVhYpKHEvLyonY=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg= storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU= storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU=
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4= storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=
@ -1236,5 +1236,5 @@ storj.io/private v0.0.0-20230310092705-eeeca888b55b h1:6ehpQF+Miij0P6GjQgO7h6bXp
storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY= storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY=
storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0 h1:pSfGf9E9OlUd17W7LSpL4tTONIyFji6dz8I2iTDd8BY= storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0 h1:pSfGf9E9OlUd17W7LSpL4tTONIyFji6dz8I2iTDd8BY=
storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0/go.mod h1:5nLgAOl1KTDVyqORAhvrp+167PtShEuS1L3pJgXPjwo= storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0/go.mod h1:5nLgAOl1KTDVyqORAhvrp+167PtShEuS1L3pJgXPjwo=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 h1:iWSOMIZArkHocAQcDQsP/9UvgFjJEh5WrP8ZtdquCkQ= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe h1:hQ8pFjgWW6ePpaPhCD3a41eyPnkPIRqJ0deyQc6UpL0=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww=

View File

@ -10,7 +10,7 @@ require (
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2 github.com/stretchr/testify v1.8.2
go.uber.org/zap v1.23.0 go.uber.org/zap v1.23.0
storj.io/common v0.0.0-20230320162442-624d95b0fa7f storj.io/common v0.0.0-20230403133453-c41ac89d0a5f
storj.io/gateway-mt v1.49.0 storj.io/gateway-mt v1.49.0
storj.io/private v0.0.0-20230310092705-eeeca888b55b storj.io/private v0.0.0-20230310092705-eeeca888b55b
storj.io/storj v0.12.1-0.20221125175451-ef4b564b82f7 storj.io/storj v0.12.1-0.20221125175451-ef4b564b82f7
@ -222,5 +222,5 @@ require (
storj.io/minio v0.0.0-20230118205046-c025fcc9eef3 // indirect storj.io/minio v0.0.0-20230118205046-c025fcc9eef3 // indirect
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 // indirect storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 // indirect
storj.io/picobuf v0.0.1 // indirect storj.io/picobuf v0.0.1 // indirect
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 // indirect storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe // indirect
) )

View File

@ -1927,8 +1927,8 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ= storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f h1:riYCjI+x1o3jZSXda9XwLHIEkqphR4Yl+Yqnkm5YKRU= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f h1:fR5zrhISJnu69erKyDZbNTqiZn047fVhYpKHEvLyonY=
storj.io/common v0.0.0-20230320162442-624d95b0fa7f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA= storj.io/common v0.0.0-20230403133453-c41ac89d0a5f/go.mod h1:mYWledc0VY1J4+merC3LIFZr0Wa4FaB/hg0ucMdYnzA=
storj.io/dotworld v0.0.0-20210324183515-0d11aeccd840 h1:oqMwoF6vaOrCe92SKRyr8cc2WSjLYAd8fjpAHA7rNqY= storj.io/dotworld v0.0.0-20210324183515-0d11aeccd840 h1:oqMwoF6vaOrCe92SKRyr8cc2WSjLYAd8fjpAHA7rNqY=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg= storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU= storj.io/drpc v0.0.33-0.20230329154546-1af8c33020a2 h1:bwj32XFRYPb7LqNxAmP7kqcsxmXla7iygazXDPtzKbU=
@ -1945,6 +1945,6 @@ storj.io/picobuf v0.0.1 h1:ekEvxSQCbEjTVIi/qxj2za13SJyfRE37yE30IBkZeT0=
storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0= storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0=
storj.io/private v0.0.0-20230310092705-eeeca888b55b h1:6ehpQF+Miij0P6GjQgO7h6bXpF4dhwl8wxXS8eORtxY= storj.io/private v0.0.0-20230310092705-eeeca888b55b h1:6ehpQF+Miij0P6GjQgO7h6bXpF4dhwl8wxXS8eORtxY=
storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY= storj.io/private v0.0.0-20230310092705-eeeca888b55b/go.mod h1:JxBlgPwo+P0OOJDSPJLwBJWUPnhnvrHOlKAN0aV/bhY=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79 h1:iWSOMIZArkHocAQcDQsP/9UvgFjJEh5WrP8ZtdquCkQ= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe h1:hQ8pFjgWW6ePpaPhCD3a41eyPnkPIRqJ0deyQc6UpL0=
storj.io/uplink v1.10.1-0.20230317162227-f9e94287ad79/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww= storj.io/uplink v1.10.1-0.20230331141033-1b3a2ee2cdbe/go.mod h1:x6XS4VpmVMU2N/VXm7QGS2M4Ar1+FmWa0lZGYfhMCww=
storj.io/zipper v0.0.0-20220124122551-2ac2d53a46f6 h1:vJQmb+uAiYn8hVfkhMl6OqjnUyMWSCPnkzW8IsjF8vE= storj.io/zipper v0.0.0-20220124122551-2ac2d53a46f6 h1:vJQmb+uAiYn8hVfkhMl6OqjnUyMWSCPnkzW8IsjF8vE=