VictoriaMetrics/lib/protoparser/newrelic/parser_timing_test.go
Aliaksandr Valialkin 815e9bf892
app/{vmagent,vminsert}: follow-up for NewRelic data ingestion protocol support
This is a follow-up for f60c08a7bd

Changes:

- Make sure all the urls related to NewRelic protocol start from /newrelic . Previously some urls were started from /api/v1/newrelic

- Remove /api/v1 part from NewRelic urls, since it has no sense

- Remove automatic transformation from CamelCase to snake_case for NewRelic labels and metric names,
  since it may complicate the transition from NewRelic to VictoriaMetrics. Preserve all the metric names and label names,
  so users could query metrics and labels by the same names which are used in NewRelic.
  The automatic transformation from CamelCase to snake_case can be added later as a special action for relabeling rules if needed.

- Properly update per-tenant data ingestion stats at app/vmagent/newrelic/request_handler.go . Previously it was always zero.

- Fix NewRelic urls in vmagent when multitenant data ingestion is enabled. Previously they were mistakenly started from `/`.

- Document NewRelic data ingestion url at docs/Cluster-VictoriaMetrics.md

- Remove superflouos memory allocations at lib/protoparser/newrelic

- Improve tests at lib/protoparser/newrelic/*

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3520
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4712
2023-10-16 13:55:04 +02:00

69 lines
1.9 KiB
Go

package newrelic
import (
"fmt"
"testing"
)
func BenchmarkRowsUnmarshal(b *testing.B) {
reqBody := []byte(`[
{
"EntityID":28257883748326179,
"IsAgent":true,
"Events":[
{
"eventType":"SystemSample",
"timestamp":1690286061,
"entityKey":"macbook-pro.local",
"cpuPercent":25.056660790748904,
"cpuUserPercent":8.687987912389374,
"cpuSystemPercent":16.36867287835953,
"cpuIOWaitPercent":0,
"cpuIdlePercent":74.94333920925109,
"cpuStealPercent":0,
"loadAverageOneMinute":5.42333984375,
"loadAverageFiveMinute":4.099609375,
"loadAverageFifteenMinute":3.58203125,
"memoryTotalBytes":17179869184,
"memoryFreeBytes":3782705152,
"memoryUsedBytes":13397164032,
"memoryFreePercent":22.01824188232422,
"memoryUsedPercent":77.98175811767578,
"memoryCachedBytes":0,
"memorySlabBytes":0,
"memorySharedBytes":0,
"memoryKernelFree":89587712,
"swapTotalBytes":7516192768,
"swapFreeBytes":1737293824,
"swapUsedBytes":5778898944,
"diskUsedBytes":0,
"diskUsedPercent":0,
"diskFreeBytes":0,
"diskFreePercent":0,
"diskTotalBytes":0,
"diskUtilizationPercent":0,
"diskReadUtilizationPercent":0,
"diskWriteUtilizationPercent":0,
"diskReadsPerSecond":0,
"diskWritesPerSecond":0,
"uptime":762376
}
],
"ReportingAgentID":28257883748326179
}
]`)
b.SetBytes(int64(len(reqBody)))
b.ReportAllocs()
b.RunParallel(func(pb *testing.PB) {
var r Rows
for pb.Next() {
if err := r.Unmarshal(reqBody); err != nil {
panic(fmt.Errorf("unmarshal error: %s", err))
}
if len(r.Rows) != 1 {
panic(fmt.Errorf("unexpected number of items unmarshaled; got %d; want %d", len(r.Rows), 1))
}
}
})
}