telemetry

package
v0.124.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 5
)

Variables

This section is empty.

Functions

func CobraFullCommandPathMetricName

func CobraFullCommandPathMetricName(cmd *cobra.Command) string

func DurationMetricSuffix

func DurationMetricSuffix(cmdName string) string

func UsageMetricSuffix

func UsageMetricSuffix(cmdName string) string

Types

type Client

type Client interface {
	Send(metrics []Metric) error
}

func NewClient

func NewClient(address string, clientInfo MetricClientInfo, opts ...ClientOption) Client

type ClientOption

type ClientOption func(*client)

func WithDebug

func WithDebug(debug bool) ClientOption

func WithLogger

func WithLogger(logger *zap.Logger) ClientOption

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

type DurationMetric

type DurationMetric func() Metric

func NewDurationMetric

func NewDurationMetric(name string) DurationMetric

NewDurationMetric starts a duration metric. The duration will be stop when PrepareBatch is called.

type GraphQLError

type GraphQLError struct {
	Message string `json:"message"`
}

type GraphQLResponse

type GraphQLResponse struct {
	Data   interface{} `json:"data"`
	Errors []GraphQLError
}

type Metric

type Metric struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

func NewUsageMetric

func NewUsageMetric(name string) Metric

NewUsageMetric creates a simple metric. The value will be 1.

type MetricClientInfo

type MetricClientInfo struct {
	OsName           string `json:"osName,omitempty"`
	CpuCount         int    `json:"cpuCount,omitempty"`
	IsCI             bool   `json:"isCI"`
	WunderctlVersion string `json:"wunderctlVersion,omitempty"`
	AnonymousID      string `json:"anonymousID,omitempty"`
}

type MetricRequest

type MetricRequest struct {
	Metrics    []Metric         `json:"metrics"`
	ClientInfo MetricClientInfo `json:"clientInfo"`
}

Jump to

Keyboard shortcuts

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