diff --git a/main.go b/main.go index 538c63a..746cc77 100644 --- a/main.go +++ b/main.go @@ -213,7 +213,7 @@ func main() { // Init Gin Framework gin.SetMode(gin.ReleaseMode) - r, srv := router.NewGinGonicHTTPServer(&setupLog, bindAddr) + r, srv := router.NewGinGonicHTTPServer(bindAddr, &setupLog, serviceName) setupLog.Info("Load API routes") router.Load(r, shortlinkController) diff --git a/pkg/router/router.go b/pkg/router/router.go index ac72a83..4482315 100644 --- a/pkg/router/router.go +++ b/pkg/router/router.go @@ -33,11 +33,11 @@ import ( // @in header // @name Authorization -func NewGinGonicHTTPServer(setupLog *logr.Logger, bindAddr string) (*gin.Engine, *http.Server) { +func NewGinGonicHTTPServer(bindAddr string, setupLog *logr.Logger, serviceName string) (*gin.Engine, *http.Server) { router := gin.New() router.Use( - otelgin.Middleware("urlshortener"), - PromMiddleware("urlshortener"), + otelgin.Middleware(serviceName), + PromMiddleware(serviceName), secure.Secure(secure.Options{ SSLRedirect: true, SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},