wip: remove timre

This commit is contained in:
Laurence 2024-04-18 12:46:02 +01:00
parent badbf9d1cb
commit e1d9f7c2ce
No known key found for this signature in database
GPG key ID: B053BEE3478E8FEF

View file

@ -12,7 +12,6 @@ import (
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings" "strings"
"time"
"github.com/blackfireio/osinfo" "github.com/blackfireio/osinfo"
"github.com/go-openapi/strfmt" "github.com/go-openapi/strfmt"
@ -270,9 +269,7 @@ func collectAcquisitionConfig() map[string][]byte {
func collectPprofs() ([]byte, []byte, []byte) { func collectPprofs() ([]byte, []byte, []byte) {
log.Info("Collecting pprof data") log.Info("Collecting pprof data")
client := &http.Client{ client := &http.Client{}
Timeout: 30 * time.Second,
}
cpu, err := collectPprof(client, "profile") cpu, err := collectPprof(client, "profile")
if err != nil { if err != nil {
cpu = []byte(fmt.Sprintf("could not read cpu profile: %s", err)) cpu = []byte(fmt.Sprintf("could not read cpu profile: %s", err))
@ -292,7 +289,7 @@ func collectPprofs() ([]byte, []byte, []byte) {
} }
func collectPprof(h *http.Client, endpoint string) ([]byte, error) { func collectPprof(h *http.Client, endpoint string) ([]byte, error) {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s:%d/debug/pprof/%s", csConfig.Prometheus.ListenAddr, csConfig.Prometheus.ListenPort, endpoint), nil) req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s:%d/debug/pprof/%s?debug=1", csConfig.Prometheus.ListenAddr, csConfig.Prometheus.ListenPort, endpoint), nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }