Documentation ¶
Index ¶
- Constants
- func ContextIDFrom(ctx context.Context) string
- func RunIDFrom(ctx context.Context) string
- func Setup()
- func Trace(ctx context.Context, label string, options ...TelemetryOption)
- func TraceError(ctx context.Context, label string, err error, options ...TelemetryOption)
- func WithContextID(ctx context.Context) context.Context
- func WithContextValue(ctx context.Context, key, value string) context.Context
- func WithRunID(ctx context.Context) context.Context
- type AvailabilityCheckFunc
- type GetTelemetryFileFunc
- type GetTelemetryFilesFunc
- type JsonLinesTelemetryClient
- type LockFunc
- type LoggingTelemetryClient
- type NoopTelemetryClient
- type TelemetryClient
- type TelemetryOption
- type TelemetryUploader
- type UnlockFunc
- type UploadFunc
- type UploadOptions
- func WithAvailabilityCheck(url string) UploadOptions
- func WithCleanUp(enabled bool) UploadOptions
- func WithDefaultAvailabilityCheck() UploadOptions
- func WithFileLock(storageLocation string) UploadOptions
- func WithGetTelemetryFile(getTelemetryFileFunc GetTelemetryFileFunc) UploadOptions
- func WithGetTelemetryFiles(getTelemetryFilesFunc GetTelemetryFilesFunc) UploadOptions
- func WithNoLock() UploadOptions
- func WithRate(rate time.Duration) UploadOptions
- func WithRemoteLogLocation(location string) UploadOptions
- func WithUploadFunction(uploadFunc UploadFunc) UploadOptions
- type UploadTraceEvent
Constants ¶
const ( TelemetryCommand string = "shuttle.command" TelemetryCommandArgs string = "shuttle.command.args" )
Variables ¶
This section is empty.
Functions ¶
func ContextIDFrom ¶
func Setup ¶
func Setup()
Initializes the telemetry setup, if not called, NoopTelemetryClient will be used
func TraceError ¶
func TraceError(ctx context.Context, label string, err error, options ...TelemetryOption)
func WithContextValue ¶
Types ¶
type AvailabilityCheckFunc ¶
AvailabilityCheckFunc gets whether the telemetry uploader is available for upload
type GetTelemetryFileFunc ¶
type GetTelemetryFileFunc = func(ctx context.Context, telemetryFilePath string) ([]UploadTraceEvent, func(ctx context.Context) error, error)
GetTelemetryFileFunc reads the trace event files and returns a set of tracevents and the option to delete the file after upload is finished
type GetTelemetryFilesFunc ¶
GetTelemetryFilesFunc fetches trace event file name from a certain location. Each read is delegated to GetTelemetryFileFunc
type LockFunc ¶
type LockFunc = func(ctx context.Context) (UnlockFunc, bool, error)
LockFunc makes sure only a single upload process is run pr storage location
type LoggingTelemetryClient ¶
type LoggingTelemetryClient struct {
// contains filtered or unexported fields
}
type NoopTelemetryClient ¶
type NoopTelemetryClient struct{}
type TelemetryClient ¶
type TelemetryOption ¶
func WithEntry ¶
func WithEntry(key, value string) TelemetryOption
func WithGoInfo ¶
func WithGoInfo() TelemetryOption
func WithLabel ¶
func WithLabel(label string) TelemetryOption
func WithPhase ¶
func WithPhase(phase string) TelemetryOption
type TelemetryUploader ¶
type TelemetryUploader struct {
// contains filtered or unexported fields
}
func NewTelemetryUploader ¶
func NewTelemetryUploader(url string, options ...UploadOptions) *TelemetryUploader
type UnlockFunc ¶
UnluckFunc clears the locks set for the storage location
type UploadFunc ¶
type UploadFunc = func(ctx context.Context, url string, event []UploadTraceEvent) error
UploadFunc handles upload for a set of trace events
type UploadOptions ¶
type UploadOptions = func(*TelemetryUploader)
func WithAvailabilityCheck ¶
func WithAvailabilityCheck(url string) UploadOptions
WithAvailabilityCheck adds a check for the upload location, this is useful if there are scenarios where the upload process shouldn't be run. I.e. you're not on a vpn, or on a slow internet connection
func WithCleanUp ¶
func WithCleanUp(enabled bool) UploadOptions
WithCleanUp determines whether to remove telemetry files after they've been read. There are no consistency guarantees that no duplicates will be uploaded on error if run, or dropped traces
func WithDefaultAvailabilityCheck ¶
func WithDefaultAvailabilityCheck() UploadOptions
WithDefaultAvailabilityCheck sets a Noop availability check
func WithFileLock ¶
func WithFileLock(storageLocation string) UploadOptions
WithFileLock this adds a file lock at a certain location, this is useful if there may be concurrent/parallel processes on the same storage location
func WithGetTelemetryFile ¶
func WithGetTelemetryFile(getTelemetryFileFunc GetTelemetryFileFunc) UploadOptions
WithGetTelemetryFile sets the get telemetry file func
func WithGetTelemetryFiles ¶
func WithGetTelemetryFiles(getTelemetryFilesFunc GetTelemetryFilesFunc) UploadOptions
WithGetTelemetryFiles sets the get telemetry files
func WithRate ¶
func WithRate(rate time.Duration) UploadOptions
WithRate sets the current rate of which events will be uploaded
func WithRemoteLogLocation ¶
func WithRemoteLogLocation(location string) UploadOptions
WithRemoteLogLocation sets where shuttle telemetry files are located
func WithUploadFunction ¶
func WithUploadFunction(uploadFunc UploadFunc) UploadOptions
WithUploadFunction sets the upload function to something custom