Add ConfigProvider and modify quota.Service to use it (#109395)

* Add config provider and integrate with wire setup

* Refactor quota service to use config provider for configuration management

* Enhance OSSConfigProvider to include logging and update ProvideService to return an error. Refactor server initialization to handle potential errors from config provider. Remove unnecessary wire binding for OSSConfigProvider.

* Update CODEOWNERS to include the configprovider package under the grafana-backend-services-squad.

* Refactor quota service initialization to include context in multiple service providers. Update tests and service implementations to ensure proper context handling during service creation.
This commit is contained in:
Sofia Papagiannaki
2025-08-12 09:42:10 +03:00
committed by GitHub
parent 101aea9647
commit 402572c580
25 changed files with 196 additions and 73 deletions
+7 -2
View File
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/configprovider"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/server"
"github.com/grafana/grafana/pkg/services/correlations"
@@ -144,7 +145,9 @@ func (c TestContext) createOrg(name string) int64 {
c.t.Helper()
store := c.env.SQLStore
c.env.Cfg.AutoAssignOrg = false
quotaService := quotaimpl.ProvideService(store, c.env.Cfg)
cfgProvider, err := configprovider.ProvideService(c.env.Cfg)
require.NoError(c.t, err)
quotaService := quotaimpl.ProvideService(context.Background(), store, cfgProvider)
orgService, err := orgimpl.ProvideService(store, c.env.Cfg, quotaService)
require.NoError(c.t, err)
orgId, err := orgService.GetOrCreate(context.Background(), name)
@@ -158,7 +161,9 @@ func (c TestContext) createUser(cmd user.CreateUserCommand) User {
c.env.Cfg.AutoAssignOrg = true
c.env.Cfg.AutoAssignOrgId = 1
quotaService := quotaimpl.ProvideService(store, c.env.Cfg)
cfgProvider, err := configprovider.ProvideService(c.env.Cfg)
require.NoError(c.t, err)
quotaService := quotaimpl.ProvideService(context.Background(), store, cfgProvider)
orgService, err := orgimpl.ProvideService(store, c.env.Cfg, quotaService)
require.NoError(c.t, err)
usrSvc, err := userimpl.ProvideService(