Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitMetric ¶
Types ¶
type KafkaProducer ¶
func (*KafkaProducer) In ¶
func (k *KafkaProducer) In(c chan Metric)
func (*KafkaProducer) Start ¶
func (k *KafkaProducer) Start(host string, port int)
type MetricsProducer ¶
type MetricsProducer interface { Consume(c chan Metric) Init() Produce() }
type SSEBroker ¶
type SSEBroker struct { // Create a map of Clients, the keys of the map are the channels // over which we can push messages to attached Clients. (The values // are just booleans and are meaningless.) // Clients map[chan Metric]bool // Channel into which new Clients can be pushed // NewClients chan chan Metric // Channel into which disconnected Clients should be pushed // DefunctClients chan chan Metric // Channel into which messages are pushed to be broadcast out // to attahed Clients. // MetricsChannel chan Metric // the central logger Log *gologger.Logger }
The SSEBroker is responsible for keeping a list of which Clients (browsers) are currently attached and broadcasting events (messages) to those Clients.
type SimpleProducer ¶
type SimpleProducer struct {
// contains filtered or unexported fields
}
a very simple producer. It consumes the metrics stream and produces output on stdout in JSON format.
func (*SimpleProducer) In ¶
func (s *SimpleProducer) In(c chan Metric)
func (*SimpleProducer) Start ¶
func (s *SimpleProducer) Start()
type Streamer ¶
type Streamer struct { Clients map[chan Metric]bool Log *gologger.Logger // contains filtered or unexported fields }
func NewStreamer ¶
Just sets the metrics we want for now...
func (*Streamer) StartProtected ¶
func (s *Streamer) StartProtected()
Generates an outgoing stream of discrete Metric struct values. This stream can then be consumed by other streams like Kafka or SSE. It also protects against crashes by recovering panics and restarting the routine again.
Click to show internal directories.
Click to hide internal directories.