Skip to content

Commit

Permalink
feat(logqlbench): add label queries
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Dec 6, 2024
1 parent a630a6a commit 1acf68d
Show file tree
Hide file tree
Showing 3 changed files with 343 additions and 152 deletions.
13 changes: 8 additions & 5 deletions cmd/otelbench/logqlbench/logqlbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type LogQLBenchmark struct {
client *lokiapi.Client
start time.Time
end time.Time
limit int
}

// Setup setups benchmark using given flags.
Expand All @@ -53,6 +54,7 @@ func (p *LogQLBenchmark) Setup(cmd *cobra.Command) error {
if p.end, err = lokihandler.ParseTimestamp(p.EndTime, time.Time{}); err != nil {
return errors.Wrap(err, "parse end time")
}
p.limit = 1000

p.tracker, err = chtracker.Setup[Query](ctx, "logql", p.TrackerOptions)
if err != nil {
Expand Down Expand Up @@ -131,12 +133,13 @@ func (p *LogQLBenchmark) Run(ctx context.Context) error {
var reports []LogQLReportQuery
if err := p.tracker.Report(ctx,
func(ctx context.Context, tq chtracker.TrackedQuery[Query], queries []chtracker.QueryReport) error {
header := tq.Meta.Header()
reports = append(reports, LogQLReportQuery{
ID: tq.Meta.ID,
Title: tq.Meta.Title,
Description: tq.Meta.Description,
Query: tq.Meta.Query,
Matchers: tq.Meta.Match,
ID: header.ID,
Title: header.Title,
Description: header.Description,
Query: tq.Meta.Query(),
Matchers: tq.Meta.Matchers(),
DurationNanos: tq.Duration.Nanoseconds(),
Queries: queries,
Timeout: tq.Timeout,
Expand Down
Loading

0 comments on commit 1acf68d

Please sign in to comment.