Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlackholeClient ¶
type BlackholeClient struct{}
BlackholeClient satisfies the publisher for mocking
func NewBlackholeClient ¶
func NewBlackholeClient() *BlackholeClient
NewBlackholeClient creates new telemetry client
func (*BlackholeClient) PublishEvent ¶
func (client *BlackholeClient) PublishEvent(event *Event) error
func (*BlackholeClient) PublishEventAsync ¶
func (client *BlackholeClient) PublishEventAsync(event *Event)
type Event ¶
type Event struct {
Time time.Time `json:"time"`
EventID int `json:"event_id"`
EventType int `json:"event_type"`
EventLevel int `json:"event_level"`
Service string `json:"service"`
ClientIDs []string `json:"client_ids"`
UserID string `json:"user_id"`
TargetUserIDs []string `json:"target_user_ids"`
Namespace string `json:"namespace"`
TargetNamespace string `json:"target_namespace"`
TraceID string `json:"trace_id"`
SessionID string `json:"session_id"`
Privacy bool `json:"privacy"`
Realm string `json:"realm"`
Topic string `json:"topic"`
AdditionalFields map[string]interface{} `json:"additional_fields,omitempty"`
}
Event holds the outer telemetry Event structure
func NewEvent ¶
func NewEvent(eventID int, eventType int, eventLevel int, service string, clientIDs []string, userID string, targetUserIDs []string, namespace string, targetNamespace string, traceID string, sessionID string, privacy bool, topic string) *Event
NewEvent creates new Event without additional fields
func (*Event) WithFields ¶
WithFields add additional fields
type KafkaClient ¶
type KafkaClient struct {
// contains filtered or unexported fields
}
KafkaClient satisfies the publisher to Kafka
func NewKafkaClient ¶
func NewKafkaClient(realm string, brokerList []string, producerConfiguration ...*KafkaConfig) (*KafkaClient, error)
NewKafkaClient creates new client to publish event to kafka The first producerConfiguration is the asynchronous producer configuration meanwhile the second is the synchronous one
func (*KafkaClient) PublishEvent ¶
func (client *KafkaClient) PublishEvent(event *Event) error
PublishEvent push an event to a Kafka topic synchronously
func (*KafkaClient) PublishEventAsync ¶
func (client *KafkaClient) PublishEventAsync(event *Event)
PublishEventAsync publish to a Kafka topic asynchronously
type KafkaConfig ¶
type KafkaConfig struct {
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
MetadataRetryMax int
MetadataRetryBackoff time.Duration
}
KafkaConfig is Kafka configuration to wait for a successful metadata response
type PublisherClient ¶
PublisherClient provides interface for publish the Event to stream
type StdoutClient ¶
type StdoutClient struct {
// contains filtered or unexported fields
}
StdoutClient satisfies the publisher for mocking
func NewStdoutClient ¶
func NewStdoutClient(realm string) *StdoutClient
NewStdoutClient creates new telemetry client
func (*StdoutClient) PublishEvent ¶
func (client *StdoutClient) PublishEvent(event *Event) error
func (*StdoutClient) PublishEventAsync ¶
func (client *StdoutClient) PublishEventAsync(event *Event)