Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // SegmentIO ErrSegmentIOUsernameEmpty = errors.New("username is empty") ErrSegmentIOEmailEmpty = errors.New("email is empty") ErrSegmentIOEventEmpty = errors.New("event is empty") ErrSendgridBodyEmpty = errors.New("email body is empty") //Druid ErrDruidAddressNotSet = errors.New("DruidExporter address is not set") )
var DateLayout = "Jan 2, 2006"
Functions ¶
This section is empty.
Types ¶
type Body ¶
Body is used to send text or html of event directly to 3rd party. Ideally none of html should exist in codebase so it's easy to change, however legacy html code still exists.
type DatadogExporter ¶
type DatadogExporter struct {
// contains filtered or unexported fields
}
DatadogExporter exports events to datadog
func NewDatadogExporter ¶
func NewDatadogExporter(d *kodingmetrics.DogStatsD) *DatadogExporter
NewDatadogExporter initializes DatadogExporter struct and NewDatadogExporter implements Exporter interface with Send and Close functions
func (*DatadogExporter) Close ¶
func (d *DatadogExporter) Close() error
Close closes the publisher. DogStatsD is treated as external resource so does nothing.
func (DatadogExporter) Name ¶
func (DatadogExporter) Name() string
Name returns the name of the exporter.
func (*DatadogExporter) Send ¶
func (d *DatadogExporter) Send(m *Event) error
Send publishes Events to Datad
type Event ¶
type Event struct {
Name string // name of event
User *User // user who did event
Body *Body // body of event; text or html
Properties map[string]interface{} // any additional properties
Context map[string]interface{} // any additional context
Count int64 // count of the event
Duration time.Duration // duration of the event
// Publish this events to only whitelisted upstreams
WhitelistedUpstreams []string
}
Event represent an action in time that is done by an user, has body and optionally some properties.
type Exporter ¶
Exporter is the interface to export events to a 3rd party service. Currently third party services: SegementIO and Sendgrid are implemented.
type FakeExporter ¶
type FakeExporter struct {
Events []*Event
}
func NewFakeExporter ¶
func NewFakeExporter() *FakeExporter
func (*FakeExporter) Close ¶
func (l *FakeExporter) Close() error
func (*FakeExporter) Send ¶
func (l *FakeExporter) Send(event *Event) error
type MultiExporter ¶
type MultiExporter []Exporter
func NewMultiExporter ¶
func NewMultiExporter(e ...Exporter) MultiExporter
NewMultiExporter inits the exporter services like; segment, datadog etc.. and implements Exporter interface with Send and Close functions
func (MultiExporter) Name ¶
func (MultiExporter) Name() string
Name returns the name of the exporter.
func (MultiExporter) Send ¶
func (m MultiExporter) Send(event *Event) error
Send publishes the events to multiple upstreams, returns error on first occurence
type SegmentIOExporter ¶
func NewSegmentIOExporter ¶
func NewSegmentIOExporter(key string, size int) *SegmentIOExporter
func (*SegmentIOExporter) Close ¶
func (s *SegmentIOExporter) Close() error
func (SegmentIOExporter) Name ¶
func (SegmentIOExporter) Name() string
Name returns the name of the exporter.
func (*SegmentIOExporter) Send ¶
func (s *SegmentIOExporter) Send(event *Event) error