Skip to content

Commit 684910f

Browse files
committed
internal/telemetry/cmd/stacks: fix distinctStacks
Compute the total stack counts, as the doc says. Change-Id: Ia7ab82a3ee84ab1b91971b7ef20855e48b0c033a Reviewed-on: https://go-review.googlesource.com/c/tools/+/643779 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent d5cd1f8 commit 684910f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

gopls/internal/telemetry/cmd/stacks/stacks.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,7 @@ func (info Info) String() string {
303303
//
304304
// stacks is a map of stack text to program metadata to stack+metadata report
305305
// count.
306-
// TODO(jba): fix distinctStacks doc? It seems to be the number of telemetry.ProgramReports, not the number of stacks.
307-
// distinctStacks is the sum of all counts in stacks.
306+
// distinctStacks is the number of distinct stacks across all reports.
308307
// stackToURL maps the stack text to the oldest telemetry JSON report it was
309308
// included in.
310309
func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64, distinctStacks int, stackToURL map[string]string, err error) {
@@ -363,8 +362,6 @@ func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64
363362
}
364363
}
365364

366-
distinctStacks++
367-
368365
info := Info{
369366
Program: prog.Program,
370367
ProgramVersion: prog.Version,
@@ -382,6 +379,7 @@ func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64
382379
counts[info] += count
383380
stackToURL[stack] = url
384381
}
382+
distinctStacks += len(prog.Stacks)
385383
}
386384
}
387385
}

0 commit comments

Comments
 (0)