Browse Source

fix: remove healthcheck from healthcheck

Yeuoly 7 months ago
parent
commit
a00e6ad26f
1 changed files with 23 additions and 8 deletions
  1. 23 8
      internal/server/http_server.go

+ 23 - 8
internal/server/http_server.go

@@ -17,19 +17,34 @@ import (
 	sentrygin "github.com/getsentry/sentry-go/gin"
 )
 
+// server starts a http server and returns a function to stop it
 func (app *App) server(config *app.Config) func() {
 	engine := gin.Default()
+	engine.GET("/health/check", controllers.HealthCheck)
+
+	endpointGroup := engine.Group("/endpoint")
+	awsLambdaTransactionGroup := engine.Group("/backwards-invocation")
+	pluginGroup := engine.Group("/plugin/:tenant_id")
+	pprofGroup := engine.Group("/debug/pprof")
+
 	if config.SentryEnabled {
-		engine.Use(sentrygin.New(sentrygin.Options{
-			Repanic: true,
-		}))
+		// setup sentry for all groups
+		sentryGroup := []*gin.RouterGroup{
+			endpointGroup,
+			awsLambdaTransactionGroup,
+			pluginGroup,
+		}
+		for _, group := range sentryGroup {
+			group.Use(sentrygin.New(sentrygin.Options{
+				Repanic: true,
+			}))
+		}
 	}
-	engine.GET("/health/check", controllers.HealthCheck)
 
-	app.endpointGroup(engine.Group("/e"), config)
-	app.awsLambdaTransactionGroup(engine.Group("/backwards-invocation"), config)
-	app.pluginGroup(engine.Group("/plugin/:tenant_id"), config)
-	app.pprofGroup(engine.Group("/debug/pprof"), config)
+	app.endpointGroup(endpointGroup, config)
+	app.awsLambdaTransactionGroup(awsLambdaTransactionGroup, config)
+	app.pluginGroup(pluginGroup, config)
+	app.pprofGroup(pprofGroup, config)
 
 	srv := &http.Server{
 		Addr:    fmt.Sprintf(":%d", config.ServerPort),