analytics

package
v1.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIKey contains the API key for external analytics service. It is set during application build.
	APIKey string = ""
)

Functions

func InjectAnalyticsReporting

func InjectAnalyticsReporting(in cobra.Command, cmdName string) *cobra.Command

InjectAnalyticsReporting injects analytics reporting into the command.

Types

type NoopReporter

type NoopReporter struct{}

NoopReporter is a no-op implementation of the Reporter interface.

func (*NoopReporter) Close

func (r *NoopReporter) Close()

Close closes the reporter.

func (*NoopReporter) ReportCommand

func (r *NoopReporter) ReportCommand(cmd string) error

ReportCommand reports a command to the analytics service.

func (*NoopReporter) ReportError

func (r *NoopReporter) ReportError(err error, cmd string) error

ReportError reports an error to the analytics service.

type Reporter

type Reporter interface {
	ReportCommand(cmd string) error
	ReportError(err error, cmd string) error
	Close()
}

Reporter defines behavior for reporting analytics.

func GetReporter

func GetReporter(cmd cobra.Command) Reporter

NewReporter creates a new Reporter instance.

func NewSegmentReporter

func NewSegmentReporter(apiKey string) (Reporter, error)

NewSegmentReporter creates a new SegmentReporter instance.

type SegmentReporter

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

SegmentReporter is a Segment implementation of the Reporter interface.

func (*SegmentReporter) Close

func (r *SegmentReporter) Close()

Close closes the reporter.

func (*SegmentReporter) ReportCommand

func (r *SegmentReporter) ReportCommand(cmd string) error

ReportCommand reports a command to the analytics service.

func (*SegmentReporter) ReportError

func (r *SegmentReporter) ReportError(in error, cmd string) error

ReportError reports an error to the analytics service.

Jump to

Keyboard shortcuts

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