mirror of
https://github.com/rancher/steve.git
synced 2025-08-22 16:16:49 +00:00
Add debug for schemas(user)
This commit is contained in:
parent
1b1e1baec8
commit
cc404c56c0
@ -24,15 +24,16 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
DetailedLogDebug = false
|
||||||
|
|
||||||
schemasExpiryHour = defaultExpiryHour
|
schemasExpiryHour = defaultExpiryHour
|
||||||
logSizeDebug = false
|
|
||||||
jitterExpiry = false
|
jitterExpiry = false
|
||||||
expiryLowerBound = 0
|
expiryLowerBound = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if showSizeDebug := os.Getenv("CATTLE_LOG_CACHE_SIZE_DEBUG"); showSizeDebug == "true" {
|
if showDetailedDebug := os.Getenv("CATTLE_DETAILED_SCHEMAS_DEBUG"); showDetailedDebug == "true" {
|
||||||
logSizeDebug = true
|
DetailedLogDebug = true
|
||||||
}
|
}
|
||||||
if expiry := os.Getenv("CATTLE_SCHEMAS_CACHE_EXPIRY"); expiry != "" {
|
if expiry := os.Getenv("CATTLE_SCHEMAS_CACHE_EXPIRY"); expiry != "" {
|
||||||
expInt, err := strconv.Atoi(expiry)
|
expInt, err := strconv.Atoi(expiry)
|
||||||
@ -84,6 +85,10 @@ func (c *Collection) Schemas(user user.Info) (*types.APISchemas, error) {
|
|||||||
return schemas, nil
|
return schemas, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if DetailedLogDebug {
|
||||||
|
logrus.Debugf("Cache miss for Schemas(<user>) for user [%s], cache ID [%s]", user.GetName(), access.ID)
|
||||||
|
}
|
||||||
|
|
||||||
schemas, err := c.schemasForSubject(access)
|
schemas, err := c.schemasForSubject(access)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -110,7 +115,7 @@ func (c *Collection) addToCache(access *accesscontrol.AccessSet, user user.Info,
|
|||||||
if cacheSize >= userSchemasCacheSize {
|
if cacheSize >= userSchemasCacheSize {
|
||||||
logrus.Debugf("user schemas cache is full. set size limit [%d], records will be evicted", userSchemasCacheSize)
|
logrus.Debugf("user schemas cache is full. set size limit [%d], records will be evicted", userSchemasCacheSize)
|
||||||
}
|
}
|
||||||
if logSizeDebug {
|
if DetailedLogDebug {
|
||||||
logrus.Debugf("current size of schemas cache [%d], access ID being added [%s]", cacheSize, access.ID)
|
logrus.Debugf("current size of schemas cache [%d], access ID being added [%s]", cacheSize, access.ID)
|
||||||
}
|
}
|
||||||
expiry := schemasExpiryHour
|
expiry := schemasExpiryHour
|
||||||
|
Loading…
Reference in New Issue
Block a user