Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
type Delivery struct {
Logger *log.Logger // Public logger that caller can override
// contains filtered or unexported fields
}
Delivery is destination for AWS firehose
func NewDelivery ¶
func NewDelivery(config *DeliveryConfig) *Delivery
NewDelivery creates a new delivery stream given configuration
func (*Delivery) WithLogger ¶
func (d *Delivery) WithLogger(logger *log.Logger) Destination
WithLogger adds optional logging
type DeliveryConfig ¶
type DeliveryConfig struct {
StreamEndpoint string `json:"streamEndpoint,omitempty"`
StreamRegion string `json:"streamRegion"`
StreamName string `json:"streamName"`
BatchSize int `json:"batchSize,omitempty"`
FlushInterval time.Duration `json:"flushInterval,omitempty"`
}
DeliveryConfig contains configuration parameters including optional endpint
type Destination ¶
type Destination interface {
Process(ctx context.Context) error
Send(ctx context.Context, message interface{}) error
WithLogger(logger *log.Logger) Destination
}
Destination interface has a blocking Process method, and Send method
type Forwarder ¶
type Forwarder struct {
Logger *log.Logger // Public logger that caller can override
// contains filtered or unexported fields
}
Forwarder type
func NewForwarder ¶
NewForwarder creates a new forwarder given endpoint
func (*Forwarder) WithLogger ¶
func (f *Forwarder) WithLogger(logger *log.Logger) Destination
WithLogger initializes with logger
type Segment ¶
Segment is intialized with proejctId and destinations
func NewSegment ¶
func NewSegment(projectId ProjectId, destinations []Destination, router *mux.Router) *Segment
NewSegment create new segment handler given project and delivery config
type SegmentBatch ¶
type SegmentBatch struct {
MessageId string `json:"messageId,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
SentAt time.Time `json:"sentAt,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
Messages []SegmentMessage `json:"batch"`
}
SegmentBatch contains batch of messages
type SegmentEvent ¶
type SegmentEvent struct {
WriteKey string `json:"writeKey,omitempty"` // Read clear, and set proejctId
SegmentMessage
}
SegmentEvent is single message with write key
type SegmentMessage ¶
type SegmentMessage struct {
MessageId string `json:"messageId"`
Timestamp time.Time `json:"timestamp"`
SentAt time.Time `json:"sentAt,omitempty"`
ProjectId string `json:"projectId"`
Type string `json:"type"`
Context map[string]interface{} `json:"context,omitempty"` // Duplicate here for batch
Properties map[string]interface{} `json:"properties,omitempty"`
Traits map[string]interface{} `json:"traits,omitempty"`
Integrations map[string]interface{} `json:"integrations,omitempty"` // Probably won't use
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
Event string `json:"event,omitempty"` // Track only
Category string `json:"category,omitempty"` // Page only
Name string `json:"name,omitempty"` // Page only
}
SegmentMessage fields common to all.