// Code generated by Wire. DO NOT EDIT.

//go:generate go run ./pkg/build/wire/cmd/wire/main.go gen -tags "oss"
//go:build !wireinject && !enterprise && !pro

package server

import (
	"context"
	"github.com/google/wire"
	httpclient2 "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
	"github.com/grafana/grafana/apps/advisor/pkg/app/checkregistry"
	github2 "github.com/grafana/grafana/apps/provisioning/pkg/connection/github"
	"github.com/grafana/grafana/apps/provisioning/pkg/repository/github"
	"github.com/grafana/grafana/pkg/api"
	"github.com/grafana/grafana/pkg/api/avatar"
	"github.com/grafana/grafana/pkg/api/routing"
	"github.com/grafana/grafana/pkg/apiserver/auditing"
	"github.com/grafana/grafana/pkg/bus"
	"github.com/grafana/grafana/pkg/configprovider"
	"github.com/grafana/grafana/pkg/expr"
	"github.com/grafana/grafana/pkg/infra/db"
	"github.com/grafana/grafana/pkg/infra/httpclient"
	"github.com/grafana/grafana/pkg/infra/httpclient/httpclientprovider"
	"github.com/grafana/grafana/pkg/infra/kvstore"
	"github.com/grafana/grafana/pkg/infra/localcache"
	"github.com/grafana/grafana/pkg/infra/log/slogadapter"
	"github.com/grafana/grafana/pkg/infra/metrics"
	"github.com/grafana/grafana/pkg/infra/remotecache"
	"github.com/grafana/grafana/pkg/infra/serverlock"
	"github.com/grafana/grafana/pkg/infra/tracing"
	"github.com/grafana/grafana/pkg/infra/usagestats"
	"github.com/grafana/grafana/pkg/infra/usagestats/service"
	"github.com/grafana/grafana/pkg/infra/usagestats/statscollector"
	validator3 "github.com/grafana/grafana/pkg/infra/usagestats/validator"
	"github.com/grafana/grafana/pkg/login/social"
	"github.com/grafana/grafana/pkg/login/social/connectors"
	"github.com/grafana/grafana/pkg/login/social/socialimpl"
	"github.com/grafana/grafana/pkg/middleware/csrf"
	"github.com/grafana/grafana/pkg/middleware/loggermw"
	manager4 "github.com/grafana/grafana/pkg/plugins/manager"
	"github.com/grafana/grafana/pkg/plugins/manager/filestore"
	"github.com/grafana/grafana/pkg/plugins/manager/process"
	"github.com/grafana/grafana/pkg/plugins/manager/registry"
	"github.com/grafana/grafana/pkg/plugins/manager/signature"
	"github.com/grafana/grafana/pkg/plugins/pluginassets"
	"github.com/grafana/grafana/pkg/plugins/pluginerrs"
	"github.com/grafana/grafana/pkg/plugins/pluginscdn"
	"github.com/grafana/grafana/pkg/plugins/repo"
	"github.com/grafana/grafana/pkg/registry/apis"
	"github.com/grafana/grafana/pkg/registry/apis/appplugin"
	"github.com/grafana/grafana/pkg/registry/apis/collections"
	legacy2 "github.com/grafana/grafana/pkg/registry/apis/collections/legacy"
	"github.com/grafana/grafana/pkg/registry/apis/dashboard"
	"github.com/grafana/grafana/pkg/registry/apis/dashboard/legacy"
	migrator2 "github.com/grafana/grafana/pkg/registry/apis/dashboard/migrator"
	"github.com/grafana/grafana/pkg/registry/apis/datasource"
	migrator4 "github.com/grafana/grafana/pkg/registry/apis/datasource/migrator"
	"github.com/grafana/grafana/pkg/registry/apis/folders"
	"github.com/grafana/grafana/pkg/registry/apis/iam"
	"github.com/grafana/grafana/pkg/registry/apis/iam/externalgroupmapping"
	"github.com/grafana/grafana/pkg/registry/apis/iam/noopstorage"
	"github.com/grafana/grafana/pkg/registry/apis/iam/resourcepermission"
	"github.com/grafana/grafana/pkg/registry/apis/ofrep"
	"github.com/grafana/grafana/pkg/registry/apis/preferences"
	provisioning2 "github.com/grafana/grafana/pkg/registry/apis/provisioning"
	"github.com/grafana/grafana/pkg/registry/apis/provisioning/extras"
	"github.com/grafana/grafana/pkg/registry/apis/provisioning/webhooks"
	"github.com/grafana/grafana/pkg/registry/apis/provisioning/webhooks/pullrequest"
	query2 "github.com/grafana/grafana/pkg/registry/apis/query"
	"github.com/grafana/grafana/pkg/registry/apis/secret"
	"github.com/grafana/grafana/pkg/registry/apis/secret/clock"
	"github.com/grafana/grafana/pkg/registry/apis/secret/contracts"
	"github.com/grafana/grafana/pkg/registry/apis/secret/decrypt"
	service5 "github.com/grafana/grafana/pkg/registry/apis/secret/encryption/cipher/service"
	"github.com/grafana/grafana/pkg/registry/apis/secret/encryption/kmsproviders"
	manager3 "github.com/grafana/grafana/pkg/registry/apis/secret/encryption/manager"
	"github.com/grafana/grafana/pkg/registry/apis/secret/garbagecollectionworker"
	"github.com/grafana/grafana/pkg/registry/apis/secret/inline"
	"github.com/grafana/grafana/pkg/registry/apis/secret/mutator"
	"github.com/grafana/grafana/pkg/registry/apis/secret/secretkeeper"
	service6 "github.com/grafana/grafana/pkg/registry/apis/secret/service"
	"github.com/grafana/grafana/pkg/registry/apis/secret/validator"
	"github.com/grafana/grafana/pkg/registry/apis/userstorage"
	"github.com/grafana/grafana/pkg/registry/apps"
	advisor2 "github.com/grafana/grafana/pkg/registry/apps/advisor"
	"github.com/grafana/grafana/pkg/registry/apps/alerting/historian"
	notifications2 "github.com/grafana/grafana/pkg/registry/apps/alerting/notifications"
	"github.com/grafana/grafana/pkg/registry/apps/alerting/rules"
	"github.com/grafana/grafana/pkg/registry/apps/annotation"
	correlations2 "github.com/grafana/grafana/pkg/registry/apps/correlations"
	"github.com/grafana/grafana/pkg/registry/apps/dashvalidator"
	"github.com/grafana/grafana/pkg/registry/apps/example"
	live2 "github.com/grafana/grafana/pkg/registry/apps/live"
	"github.com/grafana/grafana/pkg/registry/apps/logsdrilldown"
	playlist2 "github.com/grafana/grafana/pkg/registry/apps/playlist"
	"github.com/grafana/grafana/pkg/registry/apps/playlist/migrator"
	"github.com/grafana/grafana/pkg/registry/apps/plugins"
	"github.com/grafana/grafana/pkg/registry/apps/quotas"
	"github.com/grafana/grafana/pkg/registry/apps/shorturl"
	migrator3 "github.com/grafana/grafana/pkg/registry/apps/shorturl/migrator"
	"github.com/grafana/grafana/pkg/registry/backgroundsvcs"
	"github.com/grafana/grafana/pkg/registry/usagestatssvcs"
	"github.com/grafana/grafana/pkg/services/accesscontrol"
	"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
	dualwrite2 "github.com/grafana/grafana/pkg/services/accesscontrol/dualwrite"
	"github.com/grafana/grafana/pkg/services/accesscontrol/ossaccesscontrol"
	"github.com/grafana/grafana/pkg/services/accesscontrol/permreg"
	"github.com/grafana/grafana/pkg/services/accesscontrol/resourcepermissions"
	"github.com/grafana/grafana/pkg/services/annotations"
	"github.com/grafana/grafana/pkg/services/annotations/annotationsimpl"
	"github.com/grafana/grafana/pkg/services/anonymous/anonimpl"
	"github.com/grafana/grafana/pkg/services/anonymous/anonimpl/anonstore"
	validator2 "github.com/grafana/grafana/pkg/services/anonymous/validator"
	"github.com/grafana/grafana/pkg/services/apikey/apikeyimpl"
	"github.com/grafana/grafana/pkg/services/apiserver"
	"github.com/grafana/grafana/pkg/services/apiserver/aggregatorrunner"
	"github.com/grafana/grafana/pkg/services/apiserver/builder"
	"github.com/grafana/grafana/pkg/services/apiserver/standalone"
	"github.com/grafana/grafana/pkg/services/auth"
	"github.com/grafana/grafana/pkg/services/auth/authimpl"
	"github.com/grafana/grafana/pkg/services/auth/idimpl"
	"github.com/grafana/grafana/pkg/services/auth/jwt"
	"github.com/grafana/grafana/pkg/services/authn/authnimpl"
	"github.com/grafana/grafana/pkg/services/authz"
	store2 "github.com/grafana/grafana/pkg/services/authz/zanzana/store"
	"github.com/grafana/grafana/pkg/services/caching"
	"github.com/grafana/grafana/pkg/services/cleanup"
	"github.com/grafana/grafana/pkg/services/cloudmigration/cloudmigrationimpl"
	"github.com/grafana/grafana/pkg/services/contexthandler"
	"github.com/grafana/grafana/pkg/services/correlations"
	"github.com/grafana/grafana/pkg/services/dashboardimport"
	service11 "github.com/grafana/grafana/pkg/services/dashboardimport/service"
	dashboards2 "github.com/grafana/grafana/pkg/services/dashboards"
	service8 "github.com/grafana/grafana/pkg/services/dashboards/service"
	"github.com/grafana/grafana/pkg/services/dashboards/service/client"
	"github.com/grafana/grafana/pkg/services/dashboardsnapshots"
	database4 "github.com/grafana/grafana/pkg/services/dashboardsnapshots/database"
	service10 "github.com/grafana/grafana/pkg/services/dashboardsnapshots/service"
	"github.com/grafana/grafana/pkg/services/dashboardversion/dashverimpl"
	"github.com/grafana/grafana/pkg/services/datasourceproxy"
	"github.com/grafana/grafana/pkg/services/datasources"
	"github.com/grafana/grafana/pkg/services/datasources/guardian"
	service7 "github.com/grafana/grafana/pkg/services/datasources/service"
	"github.com/grafana/grafana/pkg/services/dsquerierclient"
	encryption2 "github.com/grafana/grafana/pkg/services/encryption"
	"github.com/grafana/grafana/pkg/services/encryption/provider"
	service2 "github.com/grafana/grafana/pkg/services/encryption/service"
	"github.com/grafana/grafana/pkg/services/extsvcauth"
	registry2 "github.com/grafana/grafana/pkg/services/extsvcauth/registry"
	"github.com/grafana/grafana/pkg/services/featuremgmt"
	"github.com/grafana/grafana/pkg/services/folder"
	"github.com/grafana/grafana/pkg/services/folder/folderimpl"
	"github.com/grafana/grafana/pkg/services/grpcserver"
	"github.com/grafana/grafana/pkg/services/grpcserver/context"
	"github.com/grafana/grafana/pkg/services/grpcserver/interceptors"
	"github.com/grafana/grafana/pkg/services/hooks"
	"github.com/grafana/grafana/pkg/services/kmsproviders/osskmsproviders"
	"github.com/grafana/grafana/pkg/services/ldap"
	api4 "github.com/grafana/grafana/pkg/services/ldap/api"
	service12 "github.com/grafana/grafana/pkg/services/ldap/service"
	"github.com/grafana/grafana/pkg/services/libraryelements"
	"github.com/grafana/grafana/pkg/services/librarypanels"
	"github.com/grafana/grafana/pkg/services/licensing"
	"github.com/grafana/grafana/pkg/services/live"
	"github.com/grafana/grafana/pkg/services/live/pushhttp"
	"github.com/grafana/grafana/pkg/services/login"
	"github.com/grafana/grafana/pkg/services/login/authinfoimpl"
	"github.com/grafana/grafana/pkg/services/loginattempt"
	"github.com/grafana/grafana/pkg/services/loginattempt/loginattemptimpl"
	"github.com/grafana/grafana/pkg/services/navtree/navtreeimpl"
	"github.com/grafana/grafana/pkg/services/ngalert"
	"github.com/grafana/grafana/pkg/services/ngalert/image"
	metrics2 "github.com/grafana/grafana/pkg/services/ngalert/metrics"
	store3 "github.com/grafana/grafana/pkg/services/ngalert/store"
	"github.com/grafana/grafana/pkg/services/notifications"
	"github.com/grafana/grafana/pkg/services/oauthtoken"
	"github.com/grafana/grafana/pkg/services/oauthtoken/oauthtokentest"
	"github.com/grafana/grafana/pkg/services/org/orgimpl"
	"github.com/grafana/grafana/pkg/services/plugindashboards"
	service9 "github.com/grafana/grafana/pkg/services/plugindashboards/service"
	"github.com/grafana/grafana/pkg/services/pluginsintegration"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/advisor"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/angularinspector"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/angularpatternsstore"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/coreplugin"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/dashboards"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/installsync"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/keyretriever"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/keyretriever/dynamic"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/keystore"
	licensing2 "github.com/grafana/grafana/pkg/services/pluginsintegration/licensing"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/loader"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginaccesscontrol"
	pluginassets2 "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginassets"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginconfig"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/plugininstaller"
	service3 "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsources"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsso"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/renderer"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/sandbox"
	"github.com/grafana/grafana/pkg/services/pluginsintegration/serviceregistration"
	"github.com/grafana/grafana/pkg/services/preference/prefimpl"
	"github.com/grafana/grafana/pkg/services/promtypemigration"
	"github.com/grafana/grafana/pkg/services/provisioning"
	"github.com/grafana/grafana/pkg/services/publicdashboards"
	api2 "github.com/grafana/grafana/pkg/services/publicdashboards/api"
	database2 "github.com/grafana/grafana/pkg/services/publicdashboards/database"
	"github.com/grafana/grafana/pkg/services/publicdashboards/metric"
	service4 "github.com/grafana/grafana/pkg/services/publicdashboards/service"
	"github.com/grafana/grafana/pkg/services/query"
	"github.com/grafana/grafana/pkg/services/queryhistory"
	"github.com/grafana/grafana/pkg/services/quota/quotaimpl"
	"github.com/grafana/grafana/pkg/services/rendering"
	search2 "github.com/grafana/grafana/pkg/services/search"
	"github.com/grafana/grafana/pkg/services/search/sort"
	"github.com/grafana/grafana/pkg/services/searchusers"
	"github.com/grafana/grafana/pkg/services/searchusers/filters"
	"github.com/grafana/grafana/pkg/services/secrets"
	"github.com/grafana/grafana/pkg/services/secrets/database"
	kvstore2 "github.com/grafana/grafana/pkg/services/secrets/kvstore"
	migrations3 "github.com/grafana/grafana/pkg/services/secrets/kvstore/migrations"
	"github.com/grafana/grafana/pkg/services/secrets/manager"
	migrator5 "github.com/grafana/grafana/pkg/services/secrets/migrator"
	"github.com/grafana/grafana/pkg/services/serviceaccounts"
	"github.com/grafana/grafana/pkg/services/serviceaccounts/extsvcaccounts"
	manager2 "github.com/grafana/grafana/pkg/services/serviceaccounts/manager"
	"github.com/grafana/grafana/pkg/services/serviceaccounts/proxy"
	"github.com/grafana/grafana/pkg/services/serviceaccounts/retriever"
	"github.com/grafana/grafana/pkg/services/shorturls"
	"github.com/grafana/grafana/pkg/services/shorturls/shorturlimpl"
	"github.com/grafana/grafana/pkg/services/signingkeys"
	"github.com/grafana/grafana/pkg/services/signingkeys/signingkeysimpl"
	"github.com/grafana/grafana/pkg/services/sqlstore"
	"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
	"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
	"github.com/grafana/grafana/pkg/services/ssosettings"
	"github.com/grafana/grafana/pkg/services/ssosettings/ssosettingsimpl"
	api3 "github.com/grafana/grafana/pkg/services/star/api"
	"github.com/grafana/grafana/pkg/services/star/starimpl"
	"github.com/grafana/grafana/pkg/services/stats/statsimpl"
	"github.com/grafana/grafana/pkg/services/store"
	"github.com/grafana/grafana/pkg/services/store/resolver"
	"github.com/grafana/grafana/pkg/services/supportbundles"
	"github.com/grafana/grafana/pkg/services/supportbundles/bundleregistry"
	"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlesimpl"
	"github.com/grafana/grafana/pkg/services/tag"
	"github.com/grafana/grafana/pkg/services/tag/tagimpl"
	"github.com/grafana/grafana/pkg/services/team"
	"github.com/grafana/grafana/pkg/services/team/teamapi"
	"github.com/grafana/grafana/pkg/services/team/teamimpl"
	"github.com/grafana/grafana/pkg/services/temp_user"
	"github.com/grafana/grafana/pkg/services/temp_user/tempuserimpl"
	"github.com/grafana/grafana/pkg/services/updatemanager"
	"github.com/grafana/grafana/pkg/services/user"
	"github.com/grafana/grafana/pkg/services/user/userimpl"
	"github.com/grafana/grafana/pkg/services/validations"
	"github.com/grafana/grafana/pkg/setting"
	"github.com/grafana/grafana/pkg/storage/legacysql"
	"github.com/grafana/grafana/pkg/storage/legacysql/dualwrite"
	database3 "github.com/grafana/grafana/pkg/storage/secret/database"
	"github.com/grafana/grafana/pkg/storage/secret/encryption"
	"github.com/grafana/grafana/pkg/storage/secret/metadata"
	"github.com/grafana/grafana/pkg/storage/secret/migrator"
	"github.com/grafana/grafana/pkg/storage/unified"
	migrations2 "github.com/grafana/grafana/pkg/storage/unified/migrations"
	"github.com/grafana/grafana/pkg/storage/unified/resource"
	"github.com/grafana/grafana/pkg/storage/unified/search"
	"github.com/grafana/grafana/pkg/storage/unified/search/builders"
	"github.com/grafana/grafana/pkg/storage/unified/sql"
	"github.com/grafana/grafana/pkg/tsdb/azuremonitor"
	"github.com/grafana/grafana/pkg/tsdb/cloud-monitoring"
	"github.com/grafana/grafana/pkg/tsdb/cloudwatch"
	"github.com/grafana/grafana/pkg/tsdb/grafana-postgresql-datasource"
	"github.com/grafana/grafana/pkg/tsdb/grafana-pyroscope-datasource"
	"github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource"
	"github.com/grafana/grafana/pkg/tsdb/grafanads"
	"github.com/grafana/grafana/pkg/tsdb/graphite"
	"github.com/grafana/grafana/pkg/tsdb/influxdb"
	"github.com/grafana/grafana/pkg/tsdb/jaeger"
	"github.com/grafana/grafana/pkg/tsdb/loki"
	"github.com/grafana/grafana/pkg/tsdb/mssql"
	"github.com/grafana/grafana/pkg/tsdb/mysql"
	"github.com/grafana/grafana/pkg/tsdb/opentsdb"
	"github.com/grafana/grafana/pkg/tsdb/parca"
	"github.com/grafana/grafana/pkg/tsdb/prometheus"
	"github.com/grafana/grafana/pkg/tsdb/tempo"
	"github.com/grafana/grafana/pkg/tsdb/zipkin"
	"github.com/stretchr/testify/mock"
	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/trace"
)

