Skip to content

Commit

Permalink
internal/telemetry/cmd/stacks: fix distinctStacks
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jba committed Jan 22, 2025
1 parent d5cd1f8 commit 684910f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gopls/internal/telemetry/cmd/stacks/stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ func (info Info) String() string {
//
// stacks is a map of stack text to program metadata to stack+metadata report
// count.
// TODO(jba): fix distinctStacks doc? It seems to be the number of telemetry.ProgramReports, not the number of stacks.
// distinctStacks is the sum of all counts in stacks.
// distinctStacks is the number of distinct stacks across all reports.
// stackToURL maps the stack text to the oldest telemetry JSON report it was
// included in.
func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64, distinctStacks int, stackToURL map[string]string, err error) {
Expand Down Expand Up @@ -363,8 +362,6 @@ func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64
}
}

distinctStacks++

info := Info{
Program: prog.Program,
ProgramVersion: prog.Version,
Expand All @@ -382,6 +379,7 @@ func readReports(pcfg ProgramConfig, days int) (stacks map[string]map[Info]int64
counts[info] += count
stackToURL[stack] = url
}
distinctStacks += len(prog.Stacks)
}
}
}
Expand Down

0 comments on commit 684910f

Please sign in to comment.