Skip to content

Commit

Permalink
Merge pull request #133 from internetarchive/pyroscope-improvements
Browse files Browse the repository at this point in the history
Add job and WARC prefix to pyroscope tags for better search
  • Loading branch information
CorentinB authored Aug 18, 2024
2 parents 351a268 + 71f9c87 commit 764b35c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
name: release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@af4a9db7b0ee3cf602cb75541d72bf568a99da4f #release/rel-v1.42
- uses: actions/checkout@v5
- uses: wangyoucao577/go-release-action@6ac7dba1f9e61850053324549cb6bc88e4b473d2 #release/rel-v1.51
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.23'

Expand Down
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 764b35c

Please sign in to comment.