import (
	_ "github.com/grafana/grafana/pkg/extensions"
)

// Injectors from wire.go:

func Initialize(ctx context.Context, cfg *setting.Cfg, opts Options, apiOpts api.ServerOptions) (*Server, error) {
	routeRegisterImpl := routing.ProvideRegister()
	configProvider, err := configprovider.ProvideService(cfg)
	if err != nil {
		return nil, err
	}
	tracingConfig, err := tracing.ProvideTracingConfig(configProvider)
	if err != nil {
		return nil, err
	}
	tracingService, err := tracing.ProvideService(tracingConfig)
	if err != nil {
		return nil, err
	}
	inProcBus := bus.ProvideBus(tracingService)
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return nil, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	ossMigrations := migrations.ProvideOSSMigrations(featureToggles)
	sqlStore, err := sqlstore.ProvideService(cfg, featureToggles, ossMigrations, inProcBus, tracingService)
	if err != nil {
		return nil, err
	}
	kvStore := kvstore.ProvideService(sqlStore)
	accessControl := acimpl.ProvideAccessControl(featureToggles)
	bundleregistryService := bundleregistry.ProvideService()
	usageStats, err := service.ProvideService(cfg, kvStore, routeRegisterImpl, tracingService, accessControl, bundleregistryService)
	if err != nil {
		return nil, err
	}
	secretsStoreImpl := database.ProvideSecretsStore(sqlStore)
	providerProvider := provider.ProvideEncryptionProvider()
	serviceService, err := service2.ProvideEncryptionService(tracingService, providerProvider, usageStats, cfg)
	if err != nil {
		return nil, err
	}
	osskmsprovidersService := osskmsproviders.ProvideService(serviceService, cfg, featureToggles)
	secretsService, err := manager.ProvideSecretsService(tracingService, secretsStoreImpl, osskmsprovidersService, serviceService, cfg, featureToggles, usageStats)
	if err != nil {
		return nil, err
	}
	remoteCache, err := remotecache.ProvideService(cfg, sqlStore, usageStats, secretsService)
	if err != nil {
		return nil, err
	}
	ossImpl := setting.ProvideProvider(cfg)
	pluginManagementCfg, err := pluginconfig.ProvidePluginManagementConfig(cfg, ossImpl, featureToggles)
	if err != nil {
		return nil, err
	}
	pluginInstanceCfg, err := pluginconfig.ProvidePluginInstanceConfig(cfg, ossImpl, featureToggles)
	if err != nil {
		return nil, err
	}
	hooksService := hooks.ProvideService()
	ossLicensingService := licensing.ProvideService(cfg, hooksService)
	licensingService := licensing2.ProvideLicensing(cfg, ossLicensingService)
	registerer := metrics.ProvideRegisterer()
	ssosettingsimplService := ssosettingsimpl.ProvideService(cfg, sqlStore, accessControl, routeRegisterImpl, featureToggles, secretsService, usageStats, registerer, ossImpl, ossLicensingService)
	defaultSettingsProvider := pluginsso.ProvideDefaultSettingsProvider(ssosettingsimplService)
	envVarsProvider := pluginconfig.NewEnvVarsProvider(pluginInstanceCfg, licensingService, defaultSettingsProvider)
	inMemory := registry.ProvideService()
	rendererManager, err := renderer.ProvideService(pluginManagementCfg, envVarsProvider, inMemory, tracingService)
	if err != nil {
		return nil, err
	}
	renderingService, err := rendering.ProvideService(cfg, featureToggles, remoteCache, rendererManager)
	if err != nil {
		return nil, err
	}
	cacheService := localcache.ProvideService()
	ossDataSourceRequestValidator := validations.ProvideValidator()
	pluginsourcesService := pluginsources.ProvideService(cfg, pluginManagementCfg)
	discovery := pipeline.ProvideDiscoveryStage(pluginManagementCfg, inMemory)
	keystoreService := keystore.ProvideService(kvStore)
	keyRetriever := dynamic.ProvideService(cfg, keystoreService)
	keyretrieverService := keyretriever.ProvideService(keyRetriever)
	signatureSignature := signature.ProvideService(pluginManagementCfg, keyretrieverService)
	localProvider := pluginassets.NewLocalProvider()
	pluginscdnService := pluginscdn.ProvideService(pluginManagementCfg)
	bootstrap := pipeline.ProvideBootstrapStage(pluginManagementCfg, signatureSignature, localProvider, pluginscdnService)
	unsignedPluginAuthorizer := signature.ProvideOSSAuthorizer(pluginManagementCfg)
	validation := signature.ProvideValidatorService(unsignedPluginAuthorizer)
	angularpatternsstoreService := angularpatternsstore.ProvideService(kvStore)
	angulardetectorsproviderDynamic, err := angulardetectorsprovider.ProvideDynamic(cfg, angularpatternsstoreService)
	if err != nil {
		return nil, err
	}
	angularinspectorService, err := angularinspector.ProvideService(angulardetectorsproviderDynamic)
	if err != nil {
		return nil, err
	}
	validate := pipeline.ProvideValidationStage(pluginManagementCfg, validation, angularinspectorService)
	tracer := otelTracer()
	ossDataSourceRequestURLValidator := validations.ProvideURLValidator()
	httpclientProvider := httpclientprovider.New(cfg, ossDataSourceRequestURLValidator, tracingService)
	azuremonitorService := azuremonitor.ProvideService(httpclientProvider)
	cloudwatchService := cloudwatch.ProvideService()
	cloudmonitoringService := cloudmonitoring.ProvideService(httpclientProvider)
	graphiteService := graphite.ProvideService(httpclientProvider, tracer)
	influxdbService := influxdb.ProvideService(httpclientProvider)
	lokiService := loki.ProvideService(httpclientProvider, tracer)
	opentsdbService := opentsdb.ProvideService(httpclientProvider)
	prometheusService := prometheus.ProvideService(httpclientProvider)
	tempoService := tempo.ProvideService(httpclientProvider, tracer)
	testdatasourceService := testdatasource.ProvideService()
	postgresService := postgres.ProvideService()
	mysqlService := mysql.ProvideService()
	mssqlService := mssql.ProvideService()
	quotaService := quotaimpl.ProvideService(ctx, sqlStore, configProvider)
	systemUsers := store.ProvideSystemUsersService()
	storageService, err := store.ProvideService(sqlStore, featureToggles, cfg, quotaService, systemUsers)
	if err != nil {
		return nil, err
	}
	grafanadsService := grafanads.ProvideService(storageService, featureToggles)
	pyroscopeService := pyroscope.ProvideService(httpclientProvider)
	parcaService := parca.ProvideService(httpclientProvider)
	zipkinService := zipkin.ProvideService(httpclientProvider)
	jaegerService := jaeger.ProvideService(httpclientProvider)
	corepluginRegistry := coreplugin.ProvideCoreRegistry(tracer, azuremonitorService, cloudwatchService, cloudmonitoringService, graphiteService, influxdbService, lokiService, opentsdbService, prometheusService, tempoService, testdatasourceService, postgresService, mysqlService, mssqlService, grafanadsService, pyroscopeService, parcaService, zipkinService, jaegerService)
	backendFactoryProvider := coreplugin.ProvideCoreProvider(corepluginRegistry)
	processService := process.ProvideService()
	orgService, err := orgimpl.ProvideService(sqlStore, cfg, quotaService)
	if err != nil {
		return nil, err
	}
	eventualRestConfigProvider := apiserver.ProvideEventualRestConfigProvider()
	teamimplService, err := teamimpl.ProvideService(sqlStore, cfg, tracingService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	userimplService, err := userimpl.ProvideService(sqlStore, orgService, cfg, teamimplService, cacheService, tracingService, quotaService, bundleregistryService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	actionSetService := resourcepermissions.NewActionSetService()
	permissionRegistry := permreg.ProvidePermissionRegistry()
	serverLockService := serverlock.ProvideService(sqlStore, tracingService)
	acimplService, err := acimpl.ProvideService(cfg, sqlStore, routeRegisterImpl, cacheService, accessControl, userimplService, actionSetService, featureToggles, tracingService, permissionRegistry, serverLockService)
	if err != nil {
		return nil, err
	}
	apikeyService, err := apikeyimpl.ProvideService(sqlStore, cfg, quotaService)
	if err != nil {
		return nil, err
	}
	retrieverService := retriever.ProvideService(sqlStore, apikeyService, kvStore, userimplService, orgService)
	serviceAccountPermissionsService, err := ossaccesscontrol.ProvideServiceAccountPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, retrieverService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	serviceAccountsService, err := manager2.ProvideServiceAccountsService(cfg, usageStats, sqlStore, apikeyService, kvStore, userimplService, orgService, acimplService, serviceAccountPermissionsService, serverLockService)
	if err != nil {
		return nil, err
	}
	extSvcAccountsService := extsvcaccounts.ProvideExtSvcAccountsService(acimplService, cfg, inProcBus, sqlStore, featureToggles, registerer, serviceAccountsService, secretsService, tracingService)
	registryRegistry := registry2.ProvideExtSvcRegistry(cfg, extSvcAccountsService, serverLockService, featureToggles)
	service13 := service3.ProvideService(sqlStore, secretsService)
	serviceregistrationService := serviceregistration.ProvideService(cfg, featureToggles, registryRegistry, service13)
	noop := provisionedplugins.NewNoop()
	initialize := pipeline.ProvideInitializationStage(pluginManagementCfg, inMemory, backendFactoryProvider, processService, serviceregistrationService, acimplService, actionSetService, envVarsProvider, tracingService, noop)
	terminate, err := pipeline.ProvideTerminationStage(pluginManagementCfg, inMemory, processService)
	if err != nil {
		return nil, err
	}
	errorRegistry := pluginerrs.ProvideErrorTracker()
	loaderLoader := loader.ProvideService(pluginManagementCfg, discovery, bootstrap, validate, initialize, terminate, errorRegistry)
	pluginstoreService, err := pluginstore.ProvideService(inMemory, pluginsourcesService, loaderLoader, featureToggles)
	if err != nil {
		return nil, err
	}
	filestoreService := filestore.ProvideService(inMemory)
	fileStoreManager := dashboards.ProvideFileStoreManager(pluginstoreService, filestoreService)
	folderStoreImpl := folderimpl.ProvideStore(sqlStore, cfg)
	publicDashboardStoreImpl := database2.ProvideStore(sqlStore, cfg, featureToggles)
	publicDashboardServiceWrapperImpl := service4.ProvideServiceWrapper(publicDashboardStoreImpl)
	contextHandler := grpccontext.ProvideContextHandler(tracingService)
	authenticator := interceptors.ProvideAuthenticator(apikeyService, userimplService, acimplService, contextHandler)
	grpcserverProvider, err := grpcserver.ProvideService(cfg, featureToggles, authenticator, tracer, registerer)
	if err != nil {
		return nil, err
	}
	storeProvider := store2.ProvideDefaultStoreProvider()
	server, err := authz.ProvideEmbeddedZanzanaServer(cfg, sqlStore, tracingService, featureToggles, registerer, eventualRestConfigProvider, storeProvider)
	if err != nil {
		return nil, err
	}
	zanzanaClient, err := authz.ProvideZanzanaClient(cfg, sqlStore, server, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	accessClient, err := authz.ProvideAuthZClient(cfg, featureToggles, grpcserverProvider, tracingService, registerer, sqlStore, acimplService, zanzanaClient, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	ossDashboardStats := builders.ProvideDashboardStats()
	documentBuilderSupplier := search.ProvideDocumentBuilders(sqlStore, ossDashboardStats)
	clockClock := clock.ProvideClock()
	databaseDatabase := database3.ProvideDatabase(sqlStore, tracer)
	secureValueMetadataStorage, err := metadata.ProvideSecureValueMetadataStorage(clockClock, databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	secureValueValidator := validator.ProvideSecureValueValidator()
	secureValueMutator := mutator.ProvideSecureValueMutator()
	keeperMetadataStorage, err := metadata.ProvideKeeperMetadataStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	encryptedValueStorage, err := encryption.ProvideEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return nil, err
	}
	dataKeyStorage, err := encryption.ProvideDataKeyStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	cipher, err := service5.ProvideAESGCMCipherService(tracer, usageStats)
	if err != nil {
		return nil, err
	}
	providerConfig, err := kmsproviders.ProvideOSSKMSProviders(cfg, cipher)
	if err != nil {
		return nil, err
	}
	dataKeyCache := manager3.ProvideOSSDataKeyCache(cfg)
	encryptionManager, err := manager3.ProvideEncryptionManager(tracer, dataKeyStorage, usageStats, cipher, providerConfig, dataKeyCache, cfg)
	if err != nil {
		return nil, err
	}
	globalEncryptedValueStorage, err := encryption.ProvideGlobalEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return nil, err
	}
	encryptedValueMigrationExecutor, err := encryption.ProvideEncryptedValueMigrationExecutor(databaseDatabase, tracer, encryptedValueStorage, globalEncryptedValueStorage)
	if err != nil {
		return nil, err
	}
	secretDBMigrator := migrator.NewWithEngine(sqlStore)
	dependencyRegisterer, err := secret.RegisterDependencies(featureToggles, cfg, secretDBMigrator, acimplService)
	if err != nil {
		return nil, err
	}
	ossKeeperService, err := secretkeeper.ProvideService(tracer, encryptedValueStorage, encryptionManager, encryptedValueMigrationExecutor, registerer, cfg, dependencyRegisterer)
	if err != nil {
		return nil, err
	}
	secureValueService := service6.ProvideSecureValueService(tracer, accessClient, secureValueMetadataStorage, secureValueValidator, secureValueMutator, keeperMetadataStorage, ossKeeperService, registerer)
	inlineSecureValueSupport, err := inline.ProvideInlineSecureValueService(cfg, tracer, secureValueService, accessClient)
	if err != nil {
		return nil, err
	}
	options := &unified.Options{
		Cfg:          cfg,
		Features:     featureToggles,
		DB:           sqlStore,
		Tracer:       tracingService,
		Reg:          registerer,
		Authzc:       accessClient,
		Docs:         documentBuilderSupplier,
		SecureValues: inlineSecureValueSupport,
	}
	storageMetrics := resource.ProvideStorageMetrics(registerer)
	bleveIndexMetrics := resource.ProvideIndexMetrics(registerer)
	resourceClient, err := unified.ProvideUnifiedStorageClient(options, storageMetrics, bleveIndexMetrics)
	if err != nil {
		return nil, err
	}
	legacyDatabaseProvider := legacysql.NewDatabaseProvider(sqlStore)
	stubProvisioningService, err := provisioning.ProvideStubProvisioningService(cfg)
	if err != nil {
		return nil, err
	}
	legacyMigrator := legacy.ProvideMigrator(legacyDatabaseProvider, stubProvisioningService, accessControl)
	foldersDashboardsMigrator := migrator2.ProvideFoldersDashboardsMigrator(legacyMigrator)
	playlistMigrator := playlist.ProvidePlaylistMigrator(legacyDatabaseProvider)
	shortURLMigrator := migrator3.ProvideShortURLMigrator(legacyDatabaseProvider)
	secretsKVStore, err := kvstore2.ProvideService(sqlStore, secretsService)
	if err != nil {
		return nil, err
	}
	datasourcePermissionsService := ossaccesscontrol.ProvideDatasourcePermissionsService(cfg, featureToggles, sqlStore)
	orgRoleMapper := connectors.ProvideOrgRoleMapper(cfg, orgService)
	socialService := socialimpl.ProvideService(cfg, featureToggles, usageStats, bundleregistryService, remoteCache, orgRoleMapper, ssosettingsimplService)
	loginStore, err := authinfoimpl.ProvideStore(sqlStore, secretsService)
	if err != nil {
		return nil, err
	}
	authinfoimplService := authinfoimpl.ProvideService(loginStore, remoteCache, secretsService)
	userAuthTokenService, err := authimpl.ProvideUserAuthTokenService(sqlStore, serverLockService, quotaService, secretsService, cfg, tracingService, featureToggles)
	if err != nil {
		return nil, err
	}
	oauthtokenService := oauthtoken.ProvideService(socialService, authinfoimplService, cfg, registerer, serverLockService, tracingService, userAuthTokenService, featureToggles)
	ossCachingService := caching.ProvideCachingService()
	cachingServiceClient := caching.ProvideCachingServiceClient(ossCachingService, featureToggles)
	middlewareHandler, err := pluginsintegration.ProvideClientWithMiddlewares(cfg, inMemory, oauthtokenService, tracingService, cachingServiceClient, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	requestConfigProvider := pluginconfig.NewRequestConfigProvider(pluginInstanceCfg, defaultSettingsProvider)
	baseProvider := plugincontext.ProvideBaseService(cfg, requestConfigProvider)
	dataSourceRetriever := service7.ProvideDataSourceRetriever(sqlStore, featureToggles)
	service14, err := service7.ProvideService(sqlStore, secretsService, secretsKVStore, cfg, featureToggles, accessControl, datasourcePermissionsService, quotaService, pluginstoreService, middlewareHandler, baseProvider, dataSourceRetriever)
	if err != nil {
		return nil, err
	}
	dataSourceMigrator := migrator4.ProvideDataSourceMigrator(service14, inlineSecureValueSupport)
	starsMigrator := legacy2.ProvideStarsMigrator(legacyDatabaseProvider)
	migrationRegistry := provideMigrationRegistry(foldersDashboardsMigrator, playlistMigrator, shortURLMigrator, dataSourceMigrator, starsMigrator)
	unifiedMigrator := migrations2.ProvideUnifiedMigrator(resourceClient, migrationRegistry)
	unifiedStorageMigrationService := migrations2.ProvideUnifiedStorageMigrationService(unifiedMigrator, legacyDatabaseProvider, cfg, sqlStore, kvStore, resourceClient, migrationRegistry)
	migrationStatusReader, err := migrations2.ProvideMigrationStatusReader(sqlStore, cfg, migrationRegistry, registerer)
	if err != nil {
		return nil, err
	}
	dualwriteService, err := dualwrite.ProvideService(featureToggles, kvStore, cfg, unifiedStorageMigrationService, migrationStatusReader, registerer)
	if err != nil {
		return nil, err
	}
	sortService := sort.ProvideService()
	folderimplService := folderimpl.ProvideService(folderStoreImpl, accessControl, inProcBus, userimplService, sqlStore, featureToggles, bundleregistryService, publicDashboardServiceWrapperImpl, cfg, registerer, tracer, resourceClient, dualwriteService, sortService, eventualRestConfigProvider)
	folderPermissionsService, err := ossaccesscontrol.ProvideFolderPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, folderimplService, acimplService, teamimplService, userimplService, actionSetService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	k8sHandlerWithFallback := client.ProvideK8sClientWithFallback(cfg, eventualRestConfigProvider, userimplService, resourceClient, featureToggles, dualwriteService, sortService, registerer)
	dashboardServiceImpl, err := service8.ProvideDashboardServiceImpl(cfg, sqlStore, featureToggles, folderPermissionsService, accessControl, acimplService, folderimplService, registerer, quotaService, orgService, publicDashboardServiceWrapperImpl, dualwriteService, serverLockService, kvStore, k8sHandlerWithFallback)
	if err != nil {
		return nil, err
	}
	pluginService := service8.ProvideDashboardPluginService(featureToggles, dashboardServiceImpl)
	service15 := service9.ProvideService(fileStoreManager, pluginService)
	pluginerrsStore := pluginerrs.ProvideStore(errorRegistry)
	repoManager, err := repo.ProvideService(pluginManagementCfg)
	if err != nil {
		return nil, err
	}
	pluginInstaller := manager4.ProvideInstaller(pluginManagementCfg, inMemory, loaderLoader, repoManager, serviceregistrationService)
	ossProvider := guardian.ProvideGuardian()
	cacheServiceImpl := service7.ProvideCacheService(cacheService, sqlStore, ossProvider)
	shortURLService := shorturlimpl.ProvideService(sqlStore)
	queryHistoryService := queryhistory.ProvideService(cfg, sqlStore, routeRegisterImpl, accessControl, featureToggles, eventualRestConfigProvider)
	dashboardService := service8.ProvideDashboardService(featureToggles, dashboardServiceImpl)
	dashverService := dashverimpl.ProvideService(cfg, sqlStore, dashboardService, featureToggles, k8sHandlerWithFallback)
	dashboardSnapshotStore := database4.ProvideStore(sqlStore, cfg)
	serviceImpl := service10.ProvideService(dashboardSnapshotStore, secretsService, dashboardService)
	dBstore, err := store3.ProvideDBStore(cfg, featureToggles, sqlStore, folderimplService, dashboardService, accessControl, inProcBus)
	if err != nil {
		return nil, err
	}
	deleteExpiredService := image.ProvideDeleteExpiredService(dBstore)
	tempuserService := tempuserimpl.ProvideService(sqlStore, cfg)
	cleanupServiceImpl := annotationsimpl.ProvideCleanupService(sqlStore, cfg)
	cleanUpService := cleanup.ProvideService(cfg, featureToggles, serverLockService, shortURLService, sqlStore, queryHistoryService, dashverService, serviceImpl, deleteExpiredService, tempuserService, tracingService, cleanupServiceImpl, dBstore, eventualRestConfigProvider, orgService, teamimplService, service14)
	correlationsService, err := correlations.ProvideService(sqlStore, routeRegisterImpl, service14, accessControl, inProcBus, quotaService, cfg)
	if err != nil {
		return nil, err
	}
	mailer, err := notifications.ProvideSmtpService(cfg)
	if err != nil {
		return nil, err
	}
	notificationService, err := notifications.ProvideService(inProcBus, cfg, mailer, tempuserService)
	if err != nil {
		return nil, err
	}
	dashboardProvisioningService := service8.ProvideDashboardProvisioningService(featureToggles, dashboardServiceImpl)
	receiverPermissionsService, err := ossaccesscontrol.ProvideReceiverPermissionsService(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	azurePromMigrationService := promtypemigration.ProvideAzurePromMigrationService(service14, inMemory, repoManager, pluginInstaller, cfg)
	amazonPromMigrationService := promtypemigration.ProvideAmazonPromMigrationService(service14, inMemory, repoManager, pluginInstaller, cfg)
	promTypeMigrationProviderImpl := promtypemigration.ProvidePromTypeMigrationProvider(serverLockService, featureToggles, azurePromMigrationService, amazonPromMigrationService)
	routePermissionsService, err := ossaccesscontrol.ProvideRoutePermissionsService(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	provisioningServiceImpl, err := provisioning.ProvideService(accessControl, cfg, sqlStore, pluginstoreService, dBstore, serviceService, notificationService, dashboardProvisioningService, service14, correlationsService, dashboardService, folderimplService, service13, quotaService, secretsService, orgService, receiverPermissionsService, tracingService, dualwriteService, promTypeMigrationProviderImpl, serverLockService, routePermissionsService)
	if err != nil {
		return nil, err
	}
	dataSourceProxyService := datasourceproxy.ProvideService(cacheServiceImpl, ossDataSourceRequestValidator, pluginstoreService, cfg, httpclientProvider, oauthtokenService, service14, tracingService, secretsService, featureToggles)
	starService := starimpl.ProvideService(sqlStore)
	searchService := search2.ProvideService(cfg, sqlStore, starService, dashboardService, folderimplService, featureToggles, sortService)
	plugincontextProvider := plugincontext.ProvideService(cfg, cacheService, pluginstoreService, cacheServiceImpl, service14, service13, requestConfigProvider)
	dashboardAccessService := service8.ProvideDashboardAccessService(featureToggles, dashboardServiceImpl)
	grafanaLive, err := live.ProvideService(cfg, routeRegisterImpl, plugincontextProvider, pluginstoreService, middlewareHandler, cacheServiceImpl, usageStats, featureToggles, dashboardAccessService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	gateway := pushhttp.ProvideService(cfg, grafanaLive)
	authnimplService := authnimpl.ProvideService(cfg, tracingService, userAuthTokenService, usageStats, registerer, authinfoimplService)
	authnAuthenticator := authnimpl.ProvideAuthnServiceAuthenticateOnly(authnimplService)
	contexthandlerContextHandler := contexthandler.ProvideService(cfg, authnAuthenticator, featureToggles)
	logger := loggermw.Provide(cfg, featureToggles)
	qsDatasourceClientBuilder := dsquerierclient.NewNullQSDatasourceClientBuilder()
	exprService := expr.ProvideService(cfg, middlewareHandler, plugincontextProvider, featureToggles, registerer, tracingService, qsDatasourceClientBuilder)
	ngAlert := metrics2.ProvideService(registerer)
	tagimplService := tagimpl.ProvideService(sqlStore)
	repositoryImpl := annotationsimpl.ProvideService(sqlStore, cfg, featureToggles, tagimplService, tracingService, dBstore, dashboardService, registerer)
	alertNG, err := ngalert.ProvideService(cfg, featureToggles, cacheServiceImpl, service14, routeRegisterImpl, sqlStore, kvStore, exprService, dataSourceProxyService, quotaService, secretsService, notificationService, ngAlert, folderimplService, accessControl, dashboardService, renderingService, inProcBus, acimplService, repositoryImpl, pluginstoreService, tracingService, dBstore, httpclientProvider, plugincontextProvider, receiverPermissionsService, routePermissionsService, userimplService)
	if err != nil {
		return nil, err
	}
	libraryElementService := libraryelements.ProvideService(cfg, sqlStore, routeRegisterImpl, folderimplService, featureToggles, accessControl, dashboardService, eventualRestConfigProvider, userimplService)
	libraryPanelService, err := librarypanels.ProvideService(cfg, sqlStore, routeRegisterImpl, libraryElementService, folderimplService)
	if err != nil {
		return nil, err
	}
	grafanaService, err := updatemanager.ProvideGrafanaService(cfg, tracingService)
	if err != nil {
		return nil, err
	}
	managedpluginsNoop := managedplugins.NewNoop()
	preinstallImpl := pluginchecker.ProvidePreinstall(cfg)
	plugincheckerService := pluginchecker.ProvideService(managedpluginsNoop, noop, preinstallImpl)
	pluginsService, err := updatemanager.ProvidePluginsService(cfg, pluginstoreService, pluginInstaller, tracingService, featureToggles, plugincheckerService)
	if err != nil {
		return nil, err
	}
	ossSearchUserFilter := filters.ProvideOSSSearchUserFilter()
	ossService := searchusers.ProvideUsersService(cfg, ossSearchUserFilter, userimplService)
	queryServiceImpl := query.ProvideService(cfg, cacheServiceImpl, exprService, ossDataSourceRequestValidator, middlewareHandler, plugincontextProvider, qsDatasourceClientBuilder)
	serviceAccountsProxy, err := proxy.ProvideServiceAccountsProxy(cfg, accessControl, acimplService, featureToggles, serviceAccountPermissionsService, serviceAccountsService, routeRegisterImpl)
	if err != nil {
		return nil, err
	}
	calculator := pluginassets2.ProvideModuleHashCalculator(pluginManagementCfg, pluginscdnService, signatureSignature, inMemory)
	pluginassetsService := pluginassets2.ProvideService(calculator)
	avatarCacheServer := avatar.ProvideAvatarCacheServer(cfg)
	prefService := prefimpl.ProvideService(sqlStore, cfg)
	dashboardPermissionsService, err := ossaccesscontrol.ProvideDashboardPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, dashboardService, folderimplService, acimplService, teamimplService, userimplService, actionSetService, dashboardServiceImpl, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	csrfCSRF := csrf.ProvideCSRFFilter(cfg)
	secretsMigrator := migrator5.ProvideSecretsMigrator(serviceService, secretsService, sqlStore, ossImpl, featureToggles)
	dataSourceSecretMigrationService := migrations3.ProvideDataSourceMigrationService(service14, kvStore, featureToggles)
	secretMigrationProviderImpl := migrations3.ProvideSecretMigrationProvider(serverLockService, dataSourceSecretMigrationService)
	publicDashboardServiceImpl := service4.ProvideService(cfg, featureToggles, publicDashboardStoreImpl, queryServiceImpl, repositoryImpl, accessControl, publicDashboardServiceWrapperImpl, dashboardService, ossLicensingService)
	middleware := api2.ProvideMiddleware()
	apiApi := api2.ProvideApi(publicDashboardServiceImpl, routeRegisterImpl, accessControl, featureToggles, middleware, cfg, ossLicensingService)
	loginattemptimplService := loginattemptimpl.ProvideService(sqlStore, cfg, serverLockService)
	deletionService, err := orgimpl.ProvideDeletionService(sqlStore, cfg, dashboardService, accessControl, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	authnService := authnimpl.ProvideAuthnService(authnimplService)
	navtreeService := navtreeimpl.ProvideService(cfg, accessControl, pluginstoreService, service13, starService, featureToggles, dashboardService, acimplService, kvStore, apikeyService, ossLicensingService, authnService)
	statsService := statsimpl.ProvideService(cfg, sqlStore, dashboardService, folderimplService, orgService, resourceClient, featureToggles)
	gatherer := metrics.ProvideGatherer()
	apiAPI := api3.ProvideApi(cfg, featureToggles, starService, eventualRestConfigProvider)
	anonUserLimitValidatorImpl := validator2.ProvideAnonUserLimitValidator()
	anonDeviceService := anonimpl.ProvideAnonymousDeviceService(usageStats, authnService, sqlStore, cfg, orgService, serverLockService, accessControl, routeRegisterImpl, anonUserLimitValidatorImpl)
	signingkeysimplService, err := signingkeysimpl.ProvideEmbeddedSigningKeysService(sqlStore, secretsService, remoteCache, routeRegisterImpl)
	if err != nil {
		return nil, err
	}
	localSigner, err := idimpl.ProvideLocalSigner(signingkeysimplService)
	if err != nil {
		return nil, err
	}
	idimplService := idimpl.ProvideService(cfg, localSigner, remoteCache, authnService, registerer, tracer)
	verifier := userimpl.ProvideVerifier(cfg, userimplService, tempuserService, notificationService, idimplService)
	httpServer, err := api.ProvideHTTPServer(apiOpts, cfg, routeRegisterImpl, inProcBus, renderingService, ossLicensingService, hooksService, cacheService, sqlStore, ossDataSourceRequestValidator, pluginstoreService, service15, pluginstoreService, middlewareHandler, pluginerrsStore, pluginInstaller, ossImpl, cacheServiceImpl, userAuthTokenService, cleanUpService, shortURLService, queryHistoryService, correlationsService, remoteCache, provisioningServiceImpl, accessControl, dataSourceProxyService, searchService, grafanaLive, gateway, plugincontextProvider, contexthandlerContextHandler, logger, featureToggles, alertNG, libraryPanelService, libraryElementService, quotaService, socialService, tracingService, serviceService, grafanaService, pluginsService, ossService, service14, queryServiceImpl, filestoreService, serviceAccountsProxy, pluginassetsService, authinfoimplService, storageService, notificationService, dashboardService, dashboardProvisioningService, folderimplService, ossProvider, serviceImpl, service13, avatarCacheServer, prefService, folderPermissionsService, dashboardPermissionsService, dashverService, starService, csrfCSRF, managedpluginsNoop, apikeyService, kvStore, secretsMigrator, secretsService, secretMigrationProviderImpl, secretsKVStore, apiApi, userimplService, tempuserService, loginattemptimplService, orgService, deletionService, teamimplService, acimplService, navtreeService, repositoryImpl, tagimplService, oauthtokenService, statsService, authnService, pluginscdnService, gatherer, apiAPI, registerer, eventualRestConfigProvider, anonDeviceService, verifier, preinstallImpl, publicDashboardServiceImpl)
	if err != nil {
		return nil, err
	}
	validatorService, err := validator3.ProvideService(pluginstoreService)
	if err != nil {
		return nil, err
	}
	sandboxService := sandbox.ProvideService(cfg)
	advisorService, err := advisor.ProvideService(cfg, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	statscollectorService := statscollector.ProvideService(usageStats, validatorService, statsService, cfg, sqlStore, socialService, pluginstoreService, featureManager, service14, httpclientProvider, sandboxService, advisorService)
	internalMetricsService, err := metrics.ProvideService(cfg, registerer, gatherer)
	if err != nil {
		return nil, err
	}
	entityEventsService := store.ProvideEntityEventsService(cfg, sqlStore, featureToggles)
	supportbundlesimplService, err := supportbundlesimpl.ProvideService(accessControl, acimplService, bundleregistryService, cfg, featureToggles, httpServer, kvStore, service13, pluginstoreService, routeRegisterImpl, ossImpl, sqlStore, usageStats, tracingService)
	if err != nil {
		return nil, err
	}
	metricService, err := metric.ProvideService(publicDashboardStoreImpl, registerer)
	if err != nil {
		return nil, err
	}
	scopedPluginDatasourceProvider := datasource.ProvideDefaultPluginConfigs(service14, cacheServiceImpl, plugincontextProvider, cfg)
	v := builder.ProvideDefaultBuildHandlerChainFuncFromBuilders()
	aggregatorRunner := aggregatorrunner.ProvideNoopAggregatorConfigurator()
	appInstaller, err := playlist2.RegisterAppInstaller(featureToggles)
	if err != nil {
		return nil, err
	}
	pluginsAppInstaller, err := plugins.ProvideAppInstaller(configProvider, eventualRestConfigProvider, pluginstoreService, calculator, acimplService, accessClient, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	liveAppInstaller, err := live2.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	shortURLAppInstaller, err := shorturl.RegisterAppInstaller(cfg, shortURLService)
	if err != nil {
		return nil, err
	}
	rulesAppInstaller, err := rules.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	correlationsAppInstaller, err := correlations2.RegisterAppInstaller(cfg, featureToggles, correlationsService)
	if err != nil {
		return nil, err
	}
	notificationsAppInstaller, err := notifications2.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	logsDrilldownAppInstaller, err := logsdrilldown.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	annotationAppInstaller, err := annotation.RegisterAppInstaller(cfg, repositoryImpl, cleanupServiceImpl, accessClient)
	if err != nil {
		return nil, err
	}
	exampleAppInstaller, err := example.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	checkregistryService := checkregistry.ProvideService(service14, pluginstoreService, plugincontextProvider, middlewareHandler, plugincheckerService, repoManager, preinstallImpl, managedpluginsNoop, noop, ssosettingsimplService, cfg, pluginerrsStore)
	advisorAppInstaller, err := advisor2.ProvideAppInstaller(acimplService, accessClient, checkregistryService, cfg, orgService, registerer)
	if err != nil {
		return nil, err
	}
	historianAppInstaller, err := historian.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	quotasAppInstaller, err := quotas.RegisterAppInstaller(cfg, featureToggles, resourceClient)
	if err != nil {
		return nil, err
	}
	dashValidatorAppInstaller, err := dashvalidator.RegisterAppInstaller(service14, httpclientProvider, accessControl)
	if err != nil {
		return nil, err
	}
	v2 := appregistry.ProvideAppInstallers(featureToggles, cfg, appInstaller, pluginsAppInstaller, liveAppInstaller, shortURLAppInstaller, rulesAppInstaller, correlationsAppInstaller, notificationsAppInstaller, logsDrilldownAppInstaller, annotationAppInstaller, exampleAppInstaller, advisorAppInstaller, historianAppInstaller, quotasAppInstaller, dashValidatorAppInstaller)
	builderMetrics := builder.ProvideBuilderMetrics(registerer)
	backend := auditing.ProvideNoopBackend()
	policyRuleProvider := auditing.ProvideNoopPolicyRuleProvider()
	apiserverService, err := apiserver.ProvideService(cfg, featureToggles, routeRegisterImpl, tracingService, sqlStore, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, pluginstoreService, dualwriteService, resourceClient, inlineSecureValueSupport, eventualRestConfigProvider, v, eventualRestConfigProvider, registerer, aggregatorRunner, v2, builderMetrics, backend, policyRuleProvider)
	if err != nil {
		return nil, err
	}
	pluginexternalService, err := pluginexternal.ProvideService(cfg, pluginstoreService)
	if err != nil {
		return nil, err
	}
	plugininstallerService, err := plugininstaller.ProvideService(cfg, pluginstoreService, pluginInstaller, registerer, repoManager, plugincheckerService)
	if err != nil {
		return nil, err
	}
	zanzanaReconciler := dualwrite2.ProvideZanzanaReconciler(cfg, featureToggles, zanzanaClient, sqlStore, serverLockService, folderimplService, registerer)
	appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, cfg)
	if err != nil {
		return nil, err
	}
	importDashboardService := service11.ProvideService(routeRegisterImpl, quotaService, service15, pluginstoreService, libraryPanelService, dashboardService, accessControl, folderimplService, featureToggles)
	dashboardUpdater := service9.ProvideDashboardUpdater(inProcBus, pluginstoreService, service15, importDashboardService, service13, pluginService, dashboardService)
	worker := garbagecollectionworker.ProvideWorker(cfg, secureValueMetadataStorage, keeperMetadataStorage, ossKeeperService)
	fixedRolesLoader := accesscontrol.ProvideFixedRolesLoader(acimplService, featureToggles)
	noopIAMRolesSyncer := accesscontrol.ProvideNoopIAMRolesSyncer()
	clientGenerator := apiserver.ProvideClientGenerator(eventualRestConfigProvider)
	syncer, err := installsync.ProvideSyncer(featureToggles, clientGenerator, orgService, configProvider, serverLockService, eventualRestConfigProvider, pluginstoreService)
	if err != nil {
		return nil, err
	}
	embeddedZanzanaService := authz.ProvideEmbeddedZanzanaService(cfg, server, tracingService)
	healthService := grpcserver.ProvideHealthService(grpcserverProvider)
	reflectionService, err := grpcserver.ProvideReflectionService(cfg, grpcserverProvider)
	if err != nil {
		return nil, err
	}
	ossGroups := ldap.ProvideGroupsService()
	identitySynchronizer := authnimpl.ProvideIdentitySynchronizer(authnimplService)
	ldapImpl := service12.ProvideService(cfg, featureToggles, ssosettingsimplService)
	apiService := api4.ProvideService(cfg, routeRegisterImpl, accessControl, userimplService, authinfoimplService, ossGroups, identitySynchronizer, orgService, ldapImpl, userAuthTokenService, bundleregistryService)
	dashboardActivityChannel := live.ProvideDashboardActivityChannel(grafanaLive)
	dashboardsAPIBuilder := dashboard.RegisterAPIService(featureToggles, apiserverService, dashboardService, service14, dashboardServiceImpl, dashboardPermissionsService, accessControl, accessClient, provisioningServiceImpl, registerer, sqlStore, tracingService, resourceClient, dualwriteService, quotaService, eventualRestConfigProvider, userimplService, libraryElementService, publicDashboardServiceImpl, serviceImpl, dashboardActivityChannel, configProvider)
	dataSourceAPIBuilder, err := datasource.RegisterAPIService(featureToggles, apiserverService, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, accessControl, registerer, pluginsourcesService)
	if err != nil {
		return nil, err
	}
	folderAPIBuilder := folders.RegisterAPIService(cfg, featureToggles, apiserverService, folderPermissionsService, accessControl, acimplService, accessClient, registerer, resourceClient, zanzanaClient)
	roleApiInstaller := iam.ProvideNoopRoleApiInstaller()
	globalRoleApiInstaller := iam.ProvideNoopGlobalRoleApiInstaller()
	teamLBACApiInstaller := iam.ProvideNoopTeamLBACApiInstaller()
	externalGroupMappingApiInstaller := iam.ProvideNoopExternalGroupMappingApiInstaller()
	storageBackendImpl := noopstorage.ProvideStorageBackend()
	noopTeamGroupsREST := externalgroupmapping.ProvideNoopTeamGroupsREST()
	noopSearchREST := externalgroupmapping.ProvideNoopSearchREST()
	mappersRegistry := resourcepermission.ProvideMappersRegistry()
	identityAccessManagementAPIBuilder, err := iam.RegisterAPIService(cfg, configProvider, featureToggles, apiserverService, ssosettingsimplService, sqlStore, accessControl, accessClient, zanzanaClient, registerer, roleApiInstaller, globalRoleApiInstaller, teamLBACApiInstaller, externalGroupMappingApiInstaller, tracingService, storageBackendImpl, noopTeamGroupsREST, noopSearchREST, dualwriteService, resourceClient, orgService, userimplService, teamimplService, eventualRestConfigProvider, mappersRegistry)
	if err != nil {
		return nil, err
	}
	legacyDataSourceLookup := service7.ProvideLegacyDataSourceLookup(service14)
	queryAPIBuilder, err := query2.RegisterAPIService(cfg, featureToggles, apiserverService, service14, pluginstoreService, accessControl, middlewareHandler, plugincontextProvider, registerer, tracingService, legacyDataSourceLookup, exprService)
	if err != nil {
		return nil, err
	}
	userStorageAPIBuilder := userstorage.RegisterAPIService(featureToggles, apiserverService, registerer)
	apiBuilder := preferences.RegisterAPIService(cfg, featureToggles, sqlStore, prefService, userimplService, apiserverService)
	collectionsAPIBuilder := collections.RegisterAPIService(cfg, featureToggles, sqlStore, starService, userimplService, apiserverService)
	webhookExtraBuilder := webhooks.ProvideWebhooksWithImages(cfg, renderingService, resourceClient, eventualRestConfigProvider, registerer)
	v3 := extras.ProvideProvisioningExtraAPIs(webhookExtraBuilder)
	pullRequestWorker := pullrequest.ProvidePullRequestWorker(cfg, renderingService, resourceClient, eventualRestConfigProvider, registerer)
	v4 := extras.ProvideExtraWorkers(pullRequestWorker)
	v5 := _wireValue
	decryptAuthorizer := decrypt.ProvideDecryptAuthorizer(tracer, v5)
	decryptStorage, err := metadata.ProvideDecryptStorage(tracer, ossKeeperService, keeperMetadataStorage, secureValueMetadataStorage, decryptAuthorizer, registerer)
	if err != nil {
		return nil, err
	}
	decryptService, err := decrypt.ProvideDecryptService(cfg, tracer, decryptStorage)
	if err != nil {
		return nil, err
	}
	factory := github.ProvideFactory()
	v6 := extras.ProvideProvisioningOSSRepositoryExtras(cfg, decryptService, factory, webhookExtraBuilder, registerer)
	repositoryFactory, err := extras.ProvideFactoryFromConfig(cfg, v6)
	if err != nil {
		return nil, err
	}
	githubFactory := github2.ProvideFactory()
	v7 := extras.ProvideProvisioningOSSConnectionExtras(cfg, decryptService, githubFactory, registerer)
	connectionFactory, err := extras.ProvideConnectionFactoryFromConfig(cfg, v7)
	if err != nil {
		return nil, err
	}
	quotaGetter := extras.ProvideQuotaGetter(cfg)
	provisioningAPIBuilder, err := provisioning2.RegisterAPIService(cfg, featureToggles, apiserverService, registerer, resourceClient, eventualRestConfigProvider, accessClient, dualwriteService, usageStats, tracingService, v3, v4, repositoryFactory, connectionFactory, quotaGetter)
	if err != nil {
		return nil, err
	}
	ofrepAPIBuilder, err := ofrep.RegisterAPIService(apiserverService, cfg)
	if err != nil {
		return nil, err
	}
	appPluginAPIBuilder, err := appplugin.RegisterAPIService(apiserverService, pluginsourcesService, service13, accessControl)
	if err != nil {
		return nil, err
	}
	provisioningDependencyRegisterer, err := provisioning2.RegisterDependencies(cfg, acimplService, featureToggles)
	if err != nil {
		return nil, err
	}
	apiregistryService := apiregistry.ProvideRegistryServiceSink(dashboardsAPIBuilder, dataSourceAPIBuilder, folderAPIBuilder, identityAccessManagementAPIBuilder, queryAPIBuilder, userStorageAPIBuilder, apiBuilder, collectionsAPIBuilder, provisioningAPIBuilder, ofrepAPIBuilder, appPluginAPIBuilder, dependencyRegisterer, provisioningDependencyRegisterer)
	teamPermissionsService, err := ossaccesscontrol.ProvideTeamPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	teamAPI := teamapi.ProvideTeamAPI(routeRegisterImpl, teamimplService, acimplService, accessControl, teamPermissionsService, userimplService, ossLicensingService, cfg, prefService, dashboardService, featureToggles, eventualRestConfigProvider)
	cloudmigrationService, err := cloudmigrationimpl.ProvideService(cfg, httpclientProvider, featureToggles, sqlStore, service14, secretsKVStore, secretsService, routeRegisterImpl, registerer, tracingService, dashboardService, folderimplService, pluginstoreService, service13, accessControl, acimplService, kvStore, libraryElementService, alertNG)
	if err != nil {
		return nil, err
	}
	authService, err := jwt.ProvideService(cfg, remoteCache)
	if err != nil {
		return nil, err
	}
	ossUserProtectionImpl := authinfoimpl.ProvideOSSUserProtectionService()
	registration := authnimpl.ProvideRegistration(cfg, authnService, orgService, userAuthTokenService, acimplService, permissionRegistry, apikeyService, userimplService, authService, ossUserProtectionImpl, loginattemptimplService, quotaService, authinfoimplService, renderingService, featureToggles, oauthtokenService, socialService, remoteCache, ldapImpl, ossImpl, tracingService, tempuserService, notificationService)
	backgroundServiceRegistry := backgroundsvcs.ProvideBackgroundServiceRegistry(httpServer, alertNG, cleanUpService, grafanaLive, gateway, notificationService, pluginstoreService, renderingService, userAuthTokenService, tracingService, provisioningServiceImpl, usageStats, statscollectorService, grafanaService, pluginsService, internalMetricsService, secretsService, remoteCache, storageService, entityEventsService, serviceAccountsService, grpcserverProvider, secretMigrationProviderImpl, loginattemptimplService, supportbundlesimplService, metricService, keyRetriever, angulardetectorsproviderDynamic, apiserverService, anonDeviceService, ssosettingsimplService, pluginexternalService, plugininstallerService, zanzanaReconciler, appregistryService, dashboardUpdater, dashboardServiceImpl, worker, fixedRolesLoader, noopIAMRolesSyncer, syncer, embeddedZanzanaService, serviceImpl, serviceAccountsProxy, healthService, reflectionService, apiService, apiregistryService, idimplService, teamAPI, ssosettingsimplService, cloudmigrationService, registration)
	usageStatsProvidersRegistry := usagestatssvcs.ProvideUsageStatsProvidersRegistry(acimplService, userimplService)
	serverServer, err := New(opts, cfg, httpServer, acimplService, provisioningServiceImpl, backgroundServiceRegistry, usageStatsProvidersRegistry, statscollectorService, tracingService, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	return serverServer, nil
}

var (
	_wireValue = []decrypt.ExtraOwnerDecrypter(nil)
)

func InitializeForTest(ctx context.Context, t sqlutil.ITestDB, testingT interface {
	Cleanup(func())
	mock.TestingT
}, cfg *setting.Cfg, opts Options, apiOpts api.ServerOptions) (*TestEnv, error) {
	routeRegisterImpl := routing.ProvideRegister()
	configProvider, err := configprovider.ProvideService(cfg)
	if err != nil {
		return nil, err
	}
	tracingConfig, err := tracing.ProvideTracingConfig(configProvider)
	if err != nil {
		return nil, err
	}
	tracingService, err := tracing.ProvideService(tracingConfig)
	if err != nil {
		return nil, err
	}
	inProcBus := bus.ProvideBus(tracingService)
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return nil, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	ossMigrations := migrations.ProvideOSSMigrations(featureToggles)
	sqlStore, err := sqlstore.ProvideServiceForTests(t, cfg, featureToggles, inProcBus, ossMigrations)
	if err != nil {
		return nil, err
	}
	kvStore := kvstore.ProvideService(sqlStore)
	accessControl := acimpl.ProvideAccessControl(featureToggles)
	bundleregistryService := bundleregistry.ProvideService()
	usageStats, err := service.ProvideService(cfg, kvStore, routeRegisterImpl, tracingService, accessControl, bundleregistryService)
	if err != nil {
		return nil, err
	}
	secretsStoreImpl := database.ProvideSecretsStore(sqlStore)
	providerProvider := provider.ProvideEncryptionProvider()
	serviceService, err := service2.ProvideEncryptionService(tracingService, providerProvider, usageStats, cfg)
	if err != nil {
		return nil, err
	}
	osskmsprovidersService := osskmsproviders.ProvideService(serviceService, cfg, featureToggles)
	secretsService, err := manager.ProvideSecretsService(tracingService, secretsStoreImpl, osskmsprovidersService, serviceService, cfg, featureToggles, usageStats)
	if err != nil {
		return nil, err
	}
	remoteCache, err := remotecache.ProvideService(cfg, sqlStore, usageStats, secretsService)
	if err != nil {
		return nil, err
	}
	ossImpl := setting.ProvideProvider(cfg)
	pluginManagementCfg, err := pluginconfig.ProvidePluginManagementConfig(cfg, ossImpl, featureToggles)
	if err != nil {
		return nil, err
	}
	pluginInstanceCfg, err := pluginconfig.ProvidePluginInstanceConfig(cfg, ossImpl, featureToggles)
	if err != nil {
		return nil, err
	}
	hooksService := hooks.ProvideService()
	ossLicensingService := licensing.ProvideService(cfg, hooksService)
	licensingService := licensing2.ProvideLicensing(cfg, ossLicensingService)
	registerer := metrics.ProvideRegistererForTest()
	ssosettingsimplService := ssosettingsimpl.ProvideService(cfg, sqlStore, accessControl, routeRegisterImpl, featureToggles, secretsService, usageStats, registerer, ossImpl, ossLicensingService)
	defaultSettingsProvider := pluginsso.ProvideDefaultSettingsProvider(ssosettingsimplService)
	envVarsProvider := pluginconfig.NewEnvVarsProvider(pluginInstanceCfg, licensingService, defaultSettingsProvider)
	inMemory := registry.ProvideService()
	rendererManager, err := renderer.ProvideService(pluginManagementCfg, envVarsProvider, inMemory, tracingService)
	if err != nil {
		return nil, err
	}
	renderingService, err := rendering.ProvideService(cfg, featureToggles, remoteCache, rendererManager)
	if err != nil {
		return nil, err
	}
	cacheService := localcache.ProvideService()
	ossDataSourceRequestValidator := validations.ProvideValidator()
	pluginsourcesService := pluginsources.ProvideService(cfg, pluginManagementCfg)
	discovery := pipeline.ProvideDiscoveryStage(pluginManagementCfg, inMemory)
	keystoreService := keystore.ProvideService(kvStore)
	keyRetriever := dynamic.ProvideService(cfg, keystoreService)
	keyretrieverService := keyretriever.ProvideService(keyRetriever)
	signatureSignature := signature.ProvideService(pluginManagementCfg, keyretrieverService)
	localProvider := pluginassets.NewLocalProvider()
	pluginscdnService := pluginscdn.ProvideService(pluginManagementCfg)
	bootstrap := pipeline.ProvideBootstrapStage(pluginManagementCfg, signatureSignature, localProvider, pluginscdnService)
	unsignedPluginAuthorizer := signature.ProvideOSSAuthorizer(pluginManagementCfg)
	validation := signature.ProvideValidatorService(unsignedPluginAuthorizer)
	angularpatternsstoreService := angularpatternsstore.ProvideService(kvStore)
	angulardetectorsproviderDynamic, err := angulardetectorsprovider.ProvideDynamic(cfg, angularpatternsstoreService)
	if err != nil {
		return nil, err
	}
	angularinspectorService, err := angularinspector.ProvideService(angulardetectorsproviderDynamic)
	if err != nil {
		return nil, err
	}
	validate := pipeline.ProvideValidationStage(pluginManagementCfg, validation, angularinspectorService)
	tracer := otelTracer()
	ossDataSourceRequestURLValidator := validations.ProvideURLValidator()
	httpclientProvider := httpclientprovider.New(cfg, ossDataSourceRequestURLValidator, tracingService)
	azuremonitorService := azuremonitor.ProvideService(httpclientProvider)
	cloudwatchService := cloudwatch.ProvideService()
	cloudmonitoringService := cloudmonitoring.ProvideService(httpclientProvider)
	graphiteService := graphite.ProvideService(httpclientProvider, tracer)
	influxdbService := influxdb.ProvideService(httpclientProvider)
	lokiService := loki.ProvideService(httpclientProvider, tracer)
	opentsdbService := opentsdb.ProvideService(httpclientProvider)
	prometheusService := prometheus.ProvideService(httpclientProvider)
	tempoService := tempo.ProvideService(httpclientProvider, tracer)
	testdatasourceService := testdatasource.ProvideService()
	postgresService := postgres.ProvideService()
	mysqlService := mysql.ProvideService()
	mssqlService := mssql.ProvideService()
	quotaService := quotaimpl.ProvideService(ctx, sqlStore, configProvider)
	systemUsers := store.ProvideSystemUsersService()
	storageService, err := store.ProvideService(sqlStore, featureToggles, cfg, quotaService, systemUsers)
	if err != nil {
		return nil, err
	}
	grafanadsService := grafanads.ProvideService(storageService, featureToggles)
	pyroscopeService := pyroscope.ProvideService(httpclientProvider)
	parcaService := parca.ProvideService(httpclientProvider)
	zipkinService := zipkin.ProvideService(httpclientProvider)
	jaegerService := jaeger.ProvideService(httpclientProvider)
	corepluginRegistry := coreplugin.ProvideCoreRegistry(tracer, azuremonitorService, cloudwatchService, cloudmonitoringService, graphiteService, influxdbService, lokiService, opentsdbService, prometheusService, tempoService, testdatasourceService, postgresService, mysqlService, mssqlService, grafanadsService, pyroscopeService, parcaService, zipkinService, jaegerService)
	backendFactoryProvider := coreplugin.ProvideCoreProvider(corepluginRegistry)
	processService := process.ProvideService()
	orgService, err := orgimpl.ProvideService(sqlStore, cfg, quotaService)
	if err != nil {
		return nil, err
	}
	eventualRestConfigProvider := apiserver.ProvideEventualRestConfigProvider()
	teamimplService, err := teamimpl.ProvideService(sqlStore, cfg, tracingService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	userimplService, err := userimpl.ProvideService(sqlStore, orgService, cfg, teamimplService, cacheService, tracingService, quotaService, bundleregistryService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	actionSetService := resourcepermissions.NewActionSetService()
	permissionRegistry := permreg.ProvidePermissionRegistry()
	serverLockService := serverlock.ProvideService(sqlStore, tracingService)
	acimplService, err := acimpl.ProvideService(cfg, sqlStore, routeRegisterImpl, cacheService, accessControl, userimplService, actionSetService, featureToggles, tracingService, permissionRegistry, serverLockService)
	if err != nil {
		return nil, err
	}
	apikeyService, err := apikeyimpl.ProvideService(sqlStore, cfg, quotaService)
	if err != nil {
		return nil, err
	}
	retrieverService := retriever.ProvideService(sqlStore, apikeyService, kvStore, userimplService, orgService)
	serviceAccountPermissionsService, err := ossaccesscontrol.ProvideServiceAccountPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, retrieverService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	serviceAccountsService, err := manager2.ProvideServiceAccountsService(cfg, usageStats, sqlStore, apikeyService, kvStore, userimplService, orgService, acimplService, serviceAccountPermissionsService, serverLockService)
	if err != nil {
		return nil, err
	}
	extSvcAccountsService := extsvcaccounts.ProvideExtSvcAccountsService(acimplService, cfg, inProcBus, sqlStore, featureToggles, registerer, serviceAccountsService, secretsService, tracingService)
	registryRegistry := registry2.ProvideExtSvcRegistry(cfg, extSvcAccountsService, serverLockService, featureToggles)
	service13 := service3.ProvideService(sqlStore, secretsService)
	serviceregistrationService := serviceregistration.ProvideService(cfg, featureToggles, registryRegistry, service13)
	noop := provisionedplugins.NewNoop()
	initialize := pipeline.ProvideInitializationStage(pluginManagementCfg, inMemory, backendFactoryProvider, processService, serviceregistrationService, acimplService, actionSetService, envVarsProvider, tracingService, noop)
	terminate, err := pipeline.ProvideTerminationStage(pluginManagementCfg, inMemory, processService)
	if err != nil {
		return nil, err
	}
	errorRegistry := pluginerrs.ProvideErrorTracker()
	loaderLoader := loader.ProvideService(pluginManagementCfg, discovery, bootstrap, validate, initialize, terminate, errorRegistry)
	pluginstoreService, err := pluginstore.ProvideService(inMemory, pluginsourcesService, loaderLoader, featureToggles)
	if err != nil {
		return nil, err
	}
	filestoreService := filestore.ProvideService(inMemory)
	fileStoreManager := dashboards.ProvideFileStoreManager(pluginstoreService, filestoreService)
	folderStoreImpl := folderimpl.ProvideStore(sqlStore, cfg)
	publicDashboardStoreImpl := database2.ProvideStore(sqlStore, cfg, featureToggles)
	publicDashboardServiceWrapperImpl := service4.ProvideServiceWrapper(publicDashboardStoreImpl)
	contextHandler := grpccontext.ProvideContextHandler(tracingService)
	authenticator := interceptors.ProvideAuthenticator(apikeyService, userimplService, acimplService, contextHandler)
	grpcserverProvider, err := grpcserver.ProvideService(cfg, featureToggles, authenticator, tracer, registerer)
	if err != nil {
		return nil, err
	}
	storeProvider := store2.ProvideDefaultStoreProvider()
	server, err := authz.ProvideEmbeddedZanzanaServer(cfg, sqlStore, tracingService, featureToggles, registerer, eventualRestConfigProvider, storeProvider)
	if err != nil {
		return nil, err
	}
	zanzanaClient, err := authz.ProvideZanzanaClient(cfg, sqlStore, server, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	accessClient, err := authz.ProvideAuthZClient(cfg, featureToggles, grpcserverProvider, tracingService, registerer, sqlStore, acimplService, zanzanaClient, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	ossDashboardStats := builders.ProvideDashboardStats()
	documentBuilderSupplier := search.ProvideDocumentBuilders(sqlStore, ossDashboardStats)
	clockClock := clock.ProvideClock()
	databaseDatabase := database3.ProvideDatabase(sqlStore, tracer)
	secureValueMetadataStorage, err := metadata.ProvideSecureValueMetadataStorage(clockClock, databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	secureValueValidator := validator.ProvideSecureValueValidator()
	secureValueMutator := mutator.ProvideSecureValueMutator()
	keeperMetadataStorage, err := metadata.ProvideKeeperMetadataStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	encryptedValueStorage, err := encryption.ProvideEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return nil, err
	}
	dataKeyStorage, err := encryption.ProvideDataKeyStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return nil, err
	}
	cipher, err := service5.ProvideAESGCMCipherService(tracer, usageStats)
	if err != nil {
		return nil, err
	}
	providerConfig, err := kmsproviders.ProvideOSSKMSProviders(cfg, cipher)
	if err != nil {
		return nil, err
	}
	dataKeyCache := manager3.ProvideOSSDataKeyCache(cfg)
	encryptionManager, err := manager3.ProvideEncryptionManager(tracer, dataKeyStorage, usageStats, cipher, providerConfig, dataKeyCache, cfg)
	if err != nil {
		return nil, err
	}
	globalEncryptedValueStorage, err := encryption.ProvideGlobalEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return nil, err
	}
	encryptedValueMigrationExecutor, err := encryption.ProvideEncryptedValueMigrationExecutor(databaseDatabase, tracer, encryptedValueStorage, globalEncryptedValueStorage)
	if err != nil {
		return nil, err
	}
	secretDBMigrator := migrator.NewWithEngine(sqlStore)
	dependencyRegisterer, err := secret.RegisterDependencies(featureToggles, cfg, secretDBMigrator, acimplService)
	if err != nil {
		return nil, err
	}
	ossKeeperService, err := secretkeeper.ProvideService(tracer, encryptedValueStorage, encryptionManager, encryptedValueMigrationExecutor, registerer, cfg, dependencyRegisterer)
	if err != nil {
		return nil, err
	}
	secureValueService := service6.ProvideSecureValueService(tracer, accessClient, secureValueMetadataStorage, secureValueValidator, secureValueMutator, keeperMetadataStorage, ossKeeperService, registerer)
	inlineSecureValueSupport, err := inline.ProvideInlineSecureValueService(cfg, tracer, secureValueService, accessClient)
	if err != nil {
		return nil, err
	}
	options := &unified.Options{
		Cfg:          cfg,
		Features:     featureToggles,
		DB:           sqlStore,
		Tracer:       tracingService,
		Reg:          registerer,
		Authzc:       accessClient,
		Docs:         documentBuilderSupplier,
		SecureValues: inlineSecureValueSupport,
	}
	storageMetrics := resource.ProvideStorageMetrics(registerer)
	bleveIndexMetrics := resource.ProvideIndexMetrics(registerer)
	resourceClient, err := unified.ProvideUnifiedStorageClient(options, storageMetrics, bleveIndexMetrics)
	if err != nil {
		return nil, err
	}
	legacyDatabaseProvider := legacysql.NewDatabaseProvider(sqlStore)
	stubProvisioningService, err := provisioning.ProvideStubProvisioningService(cfg)
	if err != nil {
		return nil, err
	}
	legacyMigrator := legacy.ProvideMigrator(legacyDatabaseProvider, stubProvisioningService, accessControl)
	foldersDashboardsMigrator := migrator2.ProvideFoldersDashboardsMigrator(legacyMigrator)
	playlistMigrator := playlist.ProvidePlaylistMigrator(legacyDatabaseProvider)
	shortURLMigrator := migrator3.ProvideShortURLMigrator(legacyDatabaseProvider)
	secretsKVStore, err := kvstore2.ProvideService(sqlStore, secretsService)
	if err != nil {
		return nil, err
	}
	datasourcePermissionsService := ossaccesscontrol.ProvideDatasourcePermissionsService(cfg, featureToggles, sqlStore)
	oauthtokentestService := oauthtokentest.ProvideService()
	ossCachingService := caching.ProvideCachingService()
	cachingServiceClient := caching.ProvideCachingServiceClient(ossCachingService, featureToggles)
	middlewareHandler, err := pluginsintegration.ProvideClientWithMiddlewares(cfg, inMemory, oauthtokentestService, tracingService, cachingServiceClient, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	requestConfigProvider := pluginconfig.NewRequestConfigProvider(pluginInstanceCfg, defaultSettingsProvider)
	baseProvider := plugincontext.ProvideBaseService(cfg, requestConfigProvider)
	dataSourceRetriever := service7.ProvideDataSourceRetriever(sqlStore, featureToggles)
	service14, err := service7.ProvideService(sqlStore, secretsService, secretsKVStore, cfg, featureToggles, accessControl, datasourcePermissionsService, quotaService, pluginstoreService, middlewareHandler, baseProvider, dataSourceRetriever)
	if err != nil {
		return nil, err
	}
	dataSourceMigrator := migrator4.ProvideDataSourceMigrator(service14, inlineSecureValueSupport)
	starsMigrator := legacy2.ProvideStarsMigrator(legacyDatabaseProvider)
	migrationRegistry := provideMigrationRegistry(foldersDashboardsMigrator, playlistMigrator, shortURLMigrator, dataSourceMigrator, starsMigrator)
	unifiedMigrator := migrations2.ProvideUnifiedMigrator(resourceClient, migrationRegistry)
	unifiedStorageMigrationService := migrations2.ProvideUnifiedStorageMigrationService(unifiedMigrator, legacyDatabaseProvider, cfg, sqlStore, kvStore, resourceClient, migrationRegistry)
	migrationStatusReader, err := migrations2.ProvideMigrationStatusReader(sqlStore, cfg, migrationRegistry, registerer)
	if err != nil {
		return nil, err
	}
	dualwriteService, err := dualwrite.ProvideService(featureToggles, kvStore, cfg, unifiedStorageMigrationService, migrationStatusReader, registerer)
	if err != nil {
		return nil, err
	}
	sortService := sort.ProvideService()
	folderimplService := folderimpl.ProvideService(folderStoreImpl, accessControl, inProcBus, userimplService, sqlStore, featureToggles, bundleregistryService, publicDashboardServiceWrapperImpl, cfg, registerer, tracer, resourceClient, dualwriteService, sortService, eventualRestConfigProvider)
	folderPermissionsService, err := ossaccesscontrol.ProvideFolderPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, folderimplService, acimplService, teamimplService, userimplService, actionSetService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	k8sHandlerWithFallback := client.ProvideK8sClientWithFallback(cfg, eventualRestConfigProvider, userimplService, resourceClient, featureToggles, dualwriteService, sortService, registerer)
	dashboardServiceImpl, err := service8.ProvideDashboardServiceImpl(cfg, sqlStore, featureToggles, folderPermissionsService, accessControl, acimplService, folderimplService, registerer, quotaService, orgService, publicDashboardServiceWrapperImpl, dualwriteService, serverLockService, kvStore, k8sHandlerWithFallback)
	if err != nil {
		return nil, err
	}
	pluginService := service8.ProvideDashboardPluginService(featureToggles, dashboardServiceImpl)
	service15 := service9.ProvideService(fileStoreManager, pluginService)
	pluginerrsStore := pluginerrs.ProvideStore(errorRegistry)
	repoManager, err := repo.ProvideService(pluginManagementCfg)
	if err != nil {
		return nil, err
	}
	pluginInstaller := manager4.ProvideInstaller(pluginManagementCfg, inMemory, loaderLoader, repoManager, serviceregistrationService)
	ossProvider := guardian.ProvideGuardian()
	cacheServiceImpl := service7.ProvideCacheService(cacheService, sqlStore, ossProvider)
	userAuthTokenService, err := authimpl.ProvideUserAuthTokenService(sqlStore, serverLockService, quotaService, secretsService, cfg, tracingService, featureToggles)
	if err != nil {
		return nil, err
	}
	shortURLService := shorturlimpl.ProvideService(sqlStore)
	queryHistoryService := queryhistory.ProvideService(cfg, sqlStore, routeRegisterImpl, accessControl, featureToggles, eventualRestConfigProvider)
	dashboardService := service8.ProvideDashboardService(featureToggles, dashboardServiceImpl)
	dashverService := dashverimpl.ProvideService(cfg, sqlStore, dashboardService, featureToggles, k8sHandlerWithFallback)
	dashboardSnapshotStore := database4.ProvideStore(sqlStore, cfg)
	serviceImpl := service10.ProvideService(dashboardSnapshotStore, secretsService, dashboardService)
	dBstore, err := store3.ProvideDBStore(cfg, featureToggles, sqlStore, folderimplService, dashboardService, accessControl, inProcBus)
	if err != nil {
		return nil, err
	}
	deleteExpiredService := image.ProvideDeleteExpiredService(dBstore)
	tempuserService := tempuserimpl.ProvideService(sqlStore, cfg)
	cleanupServiceImpl := annotationsimpl.ProvideCleanupService(sqlStore, cfg)
	cleanUpService := cleanup.ProvideService(cfg, featureToggles, serverLockService, shortURLService, sqlStore, queryHistoryService, dashverService, serviceImpl, deleteExpiredService, tempuserService, tracingService, cleanupServiceImpl, dBstore, eventualRestConfigProvider, orgService, teamimplService, service14)
	correlationsService, err := correlations.ProvideService(sqlStore, routeRegisterImpl, service14, accessControl, inProcBus, quotaService, cfg)
	if err != nil {
		return nil, err
	}
	mailer, err := notifications.ProvideSmtpService(cfg)
	if err != nil {
		return nil, err
	}
	notificationService, err := notifications.ProvideService(inProcBus, cfg, mailer, tempuserService)
	if err != nil {
		return nil, err
	}
	dashboardProvisioningService := service8.ProvideDashboardProvisioningService(featureToggles, dashboardServiceImpl)
	receiverPermissionsService, err := ossaccesscontrol.ProvideReceiverPermissionsService(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	azurePromMigrationService := promtypemigration.ProvideAzurePromMigrationService(service14, inMemory, repoManager, pluginInstaller, cfg)
	amazonPromMigrationService := promtypemigration.ProvideAmazonPromMigrationService(service14, inMemory, repoManager, pluginInstaller, cfg)
	promTypeMigrationProviderImpl := promtypemigration.ProvidePromTypeMigrationProvider(serverLockService, featureToggles, azurePromMigrationService, amazonPromMigrationService)
	routePermissionsService, err := ossaccesscontrol.ProvideRoutePermissionsService(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService)
	if err != nil {
		return nil, err
	}
	provisioningServiceImpl, err := provisioning.ProvideService(accessControl, cfg, sqlStore, pluginstoreService, dBstore, serviceService, notificationService, dashboardProvisioningService, service14, correlationsService, dashboardService, folderimplService, service13, quotaService, secretsService, orgService, receiverPermissionsService, tracingService, dualwriteService, promTypeMigrationProviderImpl, serverLockService, routePermissionsService)
	if err != nil {
		return nil, err
	}
	orgRoleMapper := connectors.ProvideOrgRoleMapper(cfg, orgService)
	socialService := socialimpl.ProvideService(cfg, featureToggles, usageStats, bundleregistryService, remoteCache, orgRoleMapper, ssosettingsimplService)
	loginStore, err := authinfoimpl.ProvideStore(sqlStore, secretsService)
	if err != nil {
		return nil, err
	}
	authinfoimplService := authinfoimpl.ProvideService(loginStore, remoteCache, secretsService)
	oauthtokenService := oauthtoken.ProvideService(socialService, authinfoimplService, cfg, registerer, serverLockService, tracingService, userAuthTokenService, featureToggles)
	dataSourceProxyService := datasourceproxy.ProvideService(cacheServiceImpl, ossDataSourceRequestValidator, pluginstoreService, cfg, httpclientProvider, oauthtokenService, service14, tracingService, secretsService, featureToggles)
	starService := starimpl.ProvideService(sqlStore)
	searchService := search2.ProvideService(cfg, sqlStore, starService, dashboardService, folderimplService, featureToggles, sortService)
	plugincontextProvider := plugincontext.ProvideService(cfg, cacheService, pluginstoreService, cacheServiceImpl, service14, service13, requestConfigProvider)
	dashboardAccessService := service8.ProvideDashboardAccessService(featureToggles, dashboardServiceImpl)
	grafanaLive, err := live.ProvideService(cfg, routeRegisterImpl, plugincontextProvider, pluginstoreService, middlewareHandler, cacheServiceImpl, usageStats, featureToggles, dashboardAccessService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	gateway := pushhttp.ProvideService(cfg, grafanaLive)
	authnimplService := authnimpl.ProvideService(cfg, tracingService, userAuthTokenService, usageStats, registerer, authinfoimplService)
	authnAuthenticator := authnimpl.ProvideAuthnServiceAuthenticateOnly(authnimplService)
	contexthandlerContextHandler := contexthandler.ProvideService(cfg, authnAuthenticator, featureToggles)
	logger := loggermw.Provide(cfg, featureToggles)
	qsDatasourceClientBuilder := dsquerierclient.NewNullQSDatasourceClientBuilder()
	exprService := expr.ProvideService(cfg, middlewareHandler, plugincontextProvider, featureToggles, registerer, tracingService, qsDatasourceClientBuilder)
	notificationServiceMock := notifications.MockNotificationService()
	ngAlert := metrics2.ProvideService(registerer)
	tagimplService := tagimpl.ProvideService(sqlStore)
	repositoryImpl := annotationsimpl.ProvideService(sqlStore, cfg, featureToggles, tagimplService, tracingService, dBstore, dashboardService, registerer)
	alertNG, err := ngalert.ProvideService(cfg, featureToggles, cacheServiceImpl, service14, routeRegisterImpl, sqlStore, kvStore, exprService, dataSourceProxyService, quotaService, secretsService, notificationServiceMock, ngAlert, folderimplService, accessControl, dashboardService, renderingService, inProcBus, acimplService, repositoryImpl, pluginstoreService, tracingService, dBstore, httpclientProvider, plugincontextProvider, receiverPermissionsService, routePermissionsService, userimplService)
	if err != nil {
		return nil, err
	}
	libraryElementService := libraryelements.ProvideService(cfg, sqlStore, routeRegisterImpl, folderimplService, featureToggles, accessControl, dashboardService, eventualRestConfigProvider, userimplService)
	libraryPanelService, err := librarypanels.ProvideService(cfg, sqlStore, routeRegisterImpl, libraryElementService, folderimplService)
	if err != nil {
		return nil, err
	}
	grafanaService, err := updatemanager.ProvideGrafanaService(cfg, tracingService)
	if err != nil {
		return nil, err
	}
	managedpluginsNoop := managedplugins.NewNoop()
	preinstallImpl := pluginchecker.ProvidePreinstall(cfg)
	plugincheckerService := pluginchecker.ProvideService(managedpluginsNoop, noop, preinstallImpl)
	pluginsService, err := updatemanager.ProvidePluginsService(cfg, pluginstoreService, pluginInstaller, tracingService, featureToggles, plugincheckerService)
	if err != nil {
		return nil, err
	}
	ossSearchUserFilter := filters.ProvideOSSSearchUserFilter()
	ossService := searchusers.ProvideUsersService(cfg, ossSearchUserFilter, userimplService)
	queryServiceImpl := query.ProvideService(cfg, cacheServiceImpl, exprService, ossDataSourceRequestValidator, middlewareHandler, plugincontextProvider, qsDatasourceClientBuilder)
	serviceAccountsProxy, err := proxy.ProvideServiceAccountsProxy(cfg, accessControl, acimplService, featureToggles, serviceAccountPermissionsService, serviceAccountsService, routeRegisterImpl)
	if err != nil {
		return nil, err
	}
	calculator := pluginassets2.ProvideModuleHashCalculator(pluginManagementCfg, pluginscdnService, signatureSignature, inMemory)
	pluginassetsService := pluginassets2.ProvideService(calculator)
	avatarCacheServer := avatar.ProvideAvatarCacheServer(cfg)
	prefService := prefimpl.ProvideService(sqlStore, cfg)
	dashboardPermissionsService, err := ossaccesscontrol.ProvideDashboardPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, dashboardService, folderimplService, acimplService, teamimplService, userimplService, actionSetService, dashboardServiceImpl, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	csrfCSRF := csrf.ProvideCSRFFilter(cfg)
	secretsMigrator := migrator5.ProvideSecretsMigrator(serviceService, secretsService, sqlStore, ossImpl, featureToggles)
	dataSourceSecretMigrationService := migrations3.ProvideDataSourceMigrationService(service14, kvStore, featureToggles)
	secretMigrationProviderImpl := migrations3.ProvideSecretMigrationProvider(serverLockService, dataSourceSecretMigrationService)
	publicDashboardServiceImpl := service4.ProvideService(cfg, featureToggles, publicDashboardStoreImpl, queryServiceImpl, repositoryImpl, accessControl, publicDashboardServiceWrapperImpl, dashboardService, ossLicensingService)
	middleware := api2.ProvideMiddleware()
	apiApi := api2.ProvideApi(publicDashboardServiceImpl, routeRegisterImpl, accessControl, featureToggles, middleware, cfg, ossLicensingService)
	loginattemptimplService := loginattemptimpl.ProvideService(sqlStore, cfg, serverLockService)
	deletionService, err := orgimpl.ProvideDeletionService(sqlStore, cfg, dashboardService, accessControl, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	authnService := authnimpl.ProvideAuthnService(authnimplService)
	navtreeService := navtreeimpl.ProvideService(cfg, accessControl, pluginstoreService, service13, starService, featureToggles, dashboardService, acimplService, kvStore, apikeyService, ossLicensingService, authnService)
	statsService := statsimpl.ProvideService(cfg, sqlStore, dashboardService, folderimplService, orgService, resourceClient, featureToggles)
	gatherer := metrics.ProvideGathererForTest(registerer)
	apiAPI := api3.ProvideApi(cfg, featureToggles, starService, eventualRestConfigProvider)
	anonUserLimitValidatorImpl := validator2.ProvideAnonUserLimitValidator()
	anonDeviceService := anonimpl.ProvideAnonymousDeviceService(usageStats, authnService, sqlStore, cfg, orgService, serverLockService, accessControl, routeRegisterImpl, anonUserLimitValidatorImpl)
	signingkeysimplService, err := signingkeysimpl.ProvideEmbeddedSigningKeysService(sqlStore, secretsService, remoteCache, routeRegisterImpl)
	if err != nil {
		return nil, err
	}
	localSigner, err := idimpl.ProvideLocalSigner(signingkeysimplService)
	if err != nil {
		return nil, err
	}
	idimplService := idimpl.ProvideService(cfg, localSigner, remoteCache, authnService, registerer, tracer)
	verifier := userimpl.ProvideVerifier(cfg, userimplService, tempuserService, notificationServiceMock, idimplService)
	httpServer, err := api.ProvideHTTPServer(apiOpts, cfg, routeRegisterImpl, inProcBus, renderingService, ossLicensingService, hooksService, cacheService, sqlStore, ossDataSourceRequestValidator, pluginstoreService, service15, pluginstoreService, middlewareHandler, pluginerrsStore, pluginInstaller, ossImpl, cacheServiceImpl, userAuthTokenService, cleanUpService, shortURLService, queryHistoryService, correlationsService, remoteCache, provisioningServiceImpl, accessControl, dataSourceProxyService, searchService, grafanaLive, gateway, plugincontextProvider, contexthandlerContextHandler, logger, featureToggles, alertNG, libraryPanelService, libraryElementService, quotaService, socialService, tracingService, serviceService, grafanaService, pluginsService, ossService, service14, queryServiceImpl, filestoreService, serviceAccountsProxy, pluginassetsService, authinfoimplService, storageService, notificationServiceMock, dashboardService, dashboardProvisioningService, folderimplService, ossProvider, serviceImpl, service13, avatarCacheServer, prefService, folderPermissionsService, dashboardPermissionsService, dashverService, starService, csrfCSRF, managedpluginsNoop, apikeyService, kvStore, secretsMigrator, secretsService, secretMigrationProviderImpl, secretsKVStore, apiApi, userimplService, tempuserService, loginattemptimplService, orgService, deletionService, teamimplService, acimplService, navtreeService, repositoryImpl, tagimplService, oauthtokentestService, statsService, authnService, pluginscdnService, gatherer, apiAPI, registerer, eventualRestConfigProvider, anonDeviceService, verifier, preinstallImpl, publicDashboardServiceImpl)
	if err != nil {
		return nil, err
	}
	validatorService, err := validator3.ProvideService(pluginstoreService)
	if err != nil {
		return nil, err
	}
	sandboxService := sandbox.ProvideService(cfg)
	advisorService, err := advisor.ProvideService(cfg, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	statscollectorService := statscollector.ProvideService(usageStats, validatorService, statsService, cfg, sqlStore, socialService, pluginstoreService, featureManager, service14, httpclientProvider, sandboxService, advisorService)
	internalMetricsService, err := metrics.ProvideService(cfg, registerer, gatherer)
	if err != nil {
		return nil, err
	}
	entityEventsService := store.ProvideEntityEventsService(cfg, sqlStore, featureToggles)
	supportbundlesimplService, err := supportbundlesimpl.ProvideService(accessControl, acimplService, bundleregistryService, cfg, featureToggles, httpServer, kvStore, service13, pluginstoreService, routeRegisterImpl, ossImpl, sqlStore, usageStats, tracingService)
	if err != nil {
		return nil, err
	}
	metricService, err := metric.ProvideService(publicDashboardStoreImpl, registerer)
	if err != nil {
		return nil, err
	}
	scopedPluginDatasourceProvider := datasource.ProvideDefaultPluginConfigs(service14, cacheServiceImpl, plugincontextProvider, cfg)
	v := builder.ProvideDefaultBuildHandlerChainFuncFromBuilders()
	aggregatorRunner := aggregatorrunner.ProvideNoopAggregatorConfigurator()
	appInstaller, err := playlist2.RegisterAppInstaller(featureToggles)
	if err != nil {
		return nil, err
	}
	pluginsAppInstaller, err := plugins.ProvideAppInstaller(configProvider, eventualRestConfigProvider, pluginstoreService, calculator, acimplService, accessClient, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	liveAppInstaller, err := live2.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	shortURLAppInstaller, err := shorturl.RegisterAppInstaller(cfg, shortURLService)
	if err != nil {
		return nil, err
	}
	rulesAppInstaller, err := rules.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	correlationsAppInstaller, err := correlations2.RegisterAppInstaller(cfg, featureToggles, correlationsService)
	if err != nil {
		return nil, err
	}
	notificationsAppInstaller, err := notifications2.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	logsDrilldownAppInstaller, err := logsdrilldown.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	annotationAppInstaller, err := annotation.RegisterAppInstaller(cfg, repositoryImpl, cleanupServiceImpl, accessClient)
	if err != nil {
		return nil, err
	}
	exampleAppInstaller, err := example.RegisterAppInstaller(cfg, featureToggles)
	if err != nil {
		return nil, err
	}
	checkregistryService := checkregistry.ProvideService(service14, pluginstoreService, plugincontextProvider, middlewareHandler, plugincheckerService, repoManager, preinstallImpl, managedpluginsNoop, noop, ssosettingsimplService, cfg, pluginerrsStore)
	advisorAppInstaller, err := advisor2.ProvideAppInstaller(acimplService, accessClient, checkregistryService, cfg, orgService, registerer)
	if err != nil {
		return nil, err
	}
	historianAppInstaller, err := historian.RegisterAppInstaller(cfg, alertNG)
	if err != nil {
		return nil, err
	}
	quotasAppInstaller, err := quotas.RegisterAppInstaller(cfg, featureToggles, resourceClient)
	if err != nil {
		return nil, err
	}
	dashValidatorAppInstaller, err := dashvalidator.RegisterAppInstaller(service14, httpclientProvider, accessControl)
	if err != nil {
		return nil, err
	}
	v2 := appregistry.ProvideAppInstallers(featureToggles, cfg, appInstaller, pluginsAppInstaller, liveAppInstaller, shortURLAppInstaller, rulesAppInstaller, correlationsAppInstaller, notificationsAppInstaller, logsDrilldownAppInstaller, annotationAppInstaller, exampleAppInstaller, advisorAppInstaller, historianAppInstaller, quotasAppInstaller, dashValidatorAppInstaller)
	builderMetrics := builder.ProvideBuilderMetrics(registerer)
	backend := auditing.ProvideNoopBackend()
	policyRuleProvider := auditing.ProvideNoopPolicyRuleProvider()
	apiserverService, err := apiserver.ProvideService(cfg, featureToggles, routeRegisterImpl, tracingService, sqlStore, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, pluginstoreService, dualwriteService, resourceClient, inlineSecureValueSupport, eventualRestConfigProvider, v, eventualRestConfigProvider, registerer, aggregatorRunner, v2, builderMetrics, backend, policyRuleProvider)
	if err != nil {
		return nil, err
	}
	pluginexternalService, err := pluginexternal.ProvideService(cfg, pluginstoreService)
	if err != nil {
		return nil, err
	}
	plugininstallerService, err := plugininstaller.ProvideService(cfg, pluginstoreService, pluginInstaller, registerer, repoManager, plugincheckerService)
	if err != nil {
		return nil, err
	}
	zanzanaReconciler := dualwrite2.ProvideZanzanaReconciler(cfg, featureToggles, zanzanaClient, sqlStore, serverLockService, folderimplService, registerer)
	appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, cfg)
	if err != nil {
		return nil, err
	}
	importDashboardService := service11.ProvideService(routeRegisterImpl, quotaService, service15, pluginstoreService, libraryPanelService, dashboardService, accessControl, folderimplService, featureToggles)
	dashboardUpdater := service9.ProvideDashboardUpdater(inProcBus, pluginstoreService, service15, importDashboardService, service13, pluginService, dashboardService)
	worker := garbagecollectionworker.ProvideWorker(cfg, secureValueMetadataStorage, keeperMetadataStorage, ossKeeperService)
	fixedRolesLoader := accesscontrol.ProvideFixedRolesLoader(acimplService, featureToggles)
	noopIAMRolesSyncer := accesscontrol.ProvideNoopIAMRolesSyncer()
	clientGenerator := apiserver.ProvideClientGenerator(eventualRestConfigProvider)
	syncer, err := installsync.ProvideSyncer(featureToggles, clientGenerator, orgService, configProvider, serverLockService, eventualRestConfigProvider, pluginstoreService)
	if err != nil {
		return nil, err
	}
	embeddedZanzanaService := authz.ProvideEmbeddedZanzanaService(cfg, server, tracingService)
	healthService := grpcserver.ProvideHealthService(grpcserverProvider)
	reflectionService, err := grpcserver.ProvideReflectionService(cfg, grpcserverProvider)
	if err != nil {
		return nil, err
	}
	ossGroups := ldap.ProvideGroupsService()
	identitySynchronizer := authnimpl.ProvideIdentitySynchronizer(authnimplService)
	ldapImpl := service12.ProvideService(cfg, featureToggles, ssosettingsimplService)
	apiService := api4.ProvideService(cfg, routeRegisterImpl, accessControl, userimplService, authinfoimplService, ossGroups, identitySynchronizer, orgService, ldapImpl, userAuthTokenService, bundleregistryService)
	dashboardActivityChannel := live.ProvideDashboardActivityChannel(grafanaLive)
	dashboardsAPIBuilder := dashboard.RegisterAPIService(featureToggles, apiserverService, dashboardService, service14, dashboardServiceImpl, dashboardPermissionsService, accessControl, accessClient, provisioningServiceImpl, registerer, sqlStore, tracingService, resourceClient, dualwriteService, quotaService, eventualRestConfigProvider, userimplService, libraryElementService, publicDashboardServiceImpl, serviceImpl, dashboardActivityChannel, configProvider)
	dataSourceAPIBuilder, err := datasource.RegisterAPIService(featureToggles, apiserverService, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, accessControl, registerer, pluginsourcesService)
	if err != nil {
		return nil, err
	}
	folderAPIBuilder := folders.RegisterAPIService(cfg, featureToggles, apiserverService, folderPermissionsService, accessControl, acimplService, accessClient, registerer, resourceClient, zanzanaClient)
	roleApiInstaller := iam.ProvideNoopRoleApiInstaller()
	globalRoleApiInstaller := iam.ProvideNoopGlobalRoleApiInstaller()
	teamLBACApiInstaller := iam.ProvideNoopTeamLBACApiInstaller()
	externalGroupMappingApiInstaller := iam.ProvideNoopExternalGroupMappingApiInstaller()
	storageBackendImpl := noopstorage.ProvideStorageBackend()
	noopTeamGroupsREST := externalgroupmapping.ProvideNoopTeamGroupsREST()
	noopSearchREST := externalgroupmapping.ProvideNoopSearchREST()
	mappersRegistry := resourcepermission.ProvideMappersRegistry()
	identityAccessManagementAPIBuilder, err := iam.RegisterAPIService(cfg, configProvider, featureToggles, apiserverService, ssosettingsimplService, sqlStore, accessControl, accessClient, zanzanaClient, registerer, roleApiInstaller, globalRoleApiInstaller, teamLBACApiInstaller, externalGroupMappingApiInstaller, tracingService, storageBackendImpl, noopTeamGroupsREST, noopSearchREST, dualwriteService, resourceClient, orgService, userimplService, teamimplService, eventualRestConfigProvider, mappersRegistry)
	if err != nil {
		return nil, err
	}
	legacyDataSourceLookup := service7.ProvideLegacyDataSourceLookup(service14)
	queryAPIBuilder, err := query2.RegisterAPIService(cfg, featureToggles, apiserverService, service14, pluginstoreService, accessControl, middlewareHandler, plugincontextProvider, registerer, tracingService, legacyDataSourceLookup, exprService)
	if err != nil {
		return nil, err
	}
	userStorageAPIBuilder := userstorage.RegisterAPIService(featureToggles, apiserverService, registerer)
	apiBuilder := preferences.RegisterAPIService(cfg, featureToggles, sqlStore, prefService, userimplService, apiserverService)
	collectionsAPIBuilder := collections.RegisterAPIService(cfg, featureToggles, sqlStore, starService, userimplService, apiserverService)
	webhookExtraBuilder := webhooks.ProvideWebhooksWithImages(cfg, renderingService, resourceClient, eventualRestConfigProvider, registerer)
	v3 := extras.ProvideProvisioningExtraAPIs(webhookExtraBuilder)
	pullRequestWorker := pullrequest.ProvidePullRequestWorker(cfg, renderingService, resourceClient, eventualRestConfigProvider, registerer)
	v4 := extras.ProvideExtraWorkers(pullRequestWorker)
	v5 := _wireValue
	decryptAuthorizer := decrypt.ProvideDecryptAuthorizer(tracer, v5)
	decryptStorage, err := metadata.ProvideDecryptStorage(tracer, ossKeeperService, keeperMetadataStorage, secureValueMetadataStorage, decryptAuthorizer, registerer)
	if err != nil {
		return nil, err
	}
	decryptService, err := decrypt.ProvideDecryptService(cfg, tracer, decryptStorage)
	if err != nil {
		return nil, err
	}
	factory := github.ProvideFactory()
	v6 := extras.ProvideProvisioningOSSRepositoryExtras(cfg, decryptService, factory, webhookExtraBuilder, registerer)
	repositoryFactory, err := extras.ProvideFactoryFromConfig(cfg, v6)
	if err != nil {
		return nil, err
	}
	githubFactory := github2.ProvideFactory()
	v7 := extras.ProvideProvisioningOSSConnectionExtras(cfg, decryptService, githubFactory, registerer)
	connectionFactory, err := extras.ProvideConnectionFactoryFromConfig(cfg, v7)
	if err != nil {
		return nil, err
	}
	quotaGetter := extras.ProvideQuotaGetter(cfg)
	provisioningAPIBuilder, err := provisioning2.RegisterAPIService(cfg, featureToggles, apiserverService, registerer, resourceClient, eventualRestConfigProvider, accessClient, dualwriteService, usageStats, tracingService, v3, v4, repositoryFactory, connectionFactory, quotaGetter)
	if err != nil {
		return nil, err
	}
	ofrepAPIBuilder, err := ofrep.RegisterAPIService(apiserverService, cfg)
	if err != nil {
		return nil, err
	}
	appPluginAPIBuilder, err := appplugin.RegisterAPIService(apiserverService, pluginsourcesService, service13, accessControl)
	if err != nil {
		return nil, err
	}
	provisioningDependencyRegisterer, err := provisioning2.RegisterDependencies(cfg, acimplService, featureToggles)
	if err != nil {
		return nil, err
	}
	apiregistryService := apiregistry.ProvideRegistryServiceSink(dashboardsAPIBuilder, dataSourceAPIBuilder, folderAPIBuilder, identityAccessManagementAPIBuilder, queryAPIBuilder, userStorageAPIBuilder, apiBuilder, collectionsAPIBuilder, provisioningAPIBuilder, ofrepAPIBuilder, appPluginAPIBuilder, dependencyRegisterer, provisioningDependencyRegisterer)
	teamPermissionsService, err := ossaccesscontrol.ProvideTeamPermissions(cfg, featureToggles, routeRegisterImpl, sqlStore, accessControl, ossLicensingService, acimplService, teamimplService, userimplService, actionSetService, eventualRestConfigProvider)
	if err != nil {
		return nil, err
	}
	teamAPI := teamapi.ProvideTeamAPI(routeRegisterImpl, teamimplService, acimplService, accessControl, teamPermissionsService, userimplService, ossLicensingService, cfg, prefService, dashboardService, featureToggles, eventualRestConfigProvider)
	cloudmigrationService, err := cloudmigrationimpl.ProvideService(cfg, httpclientProvider, featureToggles, sqlStore, service14, secretsKVStore, secretsService, routeRegisterImpl, registerer, tracingService, dashboardService, folderimplService, pluginstoreService, service13, accessControl, acimplService, kvStore, libraryElementService, alertNG)
	if err != nil {
		return nil, err
	}
	authService, err := jwt.ProvideService(cfg, remoteCache)
	if err != nil {
		return nil, err
	}
	ossUserProtectionImpl := authinfoimpl.ProvideOSSUserProtectionService()
	registration := authnimpl.ProvideRegistration(cfg, authnService, orgService, userAuthTokenService, acimplService, permissionRegistry, apikeyService, userimplService, authService, ossUserProtectionImpl, loginattemptimplService, quotaService, authinfoimplService, renderingService, featureToggles, oauthtokentestService, socialService, remoteCache, ldapImpl, ossImpl, tracingService, tempuserService, notificationServiceMock)
	backgroundServiceRegistry := backgroundsvcs.ProvideBackgroundServiceRegistry(httpServer, alertNG, cleanUpService, grafanaLive, gateway, notificationService, pluginstoreService, renderingService, userAuthTokenService, tracingService, provisioningServiceImpl, usageStats, statscollectorService, grafanaService, pluginsService, internalMetricsService, secretsService, remoteCache, storageService, entityEventsService, serviceAccountsService, grpcserverProvider, secretMigrationProviderImpl, loginattemptimplService, supportbundlesimplService, metricService, keyRetriever, angulardetectorsproviderDynamic, apiserverService, anonDeviceService, ssosettingsimplService, pluginexternalService, plugininstallerService, zanzanaReconciler, appregistryService, dashboardUpdater, dashboardServiceImpl, worker, fixedRolesLoader, noopIAMRolesSyncer, syncer, embeddedZanzanaService, serviceImpl, serviceAccountsProxy, healthService, reflectionService, apiService, apiregistryService, idimplService, teamAPI, ssosettingsimplService, cloudmigrationService, registration)
	usageStatsProvidersRegistry := usagestatssvcs.ProvideUsageStatsProvidersRegistry(acimplService, userimplService)
	serverServer, err := New(opts, cfg, httpServer, acimplService, provisioningServiceImpl, backgroundServiceRegistry, usageStatsProvidersRegistry, statscollectorService, tracingService, featureToggles, registerer)
	if err != nil {
		return nil, err
	}
	testEnv, err := ProvideTestEnv(testingT, serverServer, sqlStore, cfg, notificationServiceMock, grpcserverProvider, inMemory, httpclientProvider, oauthtokentestService, featureToggles, resourceClient, idimplService, factory, githubFactory, decryptService, quotaGetter)
	if err != nil {
		return nil, err
	}
	return testEnv, nil
}

func InitializeForCLI(ctx context.Context, cfg *setting.Cfg) (Runner, error) {
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return Runner{}, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	ossMigrations := migrations.ProvideOSSMigrations(featureToggles)
	configProvider, err := configprovider.ProvideService(cfg)
	if err != nil {
		return Runner{}, err
	}
	tracingConfig, err := tracing.ProvideTracingConfig(configProvider)
	if err != nil {
		return Runner{}, err
	}
	tracingService, err := tracing.ProvideService(tracingConfig)
	if err != nil {
		return Runner{}, err
	}
	inProcBus := bus.ProvideBus(tracingService)
	sqlStore, err := sqlstore.ProvideService(cfg, featureToggles, ossMigrations, inProcBus, tracingService)
	if err != nil {
		return Runner{}, err
	}
	ossImpl := setting.ProvideProvider(cfg)
	providerProvider := provider.ProvideEncryptionProvider()
	kvStore := kvstore.ProvideService(sqlStore)
	routeRegisterImpl := routing.ProvideRegister()
	accessControl := acimpl.ProvideAccessControl(featureToggles)
	bundleregistryService := bundleregistry.ProvideService()
	usageStats, err := service.ProvideService(cfg, kvStore, routeRegisterImpl, tracingService, accessControl, bundleregistryService)
	if err != nil {
		return Runner{}, err
	}
	serviceService, err := service2.ProvideEncryptionService(tracingService, providerProvider, usageStats, cfg)
	if err != nil {
		return Runner{}, err
	}
	secretsStoreImpl := database.ProvideSecretsStore(sqlStore)
	osskmsprovidersService := osskmsproviders.ProvideService(serviceService, cfg, featureToggles)
	secretsService, err := manager.ProvideSecretsService(tracingService, secretsStoreImpl, osskmsprovidersService, serviceService, cfg, featureToggles, usageStats)
	if err != nil {
		return Runner{}, err
	}
	secretsMigrator := migrator5.ProvideSecretsMigrator(serviceService, secretsService, sqlStore, ossImpl, featureToggles)
	quotaService := quotaimpl.ProvideService(ctx, sqlStore, configProvider)
	orgService, err := orgimpl.ProvideService(sqlStore, cfg, quotaService)
	if err != nil {
		return Runner{}, err
	}
	eventualRestConfigProvider := apiserver.ProvideEventualRestConfigProvider()
	teamimplService, err := teamimpl.ProvideService(sqlStore, cfg, tracingService, eventualRestConfigProvider)
	if err != nil {
		return Runner{}, err
	}
	cacheService := localcache.ProvideService()
	userimplService, err := userimpl.ProvideService(sqlStore, orgService, cfg, teamimplService, cacheService, tracingService, quotaService, bundleregistryService, eventualRestConfigProvider)
	if err != nil {
		return Runner{}, err
	}
	tracer := otelTracer()
	databaseDatabase := database3.ProvideDatabase(sqlStore, tracer)
	registerer := metrics.ProvideRegisterer()
	globalDataKeyStorage, err := encryption.ProvideGlobalDataKeyStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return Runner{}, err
	}
	encryptedValueStorage, err := encryption.ProvideEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return Runner{}, err
	}
	globalEncryptedValueStorage, err := encryption.ProvideGlobalEncryptedValueStorage(databaseDatabase, tracer)
	if err != nil {
		return Runner{}, err
	}
	dataKeyStorage, err := encryption.ProvideDataKeyStorage(databaseDatabase, tracer, registerer)
	if err != nil {
		return Runner{}, err
	}
	cipher, err := service5.ProvideAESGCMCipherService(tracer, usageStats)
	if err != nil {
		return Runner{}, err
	}
	providerConfig, err := kmsproviders.ProvideOSSKMSProviders(cfg, cipher)
	if err != nil {
		return Runner{}, err
	}
	dataKeyCache := manager3.ProvideOSSDataKeyCache(cfg)
	encryptionManager, err := manager3.ProvideEncryptionManager(tracer, dataKeyStorage, usageStats, cipher, providerConfig, dataKeyCache, cfg)
	if err != nil {
		return Runner{}, err
	}
	consolidationService := service6.ProvideConsolidationService(tracer, globalDataKeyStorage, encryptedValueStorage, globalEncryptedValueStorage, encryptionManager)
	runner := NewRunner(cfg, sqlStore, ossImpl, serviceService, featureToggles, secretsService, secretsMigrator, userimplService, consolidationService)
	return runner, nil
}

// InitializeForCLITarget is a simplified set of dependencies for the CLI, used
// by the server target subcommand to launch specific dskit modules.
func InitializeForCLITarget(ctx context.Context, cfg *setting.Cfg) (ModuleRunner, error) {
	ossImpl := setting.ProvideProvider(cfg)
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return ModuleRunner{}, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	moduleRunner := NewModuleRunner(cfg, ossImpl, featureToggles)
	return moduleRunner, nil
}

// InitializeModuleServer is a simplified set of dependencies for the CLI,
// suitable for running background services and targeting dskit modules.
func InitializeModuleServer(cfg *setting.Cfg, opts Options, apiOpts api.ServerOptions) (*ModuleServer, error) {
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return nil, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	registerer := metrics.ProvideRegisterer()
	storageMetrics := resource.ProvideStorageMetrics(registerer)
	bleveIndexMetrics := resource.ProvideIndexMetrics(registerer)
	gatherer := metrics.ProvideGatherer()
	configProvider, err := configprovider.ProvideService(cfg)
	if err != nil {
		return nil, err
	}
	tracingConfig, err := tracing.ProvideTracingConfig(configProvider)
	if err != nil {
		return nil, err
	}
	tracingService, err := tracing.ProvideService(tracingConfig)
	if err != nil {
		return nil, err
	}
	hooksService := hooks.ProvideService()
	ossLicensingService := licensing.ProvideService(cfg, hooksService)
	moduleRegisterer := ProvideNoopModuleRegisterer()
	storageBackend, err := sql.ProvideStorageBackend(cfg)
	if err != nil {
		return nil, err
	}
	storeProvider := store2.ProvideDefaultStoreProvider()
	moduleServer, err := NewModule(opts, apiOpts, featureToggles, cfg, storageMetrics, bleveIndexMetrics, registerer, gatherer, tracingService, ossLicensingService, moduleRegisterer, storageBackend, hooksService, storeProvider)
	if err != nil {
		return nil, err
	}
	return moduleServer, nil
}

// Initialize the standalone APIServer factory
func InitializeAPIServerFactory() (standalone.APIServerFactory, error) {
	apiServerFactory := standalone.ProvideAPIServerFactory()
	return apiServerFactory, nil
}

func InitializeDocumentBuilders(cfg *setting.Cfg) (resource.DocumentBuilderSupplier, error) {
	featureManager, err := featuremgmt.ProvideManagerService(cfg)
	if err != nil {
		return nil, err
	}
	featureToggles := featuremgmt.ProvideToggles(featureManager)
	ossMigrations := migrations.ProvideOSSMigrations(featureToggles)
	configProvider, err := configprovider.ProvideService(cfg)
	if err != nil {
		return nil, err
	}
	tracingConfig, err := tracing.ProvideTracingConfig(configProvider)
	if err != nil {
		return nil, err
	}
	tracingService, err := tracing.ProvideService(tracingConfig)
	if err != nil {
		return nil, err
	}
	inProcBus := bus.ProvideBus(tracingService)
	sqlStore, err := sqlstore.ProvideService(cfg, featureToggles, ossMigrations, inProcBus, tracingService)
	if err != nil {
		return nil, err
	}
	ossDashboardStats := builders.ProvideDashboardStats()
	documentBuilderSupplier := search.ProvideDocumentBuilders(sqlStore, ossDashboardStats)
	return documentBuilderSupplier, nil
}

// wire.go:

func otelTracer() trace.Tracer {
	return otel.GetTracerProvider().Tracer("grafana")
}

var withOTelSet = wire.NewSet(
	otelTracer, grpcserver.ProvideService, interceptors.ProvideAuthenticator,
)

var wireBasicSet = wire.NewSet(annotationsimpl.ProvideService, wire.Bind(new(annotations.Repository), new(*annotationsimpl.RepositoryImpl)), New, api.ProvideHTTPServer, query.ProvideService, wire.Bind(new(query.Service), new(*query.ServiceImpl)), bus.ProvideBus, wire.Bind(new(bus.Bus), new(*bus.InProcBus)), rendering.ProvideService, wire.Bind(new(rendering.Service), new(*rendering.RenderingService)), routing.ProvideRegister, wire.Bind(new(routing.RouteRegister), new(*routing.RouteRegisterImpl)), hooks.ProvideService, kvstore.ProvideService, localcache.ProvideService, bundleregistry.ProvideService, wire.Bind(new(supportbundles.Service), new(*bundleregistry.Service)), updatemanager.ProvideGrafanaService, updatemanager.ProvidePluginsService, service.ProvideService, wire.Bind(new(usagestats.Service), new(*service.UsageStats)), validator3.ProvideService, provisioning.ProvideStubProvisioningService, legacy.ProvideMigrator, migrator2.ProvideFoldersDashboardsMigrator, playlist.ProvidePlaylistMigrator, migrator3.ProvideShortURLMigrator, legacy2.ProvideStarsMigrator, migrator4.ProvideDataSourceMigrator, provideMigrationRegistry, migrations2.ProvideUnifiedMigrator, pluginsintegration.WireSet, dashboards.ProvideFileStoreManager, wire.Bind(new(dashboards.FileStore), new(*dashboards.FileStoreManager)), cloudwatch.ProvideService, cloudmonitoring.ProvideService, azuremonitor.ProvideService, postgres.ProvideService, mysql.ProvideService, mssql.ProvideService, store.ProvideEntityEventsService, dualwrite.ProvideService, httpclientprovider.New, wire.Bind(new(httpclient.Provider), new(*httpclient2.Provider)), serverlock.ProvideService, wire.Bind(new(installsync.ServerLock), new(*serverlock.ServerLockService)), annotationsimpl.ProvideCleanupService, wire.Bind(new(annotations.Cleaner), new(*annotationsimpl.CleanupServiceImpl)), cleanup.ProvideService, shorturlimpl.ProvideService, wire.Bind(new(shorturls.Service), new(*shorturlimpl.ShortURLService)), queryhistory.ProvideService, wire.Bind(new(queryhistory.Service), new(*queryhistory.QueryHistoryService)), correlations.ProvideService, wire.Bind(new(correlations.Service), new(*correlations.CorrelationsService)), quotaimpl.ProvideService, remotecache.ProvideService, wire.Bind(new(remotecache.CacheStorage), new(*remotecache.RemoteCache)), authinfoimpl.ProvideService, wire.Bind(new(login.AuthInfoService), new(*authinfoimpl.Service)), authinfoimpl.ProvideStore, datasourceproxy.ProvideService, sort.ProvideService, search2.ProvideService, store.ProvideService, store.ProvideSystemUsersService, live.ProvideService, live.ProvideDashboardActivityChannel, pushhttp.ProvideService, contexthandler.ProvideService, service12.ProvideService, wire.Bind(new(service12.LDAP), new(*service12.LDAPImpl)), jwt.ProvideService, wire.Bind(new(jwt.JWTService), new(*jwt.AuthService)), store3.ProvideDBStore, image.ProvideDeleteExpiredService, ngalert.ProvideService, librarypanels.ProvideService, wire.Bind(new(librarypanels.Service), new(*librarypanels.LibraryPanelService)), libraryelements.ProvideService, wire.Bind(new(libraryelements.Service), new(*libraryelements.LibraryElementService)), notifications.ProvideService, notifications.ProvideSmtpService, github.ProvideFactory, github2.ProvideFactory, tracing.ProvideService, tracing.ProvideTracingConfig, wire.Bind(new(tracing.Tracer), new(*tracing.TracingService)), withOTelSet, testdatasource.ProvideService, api4.ProvideService, opentsdb.ProvideService, socialimpl.ProvideService, influxdb.ProvideService, wire.Bind(new(social.Service), new(*socialimpl.SocialService)), tempo.ProvideService, loki.ProvideService, graphite.ProvideService, prometheus.ProvideService, pyroscope.ProvideService, parca.ProvideService, zipkin.ProvideService, jaeger.ProvideService, service7.ProvideCacheService, wire.Bind(new(datasources.CacheService), new(*service7.CacheServiceImpl)), service2.ProvideEncryptionService, wire.Bind(new(encryption2.Internal), new(*service2.Service)), manager.ProvideSecretsService, wire.Bind(new(secrets.Service), new(*manager.SecretsService)), database.ProvideSecretsStore, wire.Bind(new(secrets.Store), new(*database.SecretsStoreImpl)), garbagecollectionworker.ProvideWorker, grafanads.ProvideService, wire.Bind(new(dashboardsnapshots.Store), new(*database4.DashboardSnapshotStore)), database4.ProvideStore, wire.Bind(new(dashboardsnapshots.Service), new(*service10.ServiceImpl)), service10.ProvideService, service7.ProvideDataSourceRetriever, service7.ProvideService, wire.Bind(new(datasources.DataSourceService), new(*service7.Service)), service7.ProvideLegacyDataSourceLookup, retriever.ProvideService, wire.Bind(new(serviceaccounts.ServiceAccountRetriever), new(*retriever.Service)), ossaccesscontrol.ProvideServiceAccountPermissions, wire.Bind(new(accesscontrol.ServiceAccountPermissionsService), new(*ossaccesscontrol.ServiceAccountPermissionsService)), manager2.ProvideServiceAccountsService, proxy.ProvideServiceAccountsProxy, wire.Bind(new(serviceaccounts.Service), new(*proxy.ServiceAccountsProxy)), dsquerierclient.NewNullQSDatasourceClientBuilder, expr.ProvideService, featuremgmt.ProvideManagerService, featuremgmt.ProvideToggles, service8.ProvideDashboardServiceImpl, wire.Bind(new(dashboards2.PermissionsRegistrationService), new(*service8.DashboardServiceImpl)), service8.ProvideDashboardService, service8.ProvideDashboardProvisioningService, service8.ProvideDashboardPluginService, service8.ProvideDashboardAccessService, folderimpl.ProvideService, wire.Bind(new(folder.Service), new(*folderimpl.Service)), folderimpl.ProvideStore, wire.Bind(new(folder.Store), new(*folderimpl.FolderStoreImpl)), service11.ProvideService, wire.Bind(new(dashboardimport.Service), new(*service11.ImportDashboardService)), service9.ProvideService, wire.Bind(new(plugindashboards.Service), new(*service9.Service)), service9.ProvideDashboardUpdater, kvstore2.ProvideService, avatar.ProvideAvatarCacheServer, statscollector.ProvideService, csrf.ProvideCSRFFilter, wire.Bind(new(csrf.Service), new(*csrf.CSRF)), ossaccesscontrol.ProvideTeamPermissions, wire.Bind(new(accesscontrol.TeamPermissionsService), new(*ossaccesscontrol.TeamPermissionsService)), ossaccesscontrol.ProvideFolderPermissions, wire.Bind(new(accesscontrol.FolderPermissionsService), new(*ossaccesscontrol.FolderPermissionsService)), ossaccesscontrol.ProvideDashboardPermissions, wire.Bind(new(accesscontrol.DashboardPermissionsService), new(*ossaccesscontrol.DashboardPermissionsService)), ossaccesscontrol.ProvideReceiverPermissionsService, wire.Bind(new(accesscontrol.ReceiverPermissionsService), new(*ossaccesscontrol.ReceiverPermissionsService)), ossaccesscontrol.ProvideRoutePermissionsService, wire.Bind(new(accesscontrol.RoutePermissionsService), new(*ossaccesscontrol.RoutePermissionsService)), starimpl.ProvideService, apikeyimpl.ProvideService, dashverimpl.ProvideService, service4.ProvideService, wire.Bind(new(publicdashboards.Service), new(*service4.PublicDashboardServiceImpl)), database2.ProvideStore, wire.Bind(new(publicdashboards.Store), new(*database2.PublicDashboardStoreImpl)), metric.ProvideService, api2.ProvideApi, api3.ProvideApi, userimpl.ProvideService, wire.Bind(new(user.Service), new(*userimpl.Service)), orgimpl.ProvideService, orgimpl.ProvideDeletionService, statsimpl.ProvideService, grpccontext.ProvideContextHandler, grpcserver.ProvideHealthService, grpcserver.ProvideReflectionService, resolver.ProvideEntityReferenceResolver, teamimpl.ProvideService, wire.Bind(new(team.Service), new(*teamimpl.Service)), teamapi.ProvideTeamAPI, tempuserimpl.ProvideService, loginattemptimpl.ProvideService, wire.Bind(new(loginattempt.Service), new(*loginattemptimpl.Service)), migrations3.ProvideDataSourceMigrationService, migrations3.ProvideSecretMigrationProvider, wire.Bind(new(migrations3.SecretMigrationProvider), new(*migrations3.SecretMigrationProviderImpl)), promtypemigration.ProvideAzurePromMigrationService, promtypemigration.ProvideAmazonPromMigrationService, promtypemigration.ProvidePromTypeMigrationProvider, wire.Bind(new(promtypemigration.PromTypeMigrationProvider), new(*promtypemigration.PromTypeMigrationProviderImpl)), resourcepermissions.NewActionSetService, wire.Bind(new(accesscontrol.ActionResolver), new(resourcepermissions.ActionSetService)), wire.Bind(new(pluginaccesscontrol.ActionSetRegistry), new(resourcepermissions.ActionSetService)), permreg.ProvidePermissionRegistry, acimpl.ProvideAccessControl, accesscontrol.ProvideFixedRolesLoader, accesscontrol.ProvideNoopIAMRolesSyncer, dualwrite2.ProvideZanzanaReconciler, navtreeimpl.ProvideService, wire.Bind(new(accesscontrol.AccessControl), new(*acimpl.AccessControl)), wire.Bind(new(notifications.TempUserStore), new(tempuser.Service)), tagimpl.ProvideService, wire.Bind(new(tag.Service), new(*tagimpl.Service)), authnimpl.ProvideService, authnimpl.ProvideIdentitySynchronizer, authnimpl.ProvideAuthnService, authnimpl.ProvideAuthnServiceAuthenticateOnly, authnimpl.ProvideRegistration, supportbundlesimpl.ProvideService, extsvcaccounts.ProvideExtSvcAccountsService, wire.Bind(new(serviceaccounts.ExtSvcAccountsService), new(*extsvcaccounts.ExtSvcAccountsService)), registry2.ProvideExtSvcRegistry, wire.Bind(new(extsvcauth.ExternalServiceRegistry), new(*registry2.Registry)), anonstore.ProvideAnonDBStore, wire.Bind(new(anonstore.AnonStore), new(*anonstore.AnonDBStore)), loggermw.Provide, slogadapter.Provide, signingkeysimpl.ProvideEmbeddedSigningKeysService, wire.Bind(new(signingkeys.Service), new(*signingkeysimpl.Service)), ssosettingsimpl.ProvideService, wire.Bind(new(ssosettings.Service), new(*ssosettingsimpl.Service)), idimpl.ProvideService, wire.Bind(new(auth.IDService), new(*idimpl.Service)), cloudmigrationimpl.ProvideService, caching.ProvideCachingServiceClient, userimpl.ProvideVerifier, connectors.ProvideOrgRoleMapper, wire.Bind(new(user.Verifier), new(*userimpl.Verifier)), authz.WireSet, metadata.ProvideSecureValueMetadataStorage, metadata.ProvideKeeperMetadataStorage, metadata.ProvideDecryptStorage, decrypt.ProvideDecryptAuthorizer, wire.Value([]decrypt.ExtraOwnerDecrypter(nil)), decrypt.ProvideDecryptService, inline.ProvideInlineSecureValueService, encryption.ProvideDataKeyStorage, encryption.ProvideGlobalDataKeyStorage, encryption.ProvideEncryptedValueStorage, encryption.ProvideGlobalEncryptedValueStorage, encryption.ProvideEncryptedValueMigrationExecutor, service6.ProvideSecureValueService, validator.ProvideKeeperValidator, validator.ProvideSecureValueValidator, mutator.ProvideKeeperMutator, mutator.ProvideSecureValueMutator, migrator.NewWithEngine, database3.ProvideDatabase, clock.ProvideClock, wire.Bind(new(contracts.Database), new(*database3.Database)), wire.Bind(new(contracts.Clock), new(*clock.Clock)), manager3.ProvideEncryptionManager, service5.ProvideAESGCMCipherService, resource.ProvideStorageMetrics, resource.ProvideIndexMetrics, migrations2.ProvideUnifiedStorageMigrationService, migrations2.ProvideMigrationStatusReader, apiserver.WireSet, apiregistry.WireSet, appregistry.WireSet, client.ProvideK8sClientWithFallback)

var wireSet = wire.NewSet(
	wireBasicSet, metrics.WireSet, sqlstore.ProvideService, metrics2.ProvideService, wire.Bind(new(notifications.Service), new(*notifications.NotificationService)), wire.Bind(new(notifications.WebhookSender), new(*notifications.NotificationService)), wire.Bind(new(notifications.EmailSender), new(*notifications.NotificationService)), wire.Bind(new(db.DB), new(*sqlstore.SQLStore)), prefimpl.ProvideService, oauthtoken.ProvideService, wire.Bind(new(oauthtoken.OAuthTokenService), new(*oauthtoken.Service)), wire.Bind(new(cleanup.AlertRuleService), new(*store3.DBstore)),
)

var wireCLISet = wire.NewSet(
	NewRunner,
	wireBasicSet, metrics.WireSet, sqlstore.ProvideService, metrics2.ProvideService, wire.Bind(new(notifications.Service), new(*notifications.NotificationService)), wire.Bind(new(notifications.WebhookSender), new(*notifications.NotificationService)), wire.Bind(new(notifications.EmailSender), new(*notifications.NotificationService)), wire.Bind(new(db.DB), new(*sqlstore.SQLStore)), prefimpl.ProvideService, oauthtoken.ProvideService, wire.Bind(new(oauthtoken.OAuthTokenService), new(*oauthtoken.Service)),
)

var wireTestSet = wire.NewSet(
	wireBasicSet,
	ProvideTestEnv, metrics.WireSetForTest, sqlstore.ProvideServiceForTests, metrics2.ProvideService, notifications.MockNotificationService, wire.Bind(new(notifications.Service), new(*notifications.NotificationServiceMock)), wire.Bind(new(notifications.WebhookSender), new(*notifications.NotificationServiceMock)), wire.Bind(new(notifications.EmailSender), new(*notifications.NotificationServiceMock)), wire.Bind(new(db.DB), new(*sqlstore.SQLStore)), prefimpl.ProvideService, oauthtoken.ProvideService, oauthtokentest.ProvideService, wire.Bind(new(oauthtoken.OAuthTokenService), new(*oauthtokentest.Service)), wire.Bind(new(cleanup.AlertRuleService), new(*store3.DBstore)),
)

/*
provideMigrationRegistry builds the MigrationRegistry from individual
resource migrators. When adding a new resource migration, register
it with the registry here.
*/
func provideMigrationRegistry(
	dashMigrator migrator2.FoldersDashboardsMigrator,
	playlistMigrator playlist.PlaylistMigrator,
	shortURLMigrator migrator3.ShortURLMigrator,
	dataSourceMigrator migrator4.DataSourceMigrator,
	starsMigrator legacy2.StarsMigrator,
) *migrations2.MigrationRegistry {
	r := migrations2.NewMigrationRegistry()
	r.Register(dashboard.FoldersDashboardsMigration(dashMigrator))
	r.Register(playlist2.PlaylistMigration(playlistMigrator))
	r.Register(shorturl.ShortURLMigration(shortURLMigrator))
	r.Register(migrator4.DataSourceMigration(dataSourceMigrator))
	r.Register(legacy2.StarsMigrationDefinition(starsMigrator))
	return r
}
