Skip to content

Commit

Permalink
test(pyroscope): add simple unscientific benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
tomershafir committed Jan 11, 2024
1 parent dfec83d commit f70c6d6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions exporter/clickhouseprofileexporter/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func initMetrics(meter metric.Meter) error {
if otelcolExporterClickhouseProfileFlushTimeMillis, err = meter.Int64Histogram(
fmt.Sprint(prefix, "flush_time_millis"),
metric.WithDescription("Clickhouse profile exporter flush time in millis"),
metric.WithExplicitBucketBoundaries(0, 5, 10, 20, 50, 100, 200, 500, 1000, 5000),
); err != nil {
return err
}
Expand Down
3 changes: 3 additions & 0 deletions receiver/pyroscopereceiver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ func initMetrics(meter metric.Meter) error {
if otelcolReceiverPyroscopeRequestBodyUncompressedSizeBytes, err = meter.Int64Histogram(
fmt.Sprint(prefix, "request_body_uncompressed_size_bytes"),
metric.WithDescription("Pyroscope receiver uncompressed request body size in bytes"),
metric.WithExplicitBucketBoundaries(0, 1024, 4096, 16384, 32768, 65536, 131072, 262144, 524288, 1048576),
); err != nil {
return err
}
if otelcolReceiverPyroscopeParsedBodyUncompressedSizeBytes, err = meter.Int64Histogram(
fmt.Sprint(prefix, "parsed_body_uncompressed_size_bytes"),
metric.WithDescription("Pyroscope receiver uncompressed parsed body size in bytes"),
metric.WithExplicitBucketBoundaries(0, 1024, 4096, 16384, 32768, 65536, 131072, 262144, 524288, 1048576),
); err != nil {
return err
}
if otelcolReceiverPyroscopeHttpResponseTimeMillis, err = meter.Int64Histogram(
fmt.Sprint(prefix, "http_response_time_millis"),
metric.WithDescription("Pyroscope receiver http response time in millis"),
metric.WithExplicitBucketBoundaries(0, 5, 10, 20, 50, 100, 200, 500, 1000, 5000),
); err != nil {
return err
}
Expand Down
45 changes: 45 additions & 0 deletions receiver/pyroscopereceiver/pyroscope_pipeline_bench_test.go
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)

Check failure on line 42 in receiver/pyroscopereceiver/pyroscope_pipeline_bench_test.go

View workflow job for this annotation

GitHub Actions / lint-and-test

not enough arguments in call to send
j = (j + 1) % len(dist)
}
}

0 comments on commit f70c6d6

Please sign in to comment.