From a11e93ee6d38e32c1c3b0fda3b3a3ce54a666cd3 Mon Sep 17 00:00:00 2001 From: Cedric Kienzler Date: Fri, 10 Mar 2023 20:31:20 +0100 Subject: [PATCH] streamline serviceName --- main.go | 2 +- pkg/router/router.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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"},