telemetry

package
v2.77.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TracesURL    = "https://telemetry.werf.io/v1/traces"
	TelemetryEnv = "WERF_TELEMETRY"
)

Variables

This section is empty.

Functions

func GetTraceUrl

func GetTraceUrl() string

func Init

func Init(ctx context.Context, opts TelemetryOptions) error

func IsEnabled

func IsEnabled() bool

func LogF

func LogF(f string, args ...interface{})

func NewTraceExporter

func NewTraceExporter(url string) (*otlptrace.Exporter, error)

func Shutdown

func Shutdown(ctx context.Context) error

Types

type BuildFinished added in v2.58.0

type BuildFinished struct {
	DurationMs  int64 `json:"durationMs"`
	Success     bool  `json:"success"`
	ImagesCount int   `json:"imagesCount"`
}

func NewBuildFinished added in v2.58.0

func NewBuildFinished(durationMs int64, success bool, imagesCount int) *BuildFinished

func (*BuildFinished) GetType added in v2.58.0

func (*BuildFinished) GetType() EventType

type BuildStarted added in v2.58.0

type BuildStarted struct {
	ImagesCount      int    `json:"imagesCount"`
	ContainerBackend string `json:"containerBackend"`
	InContainer      bool   `json:"inContainer"`
}

func NewBuildStarted added in v2.58.0

func NewBuildStarted(imagesCount int, containerBackend string, inContainer bool) *BuildStarted

func (*BuildStarted) GetType added in v2.58.0

func (*BuildStarted) GetType() EventType

type CommandExited

type CommandExited struct {
	ExitCode   int   `json:"exitCode"`
	DurationMs int64 `json:"durationMs"`
}

func NewCommandExited

func NewCommandExited(exitCode int, durationMs int64) *CommandExited

func (*CommandExited) GetType

func (e *CommandExited) GetType() EventType

type CommandOption

type CommandOption struct {
	Name  string `json:"name"`
	AsCli bool   `json:"asCli"`
	AsEnv bool   `json:"asEnv"`
	Count int    `json:"count"`
}

type CommandStarted

type CommandStarted struct {
	CommandOptions []CommandOption `json:"commandOptions,omitempty"`
}

func NewCommandStarted

func NewCommandStarted(commandOptions []CommandOption) *CommandStarted

func (*CommandStarted) GetType

func (e *CommandStarted) GetType() EventType

type Event

type Event interface {
	GetType() EventType
}

type EventType

type EventType string
const (
	CommandStartedEvent     EventType = "CommandStarted"
	CommandExitedEvent      EventType = "CommandExited"
	UnshallowFailedEvent    EventType = "UnshallowFailed"
	BuildStartedEvent       EventType = "BuildStarted"
	BuildFinishedEvent      EventType = "BuildFinished"
	ImageBuildFinishedEvent EventType = "ImageBuildFinished"
	StageBuildFinishedEvent EventType = "StageBuildFinished"
)

type ImageBuildFinished added in v2.58.0

type ImageBuildFinished struct {
	Image      string `json:"image"`
	DurationMs int64  `json:"durationMs"`
	Rebuilt    bool   `json:"rebuilt"`
	ConfigType string `json:"configType,omitempty"`
}

func NewImageBuildFinished added in v2.58.0

func NewImageBuildFinished(image string, durationMs int64, rebuilt bool) *ImageBuildFinished

func (*ImageBuildFinished) GetType added in v2.58.0

func (*ImageBuildFinished) GetType() EventType

type NoTelemetryWerfIO

type NoTelemetryWerfIO struct{}

func (*NoTelemetryWerfIO) BuildFinished added in v2.58.0

func (t *NoTelemetryWerfIO) BuildFinished(context.Context, bool)

func (*NoTelemetryWerfIO) BuildStarted added in v2.58.0

func (t *NoTelemetryWerfIO) BuildStarted(context.Context, int, string, bool)

func (*NoTelemetryWerfIO) CommandExited

func (t *NoTelemetryWerfIO) CommandExited(context.Context, int)

func (*NoTelemetryWerfIO) CommandStarted

func (t *NoTelemetryWerfIO) CommandStarted(context.Context)

func (*NoTelemetryWerfIO) ImageBuildFinished added in v2.58.0

func (t *NoTelemetryWerfIO) ImageBuildFinished(context.Context, string, int64, bool, string)

func (*NoTelemetryWerfIO) SetCommand

func (t *NoTelemetryWerfIO) SetCommand(context.Context, string)

func (*NoTelemetryWerfIO) SetCommandOptions

func (t *NoTelemetryWerfIO) SetCommandOptions(context.Context, []CommandOption)

func (*NoTelemetryWerfIO) SetProjectID

func (t *NoTelemetryWerfIO) SetProjectID(context.Context, string)

func (*NoTelemetryWerfIO) SetUserID

func (t *NoTelemetryWerfIO) SetUserID(context.Context, string)

