Skip to content

Commit

Permalink
add iter
Browse files Browse the repository at this point in the history
  • Loading branch information
tsenart committed Jun 18, 2024
1 parent f26e745 commit 9490db3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions axiom/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func gitSha() string {

func benchmark(ctx context.Context, cli *axiomClient, id int, query string, iters int, noCache, noColumnFilters bool, enc *json.Encoder) error {
for i := 1; i <= iters; i++ {
result, err := cli.Query(ctx, id, query, noCache, noColumnFilters)
result, err := cli.Query(ctx, i, id, query, noCache, noColumnFilters)
if err != nil {
return fmt.Errorf("failed query #%d, iter %d: %w", id, i, err)
}
Expand Down Expand Up @@ -184,6 +184,8 @@ type QueryResult struct {
Error string `json:"error"`
// Cost is the cost of the query in GBms
Cost int `json:"cost"`
// Iter is the iteration number of the query within a run
Iter int `json:"iter"`
}

type httpError struct {
Expand Down Expand Up @@ -258,14 +260,15 @@ func (c *axiomClient) query(ctx context.Context, id int, aplQuery string, noCach
return &r, resp, nil
}

func (c *axiomClient) Query(ctx context.Context, id int, aplQuery string, noCache, noColumnFilters bool) (*QueryResult, error) {
func (c *axiomClient) Query(ctx context.Context, iter, id int, aplQuery string, noCache, noColumnFilters bool) (*QueryResult, error) {
began := time.Now().UTC()

result := &QueryResult{
Query: aplQuery,
ID: id,
Time: began,
Version: c.version,
Iter: iter,
}

var httpErr *httpError
Expand Down
2 changes: 1 addition & 1 deletion axiom/server_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func serverVersions(apiURL, traceURL, org, token, label string, failfast bool) e
earliest time.Time
)

sc.Buffer(make([]byte, 0, 1024*1024), 0)
sc.Buffer(make([]byte, 0, 10*1024*1024), 0)

for sc.Scan() {
var r QueryResult
Expand Down

0 comments on commit 9490db3

Please sign in to comment.