Documentation ¶
Index ¶
- Constants
- Variables
- func NewCommand() *cobra.Command
- func NewRemoteAnalytics(appName string, options ...Option) (*remoteAnalytics, error)
- func SetOpt(c Opt) error
- type Analytics
- type CountEvent
- type HTTPClient
- type Logger
- type MemoryAnalytics
- func (a *MemoryAnalytics) Count(name string, tags map[string]string, n int)
- func (a *MemoryAnalytics) Flush(timeout time.Duration)
- func (a *MemoryAnalytics) GlobalTag(name string) (string, bool)
- func (a *MemoryAnalytics) Incr(name string, tags map[string]string)
- func (a *MemoryAnalytics) Timer(name string, dur time.Duration, tags map[string]string)
- func (a *MemoryAnalytics) WithoutGlobalTags() Analytics
- type Opt
- type Option
- type TimeEvent
Constants ¶
View Source
const ( TagDuration = "duration" TagName = "name" TagUser = "user" TagMachine = "machine" )
keys for request to stats server
Variables ¶
View Source
var Choices = map[Opt]string{ OptDefault: "default", OptOut: "opt-out", OptIn: "opt-in", }
Functions ¶
func NewCommand ¶
func NewRemoteAnalytics ¶
Create a remote analytics object with Windmill-specific defaults for the HTTPClient, report URL, user ID, and opt-in status. All of these defaults can be overridden with appropriate options.
Types ¶
type Analytics ¶
type Analytics interface { Count(name string, tags map[string]string, n int) Incr(name string, tags map[string]string) Timer(name string, dur time.Duration, tags map[string]string) Flush(timeout time.Duration) GlobalTag(name string) (string, bool) // Returns a new analytics that doesn't report any of the global tags. // Useful for anonymous reporting. WithoutGlobalTags() Analytics }
type MemoryAnalytics ¶
type MemoryAnalytics struct { Counts []CountEvent Timers []TimeEvent }
func NewMemoryAnalytics ¶
func NewMemoryAnalytics() *MemoryAnalytics
func (*MemoryAnalytics) Count ¶
func (a *MemoryAnalytics) Count(name string, tags map[string]string, n int)
func (*MemoryAnalytics) Flush ¶
func (a *MemoryAnalytics) Flush(timeout time.Duration)
func (*MemoryAnalytics) WithoutGlobalTags ¶
func (a *MemoryAnalytics) WithoutGlobalTags() Analytics
type Opt ¶
type Opt int
type Option ¶
type Option func(a *remoteAnalytics)
func WithEnabled ¶
Sets whether the analytics client is enabled. Defaults to checking the users' opt-in setting in ~/.windmill
func WithGlobalTags ¶
Sets global tags for every report.
func WithHTTPClient ¶
func WithHTTPClient(client HTTPClient) Option
Sets the HTTP client. Defaults to golang http client.
func WithLogger ¶
Sets the logger where errors are printed. Defaults to printing to the default logger with the prefix "analytics ".
func WithMachineID ¶
func WithReportURL ¶
Sets the URL to report to. Defaults to https://events.windmill.build/report
func WithUserID ¶
Sets the UserID. Defaults to a user ID based on a hash of a machine identifier.
Click to show internal directories.
Click to hide internal directories.