Skip to content

Commit

Permalink
test(logqlengine): reduce cardinality in groupEntries benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jul 2, 2024
1 parent 9616620 commit 60fcf9a
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions internal/logql/logqlengine/engine_log_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package logqlengine

import (
"cmp"
"encoding/binary"
"fmt"
"slices"
"strings"
Expand All @@ -17,7 +16,6 @@ import (
"github.com/go-faster/oteldb/internal/logql"
"github.com/go-faster/oteldb/internal/logql/logqlengine/logqlabels"
"github.com/go-faster/oteldb/internal/lokiapi"
"github.com/go-faster/oteldb/internal/otelstorage"
)

func labelSet(keyval ...string) logqlabels.LabelSet {
Expand Down Expand Up @@ -112,7 +110,7 @@ func generateLogs(now time.Time) (entries []Entry) {
IP string
Protocol string
}
for j, b := range []httpLogBatch{
for _, b := range []httpLogBatch{
{Method: "GET", Status: 200, Count: 11, IP: "200.1.1.1", Protocol: "HTTP/1.0"},
{Method: "GET", Status: 200, Count: 10, IP: "200.1.1.1", Protocol: "HTTP/1.1"},
{Method: "DELETE", Status: 200, Count: 20, IP: "200.1.1.1", Protocol: "HTTP/2.0"},
Expand All @@ -125,20 +123,6 @@ func generateLogs(now time.Time) (entries []Entry) {
{Method: "PUT", Status: 200, Count: 20, IP: "200.1.1.1", Protocol: "HTTP/2.0"},
} {
for i := 0; i < b.Count; i++ {
var (
spanID otelstorage.SpanID
traceID otelstorage.TraceID
)
{
// Predictable IDs for testing.
binary.PutUvarint(spanID[:], uint64(i+1056123959+j*100))
spanID[7] = byte(j)
spanID[6] = byte(i)
binary.PutUvarint(traceID[:], uint64(i+3959+j*1000))
binary.PutUvarint(traceID[8:], uint64(i+13+j*1000))
traceID[15] = byte(j)
traceID[14] = byte(i)
}
now = now.Add(time.Millisecond * 120)
severity := plog.SeverityNumberInfo
switch b.Status / 100 {
Expand All @@ -156,8 +140,6 @@ func generateLogs(now time.Time) (entries []Entry) {
Line: "line",
Set: labelSet(
"level", strings.ToLower(severity.String()),
"span_id", spanID.Hex(),
"trace_id", traceID.Hex(),
"method", b.Method,
"status", fmt.Sprint(b.Status),
"bytes", fmt.Sprint(250),
Expand Down

0 comments on commit 60fcf9a

Please sign in to comment.