cuelang.org/go@v0.10.1/internal/golangorgx/telemetry/types.go (about)

     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  package telemetry
     6  
     7  // Common types and directories used by multiple packages.
     8  
     9  // An UploadConfig controls what data is uploaded.
    10  type UploadConfig struct {
    11  	GOOS       []string
    12  	GOARCH     []string
    13  	GoVersion  []string
    14  	SampleRate float64
    15  	Programs   []*ProgramConfig
    16  }
    17  
    18  type ProgramConfig struct {
    19  	// the counter names may have to be
    20  	// repeated for each program. (e.g., if the counters are in a package
    21  	// that is used in more than one program.)
    22  	Name     string
    23  	Versions []string        // versions present in a counterconfig
    24  	Counters []CounterConfig `json:",omitempty"`
    25  	Stacks   []CounterConfig `json:",omitempty"`
    26  }
    27  
    28  type CounterConfig struct {
    29  	Name  string
    30  	Rate  float64 // If X <= Rate, report this counter
    31  	Depth int     `json:",omitempty"` // for stack counters
    32  }
    33  
    34  // A Report is what's uploaded (or saved locally)
    35  type Report struct {
    36  	Week     string  // first day this report covers (YYYY-MM-DD)
    37  	LastWeek string  // Week field from latest previous report uploaded
    38  	X        float64 // A random probability used to determine which counters are uploaded
    39  	Programs []*ProgramReport
    40  	Config   string // version of UploadConfig used
    41  }
    42  
    43  type ProgramReport struct {
    44  	Program   string
    45  	Version   string
    46  	GoVersion string
    47  	GOOS      string
    48  	GOARCH    string
    49  	Counters  map[string]int64
    50  	Stacks    map[string]int64
    51  }