Skip to content

Commit ec9a1f9

Browse files
committed
improves documentation for config options
1 parent e27d76f commit ec9a1f9

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

pkg/cli/cli.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/pyroscope-io/pyroscope/pkg/agent"
16+
"github.com/pyroscope-io/pyroscope/pkg/agent/spy"
1617
"github.com/pyroscope-io/pyroscope/pkg/agent/upstream/direct"
1718
"github.com/pyroscope-io/pyroscope/pkg/analytics"
1819
"github.com/pyroscope-io/pyroscope/pkg/build"
@@ -50,6 +51,7 @@ func populateFlagSet(obj interface{}, flagSet *flag.FlagSet) {
5051
num := t.NumField()
5152

5253
installPrefix := getInstallPrefix()
54+
supportedSpies := strings.Join(spy.SupportedExecSpies(), ", ")
5355

5456
for i := 0; i < num; i++ {
5557
field := t.Field(i)
@@ -64,6 +66,7 @@ func populateFlagSet(obj interface{}, flagSet *flag.FlagSet) {
6466
if nameVal == "" {
6567
nameVal = strcase.ToKebab(field.Name)
6668
}
69+
descVal = strings.ReplaceAll(descVal, "<supportedProfilers>", supportedSpies)
6770

6871
switch field.Type {
6972
case reflect.TypeOf([]string{}):
@@ -234,6 +237,9 @@ func Start(cfg *config.Config) error {
234237
return convert.Cli(cfg, args)
235238
}
236239
execCmd.Exec = func(_ context.Context, args []string) error {
240+
if l, err := logrus.ParseLevel(cfg.Exec.LogLevel); err == nil {
241+
logrus.SetLevel(l)
242+
}
237243
if len(args) == 0 {
238244
fmt.Println(gradientBanner())
239245
fmt.Println(DefaultUsageFunc(execCmd))

pkg/config/config.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,32 @@ type Agent struct {
2727
}
2828

2929
type Server struct {
30-
Config string `def:"<installPrefix>/etc/pyroscope/server.yml" desc:"location of config file"`
31-
LogLevel string `def:"info", desc:"debug|info|warn|error"`
32-
// TODO: fix, doesn't see to work
30+
Config string `def:"<installPrefix>/etc/pyroscope/server.yml" desc:"location of config file"`
31+
LogLevel string `def:"info", desc:"debug|info|warn|error"`
3332
BadgerLogLevel string `def:"error", desc:"debug|info|warn|error"`
3433

35-
StoragePath string `def:"<installPrefix>/var/lib/pyroscope"`
36-
ApiBindAddr string `def:":4040"`
37-
38-
CacheDimensionSize int `def:"1000"`
39-
CacheDictionarySize int `def:"1000"`
40-
CacheSegmentSize int `def:"1000"`
41-
CacheTreeSize int `def:"10000"`
42-
43-
Multiplier int `def:"10"`
44-
MinResolution time.Duration `def:"10s"`
45-
MaxResolution time.Duration `def:"8760h"` // 365 days
34+
StoragePath string `def:"<installPrefix>/var/lib/pyroscope" desc:"directory where pyroscope stores profiling data"`
35+
ApiBindAddr string `def:":4040" desc:"port for the HTTP server used for data ingestion and web UI"`
36+
37+
// These will eventually be replaced by some sort of a system that keeps track of RAM
38+
// and updates
39+
CacheDimensionSize int `def:"1000" desc:"max number of elements in LRU cache for dimensions"`
40+
CacheDictionarySize int `def:"1000" desc:"max number of elements in LRU cache for dictionaries"`
41+
CacheSegmentSize int `def:"1000" desc:"max number of elements in LRU cache for segments"`
42+
CacheTreeSize int `def:"10000" desc:"max number of elements in LRU cache for trees"`
43+
44+
// TODO: I don't think a lot of people will change these values.
45+
// I think these should just be constants.
46+
Multiplier int `skip:"true" def:"10"`
47+
MinResolution time.Duration `skip:"true" def:"10s"`
48+
MaxResolution time.Duration `skip:"true" def:"8760h"` // 365 days
4649
StorageMaxDepth int `skip:"true"`
4750

48-
MaxNodesSerialization int `def:"2048"`
49-
MaxNodesRender int `def:"2048"`
51+
MaxNodesSerialization int `def:"2048" desc:"max number of nodes used when saving profiles to disk"`
52+
MaxNodesRender int `def:"2048" desc:"max number of nodes used to display data on the frontend"`
5053

51-
HideApplications []string `def:""`
54+
// current only used in our demo app
55+
HideApplications []string `def:"" skip:"true"`
5256

5357
AnalyticsOptOut bool `def:"false" desc:"disables analytics"`
5458
}
@@ -58,12 +62,13 @@ type Convert struct {
5862
}
5963

6064
type Exec struct {
61-
SpyName string `def:"auto"`
65+
SpyName string `def:"auto" desc:"name of the profiler you want to use. Supported ones are: <supportedProfilers>"`
6266
ApplicationName string `def:"" desc:"application name used when uploading profiling data"`
63-
DetectSubprocesses bool `def:"true"`
67+
DetectSubprocesses bool `def:"true" desc:"makes pyroscope keep track of and profile subprocesses of the main process"`
68+
LogLevel string `def:"info", desc:"debug|info|warn|error"`
6469
ServerAddress string `def:"http://localhost:4040" desc:"address of the pyroscope server"`
6570
UpstreamThreads int `def:"4" desc:"number of upload threads"`
66-
UpstreamRequestTimeout time.Duration `def:"10s"`
71+
UpstreamRequestTimeout time.Duration `def:"10s" desc:"profile upload timeout"`
6772
NoLogging bool `def:"false" desc:"disables logging from pyroscope"`
6873
}
6974

0 commit comments

Comments
 (0)