Skip to content

Commit

Permalink
workload: add prometheus NewGoCollector
Browse files Browse the repository at this point in the history
Previously, the workload would register only a Histogram
for the corresponding workload. This change adds NewGoCollector
which exports Go runtime metrics, i.e., gc and goroutines.

This change makes it easy to investigate performance
regressions within the workload generator.

Epic: none

Release note: workload generators now export Go runtime metrics
via Prometheus endpoint.
  • Loading branch information
srosenberg committed Apr 24, 2023
1 parent a2f31ca commit a52b0dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/workload/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go_library(
"//pkg/workload/histogram",
"//pkg/workload/workloadsql",
"@com_github_cockroachdb_errors//:errors",
"@com_github_prometheus_client_golang//prometheus/collectors",
"@com_github_prometheus_client_golang//prometheus/promhttp",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_pflag//:pflag",
Expand Down
2 changes: 2 additions & 0 deletions pkg/workload/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/workload/histogram"
"github.com/cockroachdb/cockroach/pkg/workload/workloadsql"
"github.com/cockroachdb/errors"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -415,6 +416,7 @@ func runRun(gen workload.Generator, urls []string, dbName string) error {
*histogramsMaxLatency,
gen.Meta().Name,
)
reg.Registerer().MustRegister(collectors.NewGoCollector())
// Expose the prometheus gatherer.
go func() {
if err := http.ListenAndServe(
Expand Down

0 comments on commit a52b0dd

Please sign in to comment.