Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into fixing-parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
pingsutw committed Aug 29, 2023
2 parents 9cec7c0 + ebc0ae7 commit 3448fcd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/controller/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cmd
import (
"context"
"flag"
"net/http"
"os"
"runtime"

Expand All @@ -21,6 +22,8 @@ import (
"github.com/flyteorg/flytestdlib/promutils/labeled"
"github.com/flyteorg/flytestdlib/version"

"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

Expand All @@ -32,6 +35,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/metrics"
)

const (
Expand Down Expand Up @@ -140,9 +144,17 @@ func executeRootCmd(baseCtx context.Context, cfg *config2.Config) error {
return err
}

handlers := map[string]http.Handler{
"/k8smetrics": promhttp.HandlerFor(metrics.Registry,
promhttp.HandlerOpts{
ErrorHandling: promhttp.HTTPErrorOnError,
},
),
}

g, childCtx := errgroup.WithContext(ctx)
g.Go(func() error {
err := profutils.StartProfilingServerWithDefaultHandlers(childCtx, cfg.ProfilerPort.Port, nil)
err := profutils.StartProfilingServerWithDefaultHandlers(childCtx, cfg.ProfilerPort.Port, handlers)
if err != nil {
logger.Fatalf(childCtx, "Failed to Start profiling and metrics server. Error: %v", err)
}
Expand Down

0 comments on commit 3448fcd

Please sign in to comment.