Skip to content

Commit ec5ef86

Browse files
committed
fixup: use proper group-based uri
1 parent 17ad5eb commit ec5ef86

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

testing/testing/benchmark.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,29 @@ func (s *benchState) processBench(b *B) {
788788
CodspeedTimePerRoundNs []time.Duration `json:"codspeed_time_per_round_ns"`
789789
CodspeedItersPerRound []int64 `json:"codspeed_iters_per_round"`
790790
}
791+
792+
// Build custom bench name with :: separator
793+
var nameParts []string
794+
current := &b.common
795+
for current.parent != nil {
796+
// Extract the sub-benchmark part by removing parent prefix
797+
parentName := current.parent.name
798+
if strings.HasPrefix(current.name, parentName+"/") {
799+
subName := strings.TrimPrefix(current.name, parentName+"/")
800+
nameParts = append([]string{subName}, nameParts...)
801+
} else {
802+
nameParts = append([]string{current.name}, nameParts...)
803+
}
804+
805+
if current.parent.name == "Main" {
806+
break
807+
}
808+
current = current.parent
809+
}
810+
customBenchName := strings.Join(nameParts, "::")
811+
791812
rawResults := RawResults{
792-
BenchmarkName: b.name,
813+
BenchmarkName: customBenchName,
793814
Pid: os.Getpid(),
794815
CodspeedTimePerRoundNs: r.CodspeedTimePerRoundNs,
795816
CodspeedItersPerRound: r.CodspeedItersPerRound,

0 commit comments

Comments
 (0)