Skip to content

Commit 6f09600

Browse files
authored
chore: correct vm ui link and include in json benchmark result (#3234)
1 parent 536f57e commit 6f09600

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

test/e2e/benchmark/result.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type traceResult struct {
2424
// resource attributes extracted from trace spans (OTEL_RESOURCE_ATTRIBUTES).
2525
evNodeAttrs *resourceAttrs
2626
evRethAttrs *resourceAttrs
27+
28+
// tracesURL is a link to the trace UI for the ev-node service.
29+
tracesURL string
2730
}
2831

2932
// displayFlowcharts renders ASCII flowcharts from rich spans. Falls back to

test/e2e/benchmark/run_result.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type runResult struct {
2727
Metrics runMetrics `json:"metrics"`
2828
BlockRange runBlockRange `json:"block_range"`
2929
Spamoor *runSpamoorStats `json:"spamoor,omitempty"`
30+
TracesURL string `json:"traces_url,omitempty"`
3031
FieldDescriptions map[string]string `json:"field_descriptions"`
3132
}
3233

@@ -195,6 +196,7 @@ func buildRunResult(cfg benchConfig, br *benchmarkResult, wallClock time.Duratio
195196
NonEmpty: br.bm.BlockCount,
196197
},
197198
Spamoor: spamoor,
199+
TracesURL: br.traces.tracesURL,
198200
FieldDescriptions: fieldDescriptions(),
199201
}
200202
}
@@ -306,5 +308,7 @@ func fieldDescriptions() map[string]string {
306308

307309
"spamoor.sent": "total txs successfully sent by spamoor",
308310
"spamoor.failed": "total txs that failed",
311+
312+
"traces_url": "VMUI link to view ev-node traces for this benchmark run",
309313
}
310314
}

test/e2e/benchmark/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ func (s *SpamoorSuite) collectTraces(e *env) *traceResult {
230230
evReth: e.traces.tryCollectSpans(ctx, e.evRethServiceName),
231231
}
232232

233-
if link := e.traces.uiURL(e.evNodeServiceName); link != "" {
233+
if link := e.traces.uiURL(e.evNodeServiceName, time.Now()); link != "" {
234234
t.Logf("traces UI: %s", link)
235+
tr.tracesURL = link
235236
}
236237

237238
if rc, ok := e.traces.(richSpanCollector); ok {

test/e2e/benchmark/traces.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type traceProvider interface {
3535
collectSpans(ctx context.Context, serviceName string) ([]e2e.TraceSpan, error)
3636
tryCollectSpans(ctx context.Context, serviceName string) []e2e.TraceSpan
3737
// uiURL returns a link to view traces for the given service, or empty string if not available.
38-
uiURL(serviceName string) string
38+
uiURL(serviceName string, end time.Time) string
3939
// resetStartTime sets the trace collection window start to now.
4040
resetStartTime()
4141
}
@@ -64,13 +64,15 @@ func (v *victoriaTraceProvider) resetStartTime() {
6464
v.startTime = time.Now()
6565
}
6666

67-
func (v *victoriaTraceProvider) uiURL(serviceName string) string {
67+
func (v *victoriaTraceProvider) uiURL(serviceName string, end time.Time) string {
6868
query := fmt.Sprintf(`_stream:{resource_attr:service.name="%s"}`, serviceName)
69-
return fmt.Sprintf("%s/select/vmui/#/query?query=%s&start=%s&end=%s",
69+
rangeInput := end.Sub(v.startTime).Round(time.Second).String()
70+
endInput := end.UTC().Format("2006-01-02T15:04:05")
71+
return fmt.Sprintf("%s/select/vmui/?#/?g0.expr=%s&g0.range_input=%s&g0.end_input=%s",
7072
strings.TrimRight(v.queryURL, "/"),
7173
neturl.QueryEscape(query),
72-
v.startTime.Format(time.RFC3339),
73-
time.Now().Format(time.RFC3339))
74+
rangeInput,
75+
endInput)
7476
}
7577

7678
func (v *victoriaTraceProvider) collectSpans(ctx context.Context, serviceName string) ([]e2e.TraceSpan, error) {

0 commit comments

Comments
 (0)