@@ -18,13 +18,14 @@ import (
1818 "github.com/SigNoz/signoz/ee/query-service/constants"
1919 "github.com/SigNoz/signoz/ee/query-service/dao"
2020 "github.com/SigNoz/signoz/ee/query-service/integrations/gateway"
21- "github.com/SigNoz/signoz/ee/query-service/interfaces"
2221 "github.com/SigNoz/signoz/ee/query-service/rules"
2322 "github.com/SigNoz/signoz/pkg/alertmanager"
2423 "github.com/SigNoz/signoz/pkg/http/middleware"
24+ "github.com/SigNoz/signoz/pkg/prometheus"
2525 "github.com/SigNoz/signoz/pkg/query-service/auth"
2626 "github.com/SigNoz/signoz/pkg/signoz"
2727 "github.com/SigNoz/signoz/pkg/sqlstore"
28+ "github.com/SigNoz/signoz/pkg/telemetrystore"
2829 "github.com/SigNoz/signoz/pkg/types"
2930 "github.com/SigNoz/signoz/pkg/types/authtypes"
3031 "github.com/SigNoz/signoz/pkg/web"
@@ -49,7 +50,6 @@ import (
4950 "github.com/SigNoz/signoz/pkg/query-service/healthcheck"
5051 baseint "github.com/SigNoz/signoz/pkg/query-service/interfaces"
5152 basemodel "github.com/SigNoz/signoz/pkg/query-service/model"
52- pqle "github.com/SigNoz/signoz/pkg/query-service/pqlEngine"
5353 baserules "github.com/SigNoz/signoz/pkg/query-service/rules"
5454 "github.com/SigNoz/signoz/pkg/query-service/telemetry"
5555 "github.com/SigNoz/signoz/pkg/query-service/utils"
@@ -137,27 +137,23 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
137137
138138 // set license manager as feature flag provider in dao
139139 modelDao .SetFlagProvider (lm )
140- readerReady := make (chan bool )
141140
142141 fluxIntervalForTraceDetail , err := time .ParseDuration (serverOptions .FluxIntervalForTraceDetail )
143142 if err != nil {
144143 return nil , err
145144 }
146145
147- var reader interfaces.DataConnector
148- qb := db .NewDataConnector (
146+ reader := db .NewDataConnector (
149147 serverOptions .SigNoz .SQLStore .SQLxDB (),
150- serverOptions .SigNoz .TelemetryStore . ClickHouseDB () ,
151- serverOptions .PromConfigPath ,
148+ serverOptions .SigNoz .TelemetryStore ,
149+ serverOptions .SigNoz . Prometheus ,
152150 lm ,
153151 serverOptions .Cluster ,
154152 serverOptions .UseLogsNewSchema ,
155153 serverOptions .UseTraceNewSchema ,
156154 fluxIntervalForTraceDetail ,
157155 serverOptions .SigNoz .Cache ,
158156 )
159- go qb .Start (readerReady )
160- reader = qb
161157
162158 skipConfig := & basemodel.SkipConfig {}
163159 if serverOptions .SkipTopLvlOpsPath != "" {
@@ -176,9 +172,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
176172 c = cache .NewCache (cacheOpts )
177173 }
178174
179- <- readerReady
180175 rm , err := makeRulesManager (
181- serverOptions .PromConfigPath ,
182176 serverOptions .RuleRepoURL ,
183177 serverOptions .SigNoz .SQLStore .SQLxDB (),
184178 reader ,
@@ -189,6 +183,8 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
189183 serverOptions .UseTraceNewSchema ,
190184 serverOptions .SigNoz .Alertmanager ,
191185 serverOptions .SigNoz .SQLStore ,
186+ serverOptions .SigNoz .TelemetryStore ,
187+ serverOptions .SigNoz .Prometheus ,
192188 )
193189
194190 if err != nil {
@@ -233,7 +229,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
233229 }
234230
235231 // start the usagemanager
236- usageManager , err := usage .New (modelDao , lm .GetRepo (), serverOptions .SigNoz .TelemetryStore .ClickHouseDB (), serverOptions .Config .TelemetryStore .ClickHouse .DSN )
232+ usageManager , err := usage .New (modelDao , lm .GetRepo (), serverOptions .SigNoz .TelemetryStore .ClickhouseDB (), serverOptions .Config .TelemetryStore .Clickhouse .DSN )
237233 if err != nil {
238234 return nil , err
239235 }
@@ -304,7 +300,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
304300 & opAmpModel .AllAgents , agentConfMgr ,
305301 )
306302
307- errorList := qb .PreloadMetricsMetadata (context .Background ())
303+ errorList := reader .PreloadMetricsMetadata (context .Background ())
308304 for _ , er := range errorList {
309305 zap .L ().Error ("failed to preload metrics metadata" , zap .Error (er ))
310306 }
@@ -537,7 +533,6 @@ func (s *Server) Stop() error {
537533}
538534
539535func makeRulesManager (
540- promConfigPath ,
541536 ruleRepoURL string ,
542537 db * sqlx.DB ,
543538 ch baseint.Reader ,
@@ -548,16 +543,13 @@ func makeRulesManager(
548543 useTraceNewSchema bool ,
549544 alertmanager alertmanager.Alertmanager ,
550545 sqlstore sqlstore.SQLStore ,
546+ telemetryStore telemetrystore.TelemetryStore ,
547+ prometheus prometheus.Prometheus ,
551548) (* baserules.Manager , error ) {
552- // create engine
553- pqle , err := pqle .FromConfigPath (promConfigPath )
554- if err != nil {
555- return nil , fmt .Errorf ("failed to create pql engine : %v" , err )
556- }
557-
558549 // create manager opts
559550 managerOpts := & baserules.ManagerOptions {
560- PqlEngine : pqle ,
551+ TelemetryStore : telemetryStore ,
552+ Prometheus : prometheus ,
561553 RepoURL : ruleRepoURL ,
562554 DBConn : db ,
563555 Context : context .Background (),
0 commit comments