MCPcopy Create free account
hub / github.com/PostHog/duckgres / executeIteration

Method executeIteration

tests/perf/core/runner.go:111–156  ·  view source on GitHub ↗
(ctx context.Context, measure bool, measureIteration int, summary *RunSummary)

Source from the content-addressed store, hash-verified

109
110 for _, protocol := range r.cfg.Catalog.Targets {
111 warmupIterations := r.cfg.Catalog.WarmupIterations
112 for i := 0; i < warmupIterations; i++ {
113 if err := r.executeIteration(ctx, protocol, false, 0, &summary); err != nil {
114 return summary, err
115 }
116 }
117 measureIterations := r.cfg.Catalog.MeasureIterations
118 for i := 0; i < measureIterations; i++ {
119 if err := r.executeIteration(ctx, protocol, true, i+1, &summary); err != nil {
120 return summary, err
121 }
122 }
123 }
124
125 summary.FinishedAt = r.cfg.Now()
126 metricsText, err := r.metrics.OpenMetricsText()
127 if err != nil {
128 return summary, err
129 }
130 if r.cfg.Sink != nil {
131 if err := r.cfg.Sink.Close(summary, metricsText); err != nil {
132 return summary, fmt.Errorf("close sink: %w", err)
133 }
134 }
135 return summary, nil
136}
137
138func (r *QueryRunner) MetricsGatherer() prometheus.Gatherer {
139 return r.metrics.Gatherer()
140}
141
142func (r *QueryRunner) executeIteration(ctx context.Context, protocol Protocol, measure bool, measureIteration int, summary *RunSummary) error {
143 for _, query := range r.cfg.Catalog.Queries {
144 if query.SkipReason != "" || query.ValidationOnly || !querySupportsProtocol(query, protocol) {
145 continue
146 }
147 args := orderedParamValues(query.Params)
148 driver := r.cfg.Drivers[protocol]
149 started := r.cfg.Now()
150 result := QueryResult{
151 QueryID: query.QueryID,
152 Representation: query.Representation,
153 IntentID: query.IntentID,
154 MeasureIteration: measureIteration,
155 Protocol: protocol,
156 StartedAt: started,
157 }
158
159 execResult, err := driver.Execute(ctx, query, args)

Callers 1

RunMethod · 0.95

Calls 6

orderedParamValuesFunction · 0.85
NowMethod · 0.80
ObserveMethod · 0.80
ExecuteMethod · 0.65
RecordMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected