metrics

package
v0.2.48 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Enabled = true
)
View Source
var IsUsingGPU bool

Functions

func FlushMetrics added in v0.1.116

func FlushMetrics(ctx context.Context) error

Spawns a forked `flyctl metrics send` process that sends metrics to the flyctl-metrics server

func FlushPending

func FlushPending()

func GetMetricsToken added in v0.1.116

func GetMetricsToken(parentCtx context.Context) (token string, err error)

func IsFlushMetricsDisabled added in v0.1.117

func IsFlushMetricsDisabled(ctx context.Context) bool

IsFlushMetricsDisabled returns true if FlushMetrics should not be called after a command completes.

func LaunchStatus added in v0.2.24

func LaunchStatus(ctx context.Context, metricSlug string, payload LaunchStatusPayload)

func RecordCommandContext added in v0.0.550

func RecordCommandContext(ctx context.Context)

func RecordCommandFinish added in v0.0.550

func RecordCommandFinish(cmd *cobra.Command, failed bool)

func Send

func Send[T any](ctx context.Context, metricSlug string, value T)

func SendJson

func SendJson(ctx context.Context, metricSlug string, payload json.RawMessage)

func SendMetrics added in v0.1.117

func SendMetrics(ctx context.Context, json string) error

/ Spens up to 15 seconds sending all metrics collected so far to flyctl-metrics post endpoint

func SendNoData

func SendNoData(ctx context.Context, metricSlug string)

func StartTiming

func StartTiming(ctx context.Context, metricSlug string) func()

func Started

func Started(ctx context.Context, metricSlug string)

func Status

func Status(ctx context.Context, metricSlug string, success bool)

func WithDisableFlushMetrics added in v0.1.117

func WithDisableFlushMetrics(ctx context.Context) context.Context

WithDisableFlushMetrics returns a context with a flag that disables FlushMetrics call after a command completes.

Types

type LaunchStatusPayload added in v0.2.24

type LaunchStatusPayload struct {
	TraceID  string        `json:"traceId"`
	Error    string        `json:"error"`
	Duration time.Duration `json:"duration"`

	AppName          string `json:"app"`
	OrgSlug          string `json:"org"`
	Region           string `json:"region"`
	HighAvailability bool   `json:"ha"`

	VM struct {
		Size     string `json:"size"`
		Memory   string `json:"memory"`
		ProcessN int    `json:"processCount"`
	} `json:"vm"`

	HasPostgres bool `json:"hasPostgres"`
	HasRedis    bool `json:"hasRedis"`
	HasSentry   bool `json:"hasSentry"`

	ScannerFamily string `json:"scanner_family"`
	FlyctlVersion string `json:"flyctlVersion"`
}

Jump to

Keyboard shortcuts

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