Skip to content

Commit bdddfd5

Browse files
committed
gopls/internal/server: add counters for add and remove struct tags
One telemetry counter for add struct tags codeaction and one for remove struct tags codeaction. For golang/go#74568 Change-Id: I5c45167f87eea5639a16ee2fc0275adc0ff03ad4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/688156 Reviewed-by: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 23dd839 commit bdddfd5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

gopls/internal/server/command.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,8 +1806,13 @@ func (c *commandHandler) ModifyTags(ctx context.Context, args command.ModifyTags
18061806
}
18071807
m.Transform = transform
18081808

1809+
// Each command involves either adding or removing tags, depending on
1810+
// whether Add or Clear is set.
18091811
if args.Add != "" {
1812+
countAddStructTags.Inc()
18101813
m.Add = strings.Split(args.Add, ",")
1814+
} else if args.Clear {
1815+
countRemoveStructTags.Inc()
18111816
}
18121817
if args.AddOptions != "" {
18131818
if options, err := optionsStringToMap(args.AddOptions); err != nil {

gopls/internal/server/counters.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ var (
3535

3636
countRename = counter.New("gopls/rename")
3737
)
38+
39+
// Proposed counters for evaluating gopls refactoring codeactions add struct
40+
// tags and remove struct tags.
41+
var (
42+
countAddStructTags = counter.New("gopls/structtags:add")
43+
44+
countRemoveStructTags = counter.New("gopls/structtags:remove")
45+
)

0 commit comments

Comments
 (0)