Skip to content

Commit

Permalink
fix: remove debugs
Browse files Browse the repository at this point in the history
Signed-off-by: RazenaSaleem <razenasaleem@gmail.com>
  • Loading branch information
RazenaSaleem committed Jun 3, 2024
1 parent d9fcddb commit 3174b84
Showing 1 changed file with 6 additions and 35 deletions.
41 changes: 6 additions & 35 deletions server/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func (app *App) Version() string {
}

func (app *App) Stop() {
log.Println("Stopping application")
for _, fn := range app.stopFns {
fn()
}
Expand All @@ -86,7 +85,6 @@ func (app *App) registerStopFn(fn func()) {
}

func (app *App) HotReload() {
log.Println("Hot reloading application")
app.Stop()
app.Start()
}
Expand Down Expand Up @@ -124,7 +122,6 @@ func provision(provisioner *provisioning.Provisioner, file string) {
}

func (app *App) subscribeToConfigChanges(sm subscription.Manager) {
log.Println("Subscribing to config changes")
sm.Subscribe(config.ResourceID, subscription.NewSubscriberFunction(
func(m subscription.Message) error {
configFromDB := config.Config{}
Expand All @@ -139,7 +136,6 @@ func (app *App) subscribeToConfigChanges(sm subscription.Manager) {
}

func (app *App) initAnalytics(configFromDB config.Config) error {
log.Println("Initializing analytics")
return analytics.Init(configFromDB.IsAnalyticsEnabled(), app.serverID, version.Version, version.Env, app.cfg.AnalyticsServerKey(), app.cfg.AnalyticsFrontendKey())
}

Expand All @@ -153,7 +149,6 @@ func (app *App) Start(opts ...appOption) error {
}
fmt.Println(app.Version())
fmt.Println("Starting")
log.Println("Starting application")
ctx := context.Background()

poolcfg, err := pgxpool.ParseConfig(app.cfg.PostgresConnString())
Expand Down Expand Up @@ -266,9 +261,7 @@ func (app *App) Start(opts ...appOption) error {
)

dsTestPipeline.Start()
fmt.Println("dsTestPipeline started")
app.registerStopFn(func() {
fmt.Println("dsTestPipeline stopping")
dsTestPipeline.Stop()
})

Expand All @@ -292,9 +285,7 @@ func (app *App) Start(opts ...appOption) error {
meter,
)
testPipeline.Start()
fmt.Println("TestPipeline started")
app.registerStopFn(func() {
fmt.Println("TestPipeline stopping")
testPipeline.Stop()
})

Expand All @@ -307,9 +298,7 @@ func (app *App) Start(opts ...appOption) error {
)

testSuitePipeline.Start()
fmt.Println("testsuitepipeline started")
app.registerStopFn(func() {
fmt.Println("testsuitepipeline stopping")
testSuitePipeline.Stop()
})

Expand Down Expand Up @@ -367,8 +356,8 @@ func (app *App) Start(opts ...appOption) error {
registerTestRunner(testRunnerRepo, apiRouter, provisioner, tracer)
registerTestResource(testRepo, apiRouter, provisioner, tracer)

isTracetestDev := os.Getenv("TRACETEST_DEV") != ""
registerSPAHandler(router, app.cfg, configFromDB.IsAnalyticsEnabled(), serverID, isTracetestDev)
isQualitytraceDev := os.Getenv("QUALITYTRACE_DEV") != ""
registerSPAHandler(router, app.cfg, configFromDB.IsAnalyticsEnabled(), serverID, isQualitytraceDev)

if isNewInstall {
provision(provisioner, app.provisioningFile)
Expand All @@ -390,7 +379,7 @@ func (app *App) Start(opts ...appOption) error {
return nil
}

func registerSPAHandler(router *mux.Router, cfg httpServerConfig, analyticsEnabled bool, serverID string, isTracetestDev bool) {
func registerSPAHandler(router *mux.Router, cfg httpServerConfig, analyticsEnabled bool, serverID string, isQualitytraceDev bool) {
router.
PathPrefix(cfg.ServerPathPrefix()).
Handler(
Expand All @@ -400,7 +389,7 @@ func registerSPAHandler(router *mux.Router, cfg httpServerConfig, analyticsEnabl
serverID,
version.Version,
version.Env,
isTracetestDev,
isQualitytraceDev,
),
)
}
Expand All @@ -414,33 +403,15 @@ func registerOtlpServer(
subManager subscription.Manager,
tracer trace.Tracer,
) {
log.Println("[registerOtlpServer] Initializing OTLP Ingester")
ingester := otlp.NewIngester(tracesRepo, runRepository, eventEmitter, dsRepo, subManager, tracer)
log.Println("[registerOtlpServer] Creating gRPC OTLP Server on :4317")
grpcOtlpServer := otlp.NewGrpcServer(":4317", ingester, tracer)
log.Println("[registerOtlpServer] Creating HTTP OTLP Server on :4318")
httpOtlpServer := otlp.NewHttpServer(":4318", ingester)
// go grpcOtlpServer.Start()
// go httpOtlpServer.Start()

go func() {
log.Println("[registerOtlpServer] Starting gRPC OTLP Server")
if err := grpcOtlpServer.Start(); err != nil {
log.Fatalf("[registerOtlpServer] Failed to start gRPC OTLP Server: %s", err)
}
}()

go func() {
log.Println("[registerOtlpServer] Starting HTTP OTLP Server")
if err := httpOtlpServer.Start(); err != nil {
log.Fatalf("[registerOtlpServer] Failed to start HTTP OTLP Server: %s", err)
}
}()
go grpcOtlpServer.Start()
go httpOtlpServer.Start()

fmt.Println("OTLP server started on :4317 (grpc) and :4318 (http)")

app.registerStopFn(func() {
log.Println("[registerOtlpServer] Stopping OTLP servers")
fmt.Println("stopping otlp server")
grpcOtlpServer.Stop()
httpOtlpServer.Stop()
Expand Down

0 comments on commit 3174b84

Please sign in to comment.