analytics

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 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 IsInternal

func IsInternal(ctx context.Context) bool

IsInternal returns whether the internal flag is set in the context.

func WithContext

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

func WithInternal

func WithInternal(ctx context.Context) context.Context

Internal returns a new context with the internal flag set.

This is used for analytics so that we can distinguish between calls made by an end user and calls made within the engine, for example to SDK modules.

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     pipeline.Labels
	CloudToken string
}

func DefaultConfig

func DefaultConfig() 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"`
	ServerID string `json:"server_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