Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Source string `json:"src"` TimestampNano int64 `json:"tsn,string"` IsTest bool `json:"tst,omitempty"` UserID int64 `json:"uid,omitempty"` UserUUID string `json:"uuid,omitempty"` MerchantID int64 `json:"mid,omitempty"` UserName string `json:"scuid,omitempty"` HTTPData *HTTPData `json:"http,omitempty"` EventData interface{} `json:"ed,omitempty"` }
Event is generic structure for Kinesis event
func (*Event) WithHTTPRequest ¶
WithHTTPRequest enriches event with the HTTP request data (like client IP address)
func (*Event) WithIsTest ¶
WithIsTest assigns isTest.
type EventData ¶
type EventData struct { Type EventType `json:"type"` Successful bool `json:"ok"` ContextData interface{} `json:"data,omitempty"` }
EventData holds server event data.
func NewEventData ¶
NewEventData creates an instance of EventData.
func (*EventData) MarkAsSuccessful ¶
MarkAsSuccessful marks event as successful.
func (*EventData) WithContextData ¶
WithContextData assigns data and returns modified server event.
type EventPutter ¶
EventPutter is an interface to put events into some processing pipeline
type HTTPData ¶
type HTTPData struct { ClientIP string `json:"ip,omitempty"` ClientIPCountry string `json:"co,omitempty"` UserAgent string `json:"ua,omitempty"` }
HTTPData contains data from HTTP request
type MetricsPutter ¶
type MetricsPutter struct {
// contains filtered or unexported fields
}
MetricsPutter wraps putter and adds metrics
func AddEventPutterMetrics ¶
func AddEventPutterMetrics(p EventPutter, r *metrics.Registry) *MetricsPutter
AddEventPutterMetrics adds metrics by wrapping handler
func (*MetricsPutter) Put ¶
func (p *MetricsPutter) Put(e *Event) (err error)
Put puts event asynchronously to stream. This method is thread-safe.
type PutterConfig ¶
type PutterConfig struct { AwsAccessKey string AwsSecretKey string AwsRegion string StreamName string }
PutterConfig is a configuration for Kinesis putter
type StreamPutter ¶
type StreamPutter struct {
// contains filtered or unexported fields
}
StreamPutter simplifies putting records to Amazon Kinesis
func NewStreamPutter ¶
func NewStreamPutter(cfg PutterConfig) (*StreamPutter, error)
NewStreamPutter creates a new instance of StreamPutter using provided `cfg` (configuration).
func (*StreamPutter) Close ¶
func (p *StreamPutter) Close() error
Close implements io.Closer interface
func (*StreamPutter) Put ¶
func (p *StreamPutter) Put(e *Event) (err error)
Put puts event asynchronously to stream. This method is thread-safe.