diff --git a/test/e2e/benchmark/result.go b/test/e2e/benchmark/result.go index de5ff3764..cdf2729ac 100644 --- a/test/e2e/benchmark/result.go +++ b/test/e2e/benchmark/result.go @@ -24,6 +24,9 @@ type traceResult struct { // resource attributes extracted from trace spans (OTEL_RESOURCE_ATTRIBUTES). evNodeAttrs *resourceAttrs evRethAttrs *resourceAttrs + + // tracesURL is a link to the trace UI for the ev-node service. + tracesURL string } // displayFlowcharts renders ASCII flowcharts from rich spans. Falls back to diff --git a/test/e2e/benchmark/run_result.go b/test/e2e/benchmark/run_result.go index bbab4a85f..d1dc9901c 100644 --- a/test/e2e/benchmark/run_result.go +++ b/test/e2e/benchmark/run_result.go @@ -27,6 +27,7 @@ type runResult struct { Metrics runMetrics `json:"metrics"` BlockRange runBlockRange `json:"block_range"` Spamoor *runSpamoorStats `json:"spamoor,omitempty"` + TracesURL string `json:"traces_url,omitempty"` FieldDescriptions map[string]string `json:"field_descriptions"` } @@ -195,6 +196,7 @@ func buildRunResult(cfg benchConfig, br *benchmarkResult, wallClock time.Duratio NonEmpty: br.bm.BlockCount, }, Spamoor: spamoor, + TracesURL: br.traces.tracesURL, FieldDescriptions: fieldDescriptions(), } } @@ -306,5 +308,7 @@ func fieldDescriptions() map[string]string { "spamoor.sent": "total txs successfully sent by spamoor", "spamoor.failed": "total txs that failed", + + "traces_url": "VMUI link to view ev-node traces for this benchmark run", } } diff --git a/test/e2e/benchmark/suite_test.go b/test/e2e/benchmark/suite_test.go index b7e4a48d8..b58c496ac 100644 --- a/test/e2e/benchmark/suite_test.go +++ b/test/e2e/benchmark/suite_test.go @@ -230,8 +230,9 @@ func (s *SpamoorSuite) collectTraces(e *env) *traceResult { evReth: e.traces.tryCollectSpans(ctx, e.evRethServiceName), } - if link := e.traces.uiURL(e.evNodeServiceName); link != "" { + if link := e.traces.uiURL(e.evNodeServiceName, time.Now()); link != "" { t.Logf("traces UI: %s", link) + tr.tracesURL = link } if rc, ok := e.traces.(richSpanCollector); ok { diff --git a/test/e2e/benchmark/traces.go b/test/e2e/benchmark/traces.go index 5e462bac6..7ff151b72 100644 --- a/test/e2e/benchmark/traces.go +++ b/test/e2e/benchmark/traces.go @@ -35,7 +35,7 @@ type traceProvider interface { collectSpans(ctx context.Context, serviceName string) ([]e2e.TraceSpan, error) tryCollectSpans(ctx context.Context, serviceName string) []e2e.TraceSpan // uiURL returns a link to view traces for the given service, or empty string if not available. - uiURL(serviceName string) string + uiURL(serviceName string, end time.Time) string // resetStartTime sets the trace collection window start to now. resetStartTime() } @@ -64,13 +64,15 @@ func (v *victoriaTraceProvider) resetStartTime() { v.startTime = time.Now() } -func (v *victoriaTraceProvider) uiURL(serviceName string) string { +func (v *victoriaTraceProvider) uiURL(serviceName string, end time.Time) string { query := fmt.Sprintf(`_stream:{resource_attr:service.name="%s"}`, serviceName) - return fmt.Sprintf("%s/select/vmui/#/query?query=%s&start=%s&end=%s", + rangeInput := end.Sub(v.startTime).Round(time.Second).String() + endInput := end.UTC().Format("2006-01-02T15:04:05") + return fmt.Sprintf("%s/select/vmui/?#/?g0.expr=%s&g0.range_input=%s&g0.end_input=%s", strings.TrimRight(v.queryURL, "/"), neturl.QueryEscape(query), - v.startTime.Format(time.RFC3339), - time.Now().Format(time.RFC3339)) + rangeInput, + endInput) } func (v *victoriaTraceProvider) collectSpans(ctx context.Context, serviceName string) ([]e2e.TraceSpan, error) {