Documentation ¶
Index ¶
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 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 ¶
func NewReporter(config Config, kvConfig kv.Config, objectClient phlareobjstore.Bucket, logger log.Logger, reg prometheus.Registerer) (*Reporter, error)
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