Documentation
¶
Index ¶
- Constants
- Variables
- func CheckFilenameMD5(data []byte, path, ext string) bool
- func Filename(data []byte, ext string) string
- func MachineID(appName string) string
- func NewContextForEvent(ctx context.Context, evt *Event) context.Context
- func SetGlobal(c *Collector)
- type Attribute
- type Codec
- type Collector
- type CollectorOption
- func WithAppName(name string) CollectorOption
- func WithAppVersion(version string) CollectorOption
- func WithBackoff(initial, max time.Duration) CollectorOption
- func WithDisabled(f func() bool) CollectorOption
- func WithDistinctID(id string) CollectorOption
- func WithMaxBatch(n int) CollectorOption
- func WithPlatform(platform string) CollectorOption
- type Counter
- type Emitter
- type Event
- type EventMetric
- type EventRecord
- type FileEmitter
- type FileEmitterOption
- type FileFlusher
- type FileFlusherOption
- type JSONCodec
- type LogEventsRequest
- type Metric
- type NullEmitter
- type Timer
Constants ¶
View Source
const DefaultFileExt = ".evtq"
View Source
const DefaultLockFilename = "eventkit.lock"
Variables ¶
View Source
var NowFunc = time.Now
Functions ¶
func CheckFilenameMD5 ¶
Types ¶
type Codec ¶
type Codec interface {
Marshal(*LogEventsRequest) ([]byte, error)
Unmarshal([]byte, *LogEventsRequest) error
}
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func NewCollector(emitter Emitter, opts ...CollectorOption) *Collector
func (*Collector) CloseEventAndAdd ¶
type CollectorOption ¶
type CollectorOption func(*collectorConfig)
func WithAppName ¶
func WithAppName(name string) CollectorOption
func WithAppVersion ¶
func WithAppVersion(version string) CollectorOption
func WithBackoff ¶
func WithBackoff(initial, max time.Duration) CollectorOption
func WithDisabled ¶
func WithDisabled(f func() bool) CollectorOption
func WithDistinctID ¶
func WithDistinctID(id string) CollectorOption
func WithMaxBatch ¶
func WithMaxBatch(n int) CollectorOption
func WithPlatform ¶
func WithPlatform(platform string) CollectorOption
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func GetEventFromContext ¶
func (*Event) AddMetric ¶
func (e *Event) AddMetric(m EventMetric)
func (*Event) SetAttribute ¶
type EventMetric ¶
type EventMetric interface {
Serialize() Metric
}
type EventRecord ¶
type FileEmitter ¶
type FileEmitter struct {
// contains filtered or unexported fields
}
func NewFileEmitter ¶
func NewFileEmitter(dir string, opts ...FileEmitterOption) (*FileEmitter, error)
func (*FileEmitter) Send ¶
func (f *FileEmitter) Send(_ context.Context, req *LogEventsRequest) error
type FileEmitterOption ¶
type FileEmitterOption func(*FileEmitter)
func WithFileCodec ¶
func WithFileCodec(c Codec) FileEmitterOption
func WithFileExtension ¶
func WithFileExtension(ext string) FileEmitterOption
type FileFlusher ¶
type FileFlusher struct {
// contains filtered or unexported fields
}
func NewFileFlusher ¶
func NewFileFlusher(dir string, target Emitter, opts ...FileFlusherOption) *FileFlusher
type FileFlusherOption ¶
type FileFlusherOption func(*FileFlusher)
func WithFlusherFileCodec ¶
func WithFlusherFileCodec(c Codec) FileFlusherOption
func WithFlusherFileExtension ¶
func WithFlusherFileExtension(ext string) FileFlusherOption
func WithFlusherLockFilename ¶
func WithFlusherLockFilename(name string) FileFlusherOption
type LogEventsRequest ¶
type LogEventsRequest struct {
DistinctID string `json:"distinct_id"`
AppName string `json:"app_name"`
AppVersion string `json:"app_version"`
Platform string `json:"platform"`
Events []EventRecord `json:"events"`
}
type NullEmitter ¶
type NullEmitter struct{}
func (NullEmitter) Send ¶
func (NullEmitter) Send(context.Context, *LogEventsRequest) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.