VictoriaMetrics/lib/protoparser/opentelemetry/stream/streamparser_timing_test.go
Andrii Chubatiuk 60cf0c9656
{vmagent,vminsert}: added firehose http destination opentelemetry data ingestion support (#5893)
Co-authored-by: Andrii Chubatiuk <wachy@Andriis-MBP-2.lan>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2024-02-29 14:46:16 +02:00

36 lines
843 B
Go

package stream
import (
"bytes"
"testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/protoparser/opentelemetry/pb"
)
func BenchmarkParseStream(b *testing.B) {
samples := []*pb.Metric{
generateGauge("my-gauge"),
generateHistogram("my-histogram"),
generateSum("my-sum"),
generateSummary("my-summary"),
}
b.SetBytes(1)
b.ReportAllocs()
b.RunParallel(func(p *testing.PB) {
pbRequest := pb.ExportMetricsServiceRequest{
ResourceMetrics: []*pb.ResourceMetrics{generateOTLPSamples(samples)},
}
data := pbRequest.MarshalProtobuf(nil)
for p.Next() {
err := ParseStream(bytes.NewBuffer(data), false, nil, func(tss []prompbmarshal.TimeSeries) error {
return nil
})
if err != nil {
b.Fatalf("cannot parse stream: %s", err)
}
}
})
}