Skip to content

Commit

Permalink
Merge pull request #51 from bjwswang/llms
Browse files Browse the repository at this point in the history
fix: add http probe and profiling; update to correct arcadia image
  • Loading branch information
bjwswang authored Aug 21, 2023
2 parents a6810eb + 2a2c97c commit 1b9f847
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/arcadia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: arcadia
description: A Helm chart(KubeBB Component) for KubeAGI Arcadia
type: application
version: 0.1.2
version: 0.1.3
appVersion: "0.0.0"
keywords:
- kubeagi
Expand Down
2 changes: 1 addition & 1 deletion charts/arcadia/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
deployment:
image: kubeagi/arcadia:latest
image: kubebb/arcadia:latest
imagePullPolcy: IfNotPresent
resources:
limits:
Expand Down
21 changes: 19 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package main

import (
"flag"
"net/http"
"net/http/pprof"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -51,11 +53,18 @@ func init() {
}

func main() {
var configFile string
var (
configFile string
enableProfiling bool
probeAddr string
)
flag.StringVar(&configFile, "config", "",
"The controller will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. "+
"Command-line flags override configuration from this file.")
flag.BoolVar(&enableProfiling, "profiling", true,
"Enable profiling via web interface host:port/debug/pprof/")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
opts := zap.Options{
Development: true,
}
Expand All @@ -65,7 +74,7 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

var err error
options := ctrl.Options{Scheme: scheme}
options := ctrl.Options{Scheme: scheme, HealthProbeBindAddress: probeAddr}
if configFile != "" {
options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile))
if err != nil {
Expand Down Expand Up @@ -148,6 +157,14 @@ func main() {
os.Exit(1)
}

if enableProfiling {
_ = mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
_ = mgr.AddMetricsExtraHandler("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
_ = mgr.AddMetricsExtraHandler("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
_ = mgr.AddMetricsExtraHandler("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
_ = mgr.AddMetricsExtraHandler("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
Expand Down

0 comments on commit 1b9f847

Please sign in to comment.