usagestats

package
v0.0.0-...-f43c62e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EditionOSS        = "oss"
	EditionEnterprise = "enterprise"
)
View Source
const (
	// ClusterSeedFileName is the file name for the cluster seed file.
	ClusterSeedFileName = "mimir_cluster_seed.json"
)
View Source
const (
	// DefaultReportSendInterval is the interval at which anonymous usage statistics are reported.
	DefaultReportSendInterval = 4 * time.Hour
)

Variables

This section is empty.

Functions

func GetAndResetInt

func GetAndResetInt(name string) *expvar.Int

GetAndResetInt calls GetInt and then reset it to 0.

func GetInt

func GetInt(name string) *expvar.Int

GetInt returns a new Int stats object for the given name. It creates the stats object if it doesn't exist yet.

func GetString

func GetString(name string) *expvar.String

GetString returns the String stats object for the given name. It creates the stats object if it doesn't exist yet.

func SetEdition

func SetEdition(edition string)

SetEdition sets the edition name.

func SetTarget

func SetTarget(target string)

SetTarget sets the target name.

Types

type ClusterSeed

type ClusterSeed struct {
	// UID is the unique cluster ID.
	UID string `json:"UID"`

	// CreatedAt is the timestamp when the seed file was created.
	CreatedAt time.Time `json:"created_at"`
}

ClusterSeed is the seed for the usage stats.

type Config

type Config struct {
	Enabled          bool   `yaml:"enabled"`
	InstallationMode string `yaml:"installation_mode"`
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*Config) Validate

func (cfg *Config) Validate() error

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func GetAndResetCounter

func GetAndResetCounter(name string) *Counter

GetAndResetCounter calls GetCounter and then reset it to 0.

func GetCounter

func GetCounter(name string) *Counter

GetCounter returns a new Counter stats object for the given name. It creates the stats object if it doesn't exist yet.

func (*Counter) Inc

func (c *Counter) Inc(i int64)

func (*Counter) String

func (c *Counter) String() string

func (*Counter) Total

func (c *Counter) Total() int64

func (*Counter) Value

func (c *Counter) Value() map[string]interface{}

type Report

type Report struct {
	// ClusterID is the unique Mimir cluster ID.
	ClusterID string `json:"clusterID"`

	// CreatedAt is when the cluster was created.
	CreatedAt time.Time `json:"createdAt"`

	// Interval is when the report was created (value is aligned across all replicas of the same Mimir cluster).
	Interval time.Time `json:"interval"`

	// IntervalPeriod is how frequently the report is sent, in seconds.
	IntervalPeriod float64 `json:"intervalPeriod"`

	// Target used to run Mimir.
	Target string `json:"target"`

	// Version holds information about the Mimir version.
	Version prom.PrometheusVersion `json:"version"`

	// Os is the operating system where Mimir is running.
	Os string `json:"os"`

	// Arch is the architecture where Mimir is running.
	Arch string `json:"arch"`

	// Edition is the Mimir edition ("oss" or "enterprise").
	Edition string `json:"edition"`

	// Metrics holds custom metrics tracked by Mimir. Can contain nested objects.
	Metrics map[string]interface{} `json:"metrics"`
}

Report is the JSON object sent to the stats server

type Reporter

type Reporter struct {
	services.Service
	// contains filtered or unexported fields
}

func NewReporter

func NewReporter(bucketClient objstore.InstrumentedBucket, logger log.Logger, reg prometheus.Registerer) *Reporter

type RequestsMiddleware

type RequestsMiddleware struct {
	// contains filtered or unexported fields
}

RequestsMiddleware tracks the number of requests.

func NewRequestsMiddleware

func NewRequestsMiddleware(name string) *RequestsMiddleware

NewRequestsMiddleware makes a new RequestsMiddleware.

func (*RequestsMiddleware) Wrap

func (m *RequestsMiddleware) Wrap(next http.Handler) http.Handler

Wrap implements middleware.Interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL