Skip to content

Commit

Permalink
feat: add job and WARC prefix to pyroscope tags for better search
Browse files Browse the repository at this point in the history
this will allow us to actually differentiate crawls on different machines
  • Loading branch information
NGTmeaty committed Aug 17, 2024
1 parent 351a268 commit 2c7f8cb
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions internal/pkg/crawl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,40 +158,6 @@ func GenerateCrawlConfig(config *config.Config) (*Crawl, error) {
customLoggerConfig.ElasticsearchConfig = nil
}

if config.PyroscopeAddress != "" {
runtime.SetMutexProfileFraction(5)
runtime.SetBlockProfileRate(5)

hostname, err := os.Hostname()
if err != nil {
return nil, err
}

pyroscope.Start(pyroscope.Config{
ApplicationName: "zeno",

ServerAddress: config.PyroscopeAddress,

// Debug logging for Pyroscope can be enabled with pyroscope.StandardLogger
Logger: nil,

Tags: map[string]string{"hostname": hostname, "version": utils.GetVersion().Version},

ProfileTypes: []pyroscope.ProfileType{
pyroscope.ProfileCPU,
pyroscope.ProfileAllocObjects,
pyroscope.ProfileAllocSpace,
pyroscope.ProfileInuseObjects,
pyroscope.ProfileInuseSpace,
pyroscope.ProfileGoroutines,
pyroscope.ProfileMutexCount,
pyroscope.ProfileMutexDuration,
pyroscope.ProfileBlockCount,
pyroscope.ProfileBlockDuration,
},
})
}

customLogger, err := log.New(customLoggerConfig)
if err != nil {
return nil, err
Expand Down Expand Up @@ -227,6 +193,40 @@ func GenerateCrawlConfig(config *config.Config) (*Crawl, error) {

c.Workers = NewPool(uint(config.WorkersCount), time.Second*60, c)

if config.PyroscopeAddress != "" {
runtime.SetMutexProfileFraction(5)
runtime.SetBlockProfileRate(5)

hostname, err := os.Hostname()
if err != nil {
return nil, err
}

pyroscope.Start(pyroscope.Config{
ApplicationName: "zeno",

ServerAddress: config.PyroscopeAddress,

// Debug logging for Pyroscope can be enabled with pyroscope.StandardLogger
Logger: nil,

Tags: map[string]string{"hostname": hostname, "version": utils.GetVersion().Version, "job": c.Job, "WARCPrefix": c.WARCPrefix},

ProfileTypes: []pyroscope.ProfileType{
pyroscope.ProfileCPU,
pyroscope.ProfileAllocObjects,
pyroscope.ProfileAllocSpace,
pyroscope.ProfileInuseObjects,
pyroscope.ProfileInuseSpace,
pyroscope.ProfileGoroutines,
pyroscope.ProfileMutexCount,
pyroscope.ProfileMutexDuration,
pyroscope.ProfileBlockCount,
pyroscope.ProfileBlockDuration,
},
})
}

c.UseSeencheck = config.LocalSeencheck
c.HTTPTimeout = config.HTTPTimeout
c.MaxConcurrentRequestsPerDomain = config.MaxConcurrentRequestsPerDomain
Expand Down

0 comments on commit 2c7f8cb

Please sign in to comment.