mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Add stat for remote cache config (#64276)
* add stat for remote cache config
This commit is contained in:
parent
20b79b41eb
commit
9276f11388
@ -173,6 +173,9 @@ func (s *Service) collectSystemStats(ctx context.Context) (map[string]interface{
|
|||||||
}
|
}
|
||||||
|
|
||||||
m["stats.avg_auth_token_per_user.count"] = avgAuthTokensPerUser
|
m["stats.avg_auth_token_per_user.count"] = avgAuthTokensPerUser
|
||||||
|
if s.cfg.RemoteCacheOptions != nil && s.cfg.RemoteCacheOptions.Name != "" {
|
||||||
|
m["stats.remote_cache."+s.cfg.RemoteCacheOptions.Name+".count"] = 1
|
||||||
|
}
|
||||||
m["stats.packaging."+s.cfg.Packaging+".count"] = 1
|
m["stats.packaging."+s.cfg.Packaging+".count"] = 1
|
||||||
m["stats.distributor."+s.cfg.ReportingDistributor+".count"] = 1
|
m["stats.distributor."+s.cfg.ReportingDistributor+".count"] = 1
|
||||||
|
|
||||||
|
@ -152,6 +152,9 @@ func TestCollectingUsageStats(t *testing.T) {
|
|||||||
AuthProxyEnabled: true,
|
AuthProxyEnabled: true,
|
||||||
Packaging: "deb",
|
Packaging: "deb",
|
||||||
ReportingDistributor: "hosted-grafana",
|
ReportingDistributor: "hosted-grafana",
|
||||||
|
RemoteCacheOptions: &setting.RemoteCacheOptions{
|
||||||
|
Name: "database",
|
||||||
|
},
|
||||||
}, sqlStore, statsService,
|
}, sqlStore, statsService,
|
||||||
withDatasources(mockDatasourceService{datasources: expectedDataSources}))
|
withDatasources(mockDatasourceService{datasources: expectedDataSources}))
|
||||||
|
|
||||||
@ -179,6 +182,7 @@ func TestCollectingUsageStats(t *testing.T) {
|
|||||||
assert.EqualValues(t, 11, metrics["stats.data_keys.count"])
|
assert.EqualValues(t, 11, metrics["stats.data_keys.count"])
|
||||||
assert.EqualValues(t, 3, metrics["stats.active_data_keys.count"])
|
assert.EqualValues(t, 3, metrics["stats.active_data_keys.count"])
|
||||||
assert.EqualValues(t, 5, metrics["stats.public_dashboards.count"])
|
assert.EqualValues(t, 5, metrics["stats.public_dashboards.count"])
|
||||||
|
assert.EqualValues(t, 1, metrics["stats.remote_cache.database.count"])
|
||||||
|
|
||||||
assert.InDelta(t, int64(65), metrics["stats.uptime"], 6)
|
assert.InDelta(t, int64(65), metrics["stats.uptime"], 6)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user