Documentation ¶
Index ¶
- Constants
- func Capture(eventType string, providers registry.Providers, data Message, ...)
- func Close()
- func Enabled() bool
- func GetCookieId() uuid.UUID
- func HashAttribute(value string) string
- func Init(opts ...Option) error
- func IsCI() bool
- func IsFaaS() bool
- func SetGlobalProperty(k string, v interface{})
- func SetUserId(userId string)
- type Client
- type DiagnosticsSummary
- type Environment
- type Message
- type Option
- func WithApiKey(apikey string) Option
- func WithDebug() Option
- func WithDisabled() Option
- func WithInspect() Option
- func WithInstanceId(instanceId string) Option
- func WithProperties(properties map[string]interface{}) Option
- func WithTerminal(terminal bool) Option
- func WithVersionInfo(version, commit, buildDate string) Option
- type TelemetryEvent
- type VersionInfo
Constants ¶
const (
CQTeamID = "12345678-0000-0000-0000-c1a0dbeef000"
)
Variables ¶
This section is empty.
Functions ¶
func GetCookieId ¶
GetCookieId will read or generate a persistent `telemetry-random-id` file and return its value. First it will try reading ~/.cq/telemetry-random-id and use that value if found. If not, it will move on to ./cq/telemetry-random-id, first attempting a read and if not found, will create that file filling it with a newly generated ID. If a directory with the same name is encountered, process is aborted and an empty string is returned. If a new file is generated, c.newRandomId is set.
func HashAttribute ¶
HashAttribute creates a one-way hash from an attribute
func Init ¶
Init initializes the Analytics Client with options. The returned error is non-nil if options is invalid, for instance if a malformed DSN is provided.
func IsCI ¶
func IsCI() bool
IsCI determines if we're running under a CI env by checking CI-specific env vars
func IsFaaS ¶
func IsFaaS() bool
IsFaaS determines if we're running under a Lambda env by checking Lambda-specific env vars
func SetGlobalProperty ¶
func SetGlobalProperty(k string, v interface{})
Types ¶
type DiagnosticsSummary ¶
type DiagnosticsSummary struct { Total int `json:"total,omitempty"` ByType map[string]int `json:"by_type,omitempty"` BySeverity map[string]int `json:"by_severity,omitempty"` }
func SummarizeDiagnostics ¶
func SummarizeDiagnostics(diags diag.Diagnostics) DiagnosticsSummary
type Environment ¶
type Environment struct { // OS Client executing OS string `json:"os"` // Terminal is true if Client is executed inside a terminal environment Terminal bool `json:"terminal"` // CI is true if the Client is executed inside a CI i.e github actions etc' CI bool `json:"ci"` // FaaS is true if Client is executed inside a function i.e lambda etc' FaaS bool `json:"faas"` // Hashed hostname identifier Hostname string `json:"hostname"` MacAddr string `json:"mac_addr"` // BinarySource is the source of the binary BinarySource string `json:"binary_source"` // InstallationSource is the source of the installation InstallationSource string `json:"installation_source"` }
type Option ¶
type Option func(c *Client)
func WithApiKey ¶
func WithDisabled ¶
func WithDisabled() Option
func WithInspect ¶
func WithInspect() Option
func WithInstanceId ¶
func WithProperties ¶
func WithTerminal ¶
func WithVersionInfo ¶
type TelemetryEvent ¶
TelemetryEvent holds data of a telemetry event collected from a Diagnostic.
func FilterTelemetryEvents ¶
func FilterTelemetryEvents(diags diag.Diagnostics) ([]TelemetryEvent, diag.Diagnostics)
FilterTelemetryEvents splits a list of supplied Diagnostics into a list of TelemetryEvents and all other ordinary Diagnostics.
func TelemetryFromDiagnostic ¶
func TelemetryFromDiagnostic(d diag.Diagnostic) TelemetryEvent
TelemetryFromDiagnostic converts a Diagnostic to a TelemetryEvent. Be sure to pass only Diagnostics of type TELEMETRY.
func (TelemetryEvent) Properties ¶
func (e TelemetryEvent) Properties() map[string]interface{}