Documentation ¶
Index ¶
- Constants
- Variables
- func Edition(edition string)
- func NewFloat(name string) *expvar.Float
- func NewInt(name string) *expvar.Int
- func NewString(name string) *expvar.String
- func Target(target string)
- type ClusterSeed
- type Config
- type Counter
- type MultiCounter
- type MultiStatistics
- type Report
- type Reporter
- type Statistics
- type WordCounter
Constants ¶
const (
// File name for the cluster seed file.
ClusterSeedFileName = "pyroscope_cluster_seed.json"
)
Variables ¶
var JSONCodec = jsonCodec{}
Functions ¶
func Edition ¶
func Edition(edition string)
Edition sets the edition name. This can be set multiple times.
func NewFloat ¶
NewFloat returns a new Float stats object. If a Float stats object with the same name already exists it is returned.
func NewInt ¶
NewInt returns a new Int stats object. If an Int stats object object with the same name already exists it is returned.
Types ¶
type ClusterSeed ¶
type ClusterSeed struct { UID string `json:"UID"` CreatedAt time.Time `json:"created_at"` prom.PrometheusVersion `json:"version"` }
ClusterSeed is the seed for the usage stats. A unique ID is generated for each cluster.
func (*ClusterSeed) Clone ¶
func (c *ClusterSeed) Clone() memberlist.Mergeable
func (*ClusterSeed) Merge ¶
func (c *ClusterSeed) Merge(mergeable memberlist.Mergeable, localCAS bool) (change memberlist.Mergeable, error error)
Merge implements the memberlist.Mergeable interface. It allow to merge the content of two different seeds.
func (*ClusterSeed) MergeContent ¶
func (c *ClusterSeed) MergeContent() []string
MergeContent tells if the content of the two seeds are the same.
func (*ClusterSeed) RemoveTombstones ¶
func (c *ClusterSeed) RemoveTombstones(limit time.Time) (total, removed int)
RemoveTombstones is not required for usagestats
type Config ¶
func (*Config) RegisterFlags ¶
RegisterFlags adds the flags required to config this to the given FlagSet
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
NewCounter returns a new Counter stats object. If a Counter stats object with the same name already exists it is returned.
type MultiCounter ¶ added in v1.2.0
type MultiCounter struct {
// contains filtered or unexported fields
}
func NewMultiCounter ¶ added in v1.2.0
func NewMultiCounter(name string, keyName string) *MultiCounter
NewMultiCounter returns a new MultiCounter stats object. If a NewMultiCounter stats object with the same name already exists it is returned.
func (*MultiCounter) Inc ¶ added in v1.2.0
func (c *MultiCounter) Inc(i int64, keyValue string)
func (*MultiCounter) String ¶ added in v1.2.0
func (c *MultiCounter) String() string
func (*MultiCounter) Value ¶ added in v1.2.0
func (c *MultiCounter) Value() map[string]interface{}
type MultiStatistics ¶ added in v1.2.0
type MultiStatistics struct {
// contains filtered or unexported fields
}
func NewMultiStatistics ¶ added in v1.2.0
func NewMultiStatistics(name string, keyName string) *MultiStatistics
NewMultiStatistics returns a new MultiStatistics object. MultiStatistics object is thread-safe and computes statistics on the fly based on recorded samples. Available statistics are: - min - max - avg - count - stddev - stdvar If a MultiStatistics object with the same name already exists it is returned.
func (*MultiStatistics) Record ¶ added in v1.2.0
func (s *MultiStatistics) Record(v float64, key string)
func (*MultiStatistics) String ¶ added in v1.2.0
func (s *MultiStatistics) String() string
func (*MultiStatistics) Value ¶ added in v1.2.0
func (s *MultiStatistics) Value() map[string]interface{}
type Report ¶
type Report struct { ClusterID string `json:"clusterID"` CreatedAt time.Time `json:"createdAt"` Interval time.Time `json:"interval"` IntervalPeriod float64 `json:"intervalPeriod"` Target string `json:"target"` prom.PrometheusVersion `json:"version"` Os string `json:"os"` Arch string `json:"arch"` Edition string `json:"edition"` Metrics map[string]interface{} `json:"metrics"` }
Report is the JSON object sent to the stats server
type Reporter ¶
func NewReporter ¶
type Statistics ¶
type Statistics struct {
// contains filtered or unexported fields
}
func NewStatistics ¶
func NewStatistics(name string) *Statistics
NewStatistics returns a new Statistics object. Statistics object is thread-safe and compute statistics on the fly based on sample recorded. Available statistics are: - min - max - avg - count - stddev - stdvar If a Statistics object with the same name already exists it is returned.
func (*Statistics) Record ¶
func (s *Statistics) Record(v float64)
func (*Statistics) String ¶
func (s *Statistics) String() string
func (*Statistics) Value ¶
func (s *Statistics) Value() map[string]interface{}
type WordCounter ¶
type WordCounter struct {
// contains filtered or unexported fields
}
func NewWordCounter ¶
func NewWordCounter(name string) *WordCounter
NewWordCounter returns a new WordCounter stats object. The WordCounter object is thread-safe and counts the number of words recorded. If a WordCounter stats object with the same name already exists it is returned.
func (*WordCounter) Add ¶
func (w *WordCounter) Add(word string)
func (*WordCounter) String ¶
func (w *WordCounter) String() string
func (*WordCounter) Value ¶
func (w *WordCounter) Value() int64