-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(pyroscope): add simple unscientific benchmark
- Loading branch information
1 parent
dfec83d
commit 02ea6cb
Showing
4 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
receiver/pyroscopereceiver/pyroscope_pipeline_bench_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package pyroscopereceiver | ||
|
||
import ( | ||
"fmt" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
type request struct { | ||
urlParams map[string]string | ||
jfr string | ||
} | ||
|
||
// Benchmarks a running otelcol pyroscope write pipeline (collector and Clickhouse). | ||
// Adjust collectorAddr to bench a your target if needed. | ||
func BenchmarkPyroscopePipeline(b *testing.B) { | ||
dist := []request{ | ||
{ | ||
urlParams: map[string]string{ | ||
"name": "com.example.App{dc=us-east-1,kubernetes_pod_name=app-abcd1234}", | ||
"from": "1700332322", | ||
"until": "1700332329", | ||
"format": "jfr", | ||
"sampleRate": "100", | ||
}, | ||
jfr: filepath.Join("testdata", "cortex-dev-01__kafka-0__cpu__0.jfr"), | ||
}, | ||
{ | ||
urlParams: map[string]string{ | ||
"name": "com.example.App{dc=us-east-1,kubernetes_pod_name=app-abcd1234}", | ||
"from": "1700332322", | ||
"until": "1700332329", | ||
"format": "jfr", | ||
}, | ||
jfr: filepath.Join("testdata", "memory_alloc_live_example.jfr"), | ||
}, | ||
} | ||
collectorAddr := fmt.Sprintf("http://%s%s", defaultHttpAddr, ingestPath) | ||
|
||
b.ResetTimer() | ||
for i, j := 0, 0; i < b.N; i++ { | ||
send(collectorAddr, dist[j].urlParams, dist[j].jfr) | ||
j = (j + 1) % len(dist) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters