Debian Codegraph @

gopls/internal/server/counters.go

raw symbols SCIP
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package server
6
7 import "golang.org/x/telemetry/counter"
8
9 // Proposed counters for evaluating gopls code completion.
10 var (
11 complEmpty = counter.New("gopls/completion/len:0") // count empty suggestions
12 complShort = counter.New("gopls/completion/len:<=10") // not empty, not long
13 complLong = counter.New("gopls/completion/len:>10") // returning more than 10 items
14
15 changeFull = counter.New("gopls/completion/used:unknown") // full file change in didChange
16 complUnused = counter.New("gopls/completion/used:no") // did not use a completion
17 complUsed = counter.New("gopls/completion/used:yes") // used a completion
18
19 // exported so tests can verify that counters are incremented
20 CompletionCounters = []*counter.Counter{
21 complEmpty,
22 complShort,
23 complLong,
24 changeFull,
25 complUnused,
26 complUsed,
27 }
28 )
29
30 // Proposed counters for evaluating gopls change signature and rename. These
31 // counters increment when the user attempts to perform one of these operations,
32 // regardless of whether it succeeds.
33 var (
34 countChangeSignature = counter.New("gopls/changesig")
35
36 countRename = counter.New("gopls/rename")
37 )
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 )
46
47 // Proposed counters to evaluate vulncheck_prompt usage patterns.
48 var (
49 // Vulncheck prompt user choices.
50 countVulncheckPromptYes = counter.New("gopls/vulncheck-prompt/choice:yes")
51 countVulncheckPromptNo = counter.New("gopls/vulncheck-prompt/choice:no")
52 countVulncheckPromptAlways = counter.New("gopls/vulncheck-prompt/choice:always")
53 countVulncheckPromptNever = counter.New("gopls/vulncheck-prompt/choice:never")
54
55 // Vulncheck prompt upgrade choice.
56 countVulncheckUpgradeAll = counter.New("gopls/vulncheck-prompt/upgrade:yes")
57 countVulncheckUpgradeIgnore = counter.New("gopls/vulncheck-prompt/upgrade:no")
58 )