func (*NoTelemetryWerfIO) StageBuildFinished added in v2.58.0

func (t *NoTelemetryWerfIO) StageBuildFinished(context.Context, string, string, int64, bool, string, bool)

func (*NoTelemetryWerfIO) UnshallowFailed

func (t *NoTelemetryWerfIO) UnshallowFailed(context.Context, error)

type StageBuildFinished added in v2.58.0

type StageBuildFinished struct {
	Image           string `json:"image"`
	Stage           string `json:"stage"`
	DurationMs      int64  `json:"durationMs"`
	FromCache       bool   `json:"fromCache"`
	BaseImageSource string `json:"baseImageSource"`
	BaseImagePulled bool   `json:"baseImagePulled"`
}

func NewStageBuildFinished added in v2.58.0

func NewStageBuildFinished(image, stage string, durationMs int64, fromCache bool) *StageBuildFinished

func (*StageBuildFinished) GetType added in v2.58.0

func (*StageBuildFinished) GetType() EventType

type TelemetryOptions

type TelemetryOptions struct {
	ErrorHandlerFunc func(err error)
}

type TelemetryWerfIO

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

func NewTelemetryWerfIO

func NewTelemetryWerfIO(url string, opts TelemetryWerfIOOptions) (*TelemetryWerfIO, error)

func (*TelemetryWerfIO) BuildFinished added in v2.58.0

func (t *TelemetryWerfIO) BuildFinished(ctx context.Context, success bool)

func (*TelemetryWerfIO) BuildStarted added in v2.58.0

func (t *TelemetryWerfIO) BuildStarted(ctx context.Context, imagesCount int, containerBackend string, inContainer bool)

func (*TelemetryWerfIO) CommandExited

func (t *TelemetryWerfIO) CommandExited(ctx context.Context, exitCode int)

func (*TelemetryWerfIO) CommandStarted

func (t *TelemetryWerfIO) CommandStarted(ctx context.Context)

func (*TelemetryWerfIO) ImageBuildFinished added in v2.58.0

func (t *TelemetryWerfIO) ImageBuildFinished(ctx context.Context, image string, durationMs int64, rebuilt bool, configType string)

func (*TelemetryWerfIO) SetCommand

func (t *TelemetryWerfIO) SetCommand(ctx context.Context, command string)

func (*TelemetryWerfIO) SetCommandOptions

func (t *TelemetryWerfIO) SetCommandOptions(ctx context.Context, options []CommandOption)

func (*TelemetryWerfIO) SetProjectID

func (t *TelemetryWerfIO) SetProjectID(ctx context.Context, projectID string)

func (*TelemetryWerfIO) SetUserID

func (t *TelemetryWerfIO) SetUserID(_ context.Context, userID string)

func (*TelemetryWerfIO) Shutdown

func (t *TelemetryWerfIO) Shutdown(ctx context.Context) error

func (*TelemetryWerfIO) StageBuildFinished added in v2.58.0

func (t *TelemetryWerfIO) StageBuildFinished(ctx context.Context, image, stage string, durationMs int64, fromCache bool, baseImageSource string, baseImagePulled bool)

func (*TelemetryWerfIO) Start

func (t *TelemetryWerfIO) Start(ctx context.Context) error

func (*TelemetryWerfIO) UnshallowFailed

func (t *TelemetryWerfIO) UnshallowFailed(ctx context.Context, err error)

type TelemetryWerfIOInterface

type TelemetryWerfIOInterface interface {
	SetUserID(ctx context.Context, projectID string)
	SetProjectID(ctx context.Context, projectID string)
	SetCommand(ctx context.Context, command string)
	SetCommandOptions(ctx context.Context, options []CommandOption)

	CommandStarted(ctx context.Context)
	CommandExited(ctx context.Context, exitCode int)
	UnshallowFailed(ctx context.Context, err error)

	BuildStarted(ctx context.Context, imagesCount int, containerBackend string, inContainer bool)
	BuildFinished(ctx context.Context, success bool)
	ImageBuildFinished(ctx context.Context, image string, durationMs int64, rebuilt bool, configType string)
	StageBuildFinished(ctx context.Context, image, stage string, durationMs int64, fromCache bool, baseImageSource string, baseImagePulled bool)
}

func GetTelemetryWerfIO

func GetTelemetryWerfIO() TelemetryWerfIOInterface

type TelemetryWerfIOOptions

type TelemetryWerfIOOptions struct {
	HandleErrorFunc func(err error)
}

type UnshallowFailed

type UnshallowFailed struct {
	ErrorMessage        string `json:"errorMessage"`
	GitlabRunnerVersion string `json:"gitlabRunnerVersion"`
	GitlabServerVersion string `json:"gitlabServerVersion"`
}

func NewUnshallowFailed

func NewUnshallowFailed(errorMessage string) *UnshallowFailed

func (*UnshallowFailed) GetType

func (*UnshallowFailed) GetType() EventType

Jump to

Keyboard shortcuts

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