analytics

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoNotTrack

func DoNotTrack() bool

func WithContext

func WithContext(ctx context.Context, t Tracker) context.Context

Types

type CloudTracker

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

func (*CloudTracker) Capture

func (t *CloudTracker) Capture(ctx context.Context, event string, properties map[string]string)

func (*CloudTracker) Close

func (t *CloudTracker) Close() error

type Config

type Config struct {
	DoNotTrack bool
	Labels     telemetry.Labels
	CloudToken string
}

func DefaultConfig

func DefaultConfig(labels telemetry.Labels) Config

type Event

type Event struct {
	Timestamp  time.Time         `json:"ts,omitempty"`
	Type       string            `json:"type,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`

	DeviceID  string `json:"device_id,omitempty"`
	SessionID string `json:"session_id,omitempty"`

	ClientVersion string `json:"client_version,omitempty"`
	ClientOS      string `json:"client_os,omitempty"`
	ClientArch    string `json:"client_arch,omitempty"`

	CI       bool   `json:"ci"`
	CIVendor string `json:"ci_vendor,omitempty"`

	GitRemoteEncoded string `json:"git_remote_encoded,omitempty"`
	GitAuthorHashed  string `json:"git_author_hashed,omitempty"`
}

type Tracker

type Tracker interface {
	Capture(ctx context.Context, event string, properties map[string]string)
	io.Closer
}

func Ctx

func Ctx(ctx context.Context) Tracker

func New

func New(cfg Config) Tracker

Jump to

Keyboard shortcuts

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