Skip to content

Commit

Permalink
feat(pyroscope/scrape): add support for configuring CPU profile's dur…
Browse files Browse the repository at this point in the history
…ation scraped by `pyroscope.scrape`

Signed-off-by: hainenber <[email protected]>
  • Loading branch information
hainenber committed May 1, 2024
1 parent fd9c97c commit 581b887
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions internal/component/pyroscope/scrape/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,50 @@ func Test_targetsFromGroup_withSpecifiedProfilingDuration(t *testing.T) {
require.Equal(t, expected, active)
require.Empty(t, dropped)
}

// Test that the godeltaprof is not surfaced publicly
func Test_NewTarget_godeltaprof(t *testing.T) {
withGodeltaprof := NewTarget(
labels.FromMap(map[string]string{
model.AddressLabel: "localhost:9094",
serviceNameLabel: "docker-container",
model.MetricNameLabel: pprofGoDeltaProfMemory,
ProfilePath: "/debug/pprof/delta_heap",
model.SchemeLabel: "http",
"foo": "bar",
"instance": "localhost:9094",
}),
labels.FromMap(map[string]string{
model.AddressLabel: "localhost:9094",
"__meta_docker_container_name": "docker-container",
model.MetricNameLabel: pprofGoDeltaProfMemory,
ProfilePath: "/debug/pprof/delta_heap",
model.SchemeLabel: "http",
"foo": "bar",
}),
url.Values{},
)
withoutGodeltaprof := NewTarget(
labels.FromMap(map[string]string{
model.AddressLabel: "localhost:9094",
serviceNameLabel: "docker-container",
model.MetricNameLabel: pprofMemory,
ProfilePath: "/debug/pprof/heap",
model.SchemeLabel: "http",
"foo": "bar",
"instance": "localhost:9094",
}),
labels.FromMap(map[string]string{
model.AddressLabel: "localhost:9094",
"__meta_docker_container_name": "docker-container",
model.MetricNameLabel: pprofMemory,
ProfilePath: "/debug/pprof/heap",
model.SchemeLabel: "http",
"foo": "bar",
}),
url.Values{},
)

require.NotEqual(t, withGodeltaprof.allLabels, withoutGodeltaprof.allLabels)
require.Equal(t, withGodeltaprof.publicLabels, withoutGodeltaprof.publicLabels)
}

0 comments on commit 581b887

Please sign in to comment.