Skip to content

Commit a7e956d

Browse files
authored
feat: add /metrics endpoint handler for Prometheus monitoring (#269)
On-behalf-of: @SAP [email protected] Signed-off-by: Angel Kafazov <[email protected]>
1 parent 6e60e1a commit a7e956d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/gateway.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
openmfpcontext "github.com/openmfp/golang-commons/context"
1111
"github.com/openmfp/golang-commons/sentry"
1212
"github.com/openmfp/golang-commons/traces"
13+
"github.com/prometheus/client_golang/prometheus/promhttp"
1314
"github.com/spf13/cobra"
1415
ctrl "sigs.k8s.io/controller-runtime"
1516
restCfg "sigs.k8s.io/controller-runtime/pkg/client/config"
@@ -85,6 +86,9 @@ var gatewayCmd = &cobra.Command{
8586
// Set up HTTP handler
8687
http.Handle("/", managerInstance)
8788

89+
// Replace the /metrics endpoint handler
90+
http.Handle("/metrics", promhttp.Handler())
91+
8892
// Start HTTP server with context
8993
server := &http.Server{
9094
Addr: fmt.Sprintf(":%s", appCfg.Gateway.Port),

0 commit comments

Comments
 (0)