Debian Codegraph @

debian/go/src/golang.org/x/telemetry/internal/chartconfig/chartconfig.go

raw symbols SCIP
1 // Copyright 2023 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 // The chartconfig package defines the ChartConfig type, representing telemetry
6 // chart configuration, as well as utilities for parsing and validating this
7 // configuration.
8 //
9 // Chart configuration defines the set of aggregations active on the telemetry
10 // server, and are used to derive which data needs to be uploaded by users.
11 // See the original blog post for more details:
12 //
13 // https://research.swtch.com/telemetry-design#configuration
14 //
15 // The record format defined in this package differs slightly from that of the
16 // blog post. This format is still experimental, and subject to change.
17 //
18 // Configuration records consist of fields, comments, and whitespace. A field
19 // is defined by a line starting with a valid key, followed immediately by ":",
20 // and then a textual value, which cannot include the comment separator '#'.
21 //
22 // Comments start with '#', and extend to the end of the line.
23 //
24 // The following keys are supported. Any entry not marked as (optional) must be
25 // provided.
26 //
27 // - title: the chart title.
28 // - description: (optional) a longer description of the chart.
29 // - issue: a go issue tracker URL proposing the chart configuration.
30 // Multiple issues may be provided by including additional 'issue:' lines.
31 // All proposals must be in the 'accepted' state.
32 // - type: the chart type: currently only partition, histogram, and stack are
33 // supported.
34 // - program: the package path of the program for which this chart applies.
35 // - version: (optional) the first version for which this chart applies. Must
36 // be a valid semver value.
37 // - counter: the primary counter this chart illustrates, including buckets
38 // for histogram and partition charts.
39 // - depth: (optional) stack counters only; the maximum stack depth to collect
40 // - error: (optional) the desired error rate for this chart, which
41 // determines collection rate
42 //
43 // Multiple records are separated by "---" lines.
44 //
45 // For example:
46 //
47 // # This config defines an ordinary counter.
48 // counter: gopls/editor:{emacs,vim,vscode,other} # TODO(golang/go#34567): add more editors
49 // title: Editor Distribution
50 // description: measure editor distribution for gopls users.
51 // type: partition
52 // issue: https://go.dev/issue/12345
53 // program: golang.org/x/tools/gopls
54 // version: v1.0.0
55 // version: [v2.0.0, v2.3.4]
56 // version: [v3.0.0, ]
57 //
58 // ---
59 //
60 // # This config defines a stack counter.
61 // counter: gopls/bug
62 // title: Gopls bug reports.
63 // description: Stacks of bugs encountered on the gopls server.
64 // issue: https://go.dev/12345
65 // issue: https://go.dev/23456 # increase stack depth
66 // type: stack
67 // program: golang.org/x/tools/gopls
68 // depth: 10
69 package chartconfig
70
71 // A ChartConfig defines the configuration for a single chart/collection on the
72 // telemetry server.
73 //
74 // See the package documentation for field definitions.
75 type ChartConfig struct {
76 Title string
77 Description string
78 Issue []string
79 Type string
80 Program string
81 Counter string
82 Depth int
83 Error float64 // TODO(rfindley) is Error still useful?
84 Version string
85 }