observer

package
v0.18.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package observer is intended to be a utility that can observe CloudEvents as a Sink (addressable + CloudEvents) and fan out the observed events to several EventLog implementations if required.

The intention is something like:

+--> [Kubernetes Events via recorder]
|

[Event Producer] --> Observer +--> [pod logs via writer]

|
+--> [http forward via http]

Then we can collect all events observed with something like:

[Kubernetes Events] <-- [collector]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventLog

type EventLog interface {
	Vent(observed Observed) error
}

EventLog is the contract for an event logger to vent an event.

type Observed

type Observed struct {
	Event    cloudevents.Event `json:"event"`
	Origin   string            `json:"origin"`
	Observer string            `json:"observer"`
	Time     string            `json:"time"`
}

Observed is is the CloudEvent and metadata to relevant to an observation.

type Observer

type Observer struct {
	// Name is the name of this Observer, used to filter if multiple observers.
	Name string
	// EventLogs is the list of EventLog implementors to vent observed events.
	EventLogs []EventLog
}

Observer is the entry point for sinking events into the event log.

func New

func New(eventLogs ...EventLog) *Observer

New returns an observer that will vent observations to the list of provided EventLog instances. It will listen on :8080.

func (*Observer) Start

func (o *Observer) Start(ctx context.Context) error

Start will create the CloudEvents client and start listening for inbound HTTP requests. This is a is a blocking call.

Directories

Path Synopsis
Package http_vent implements an observer.EventLog backed by a CloudEvents HTTP client, following the eventing sources container runtime contract.
Package http_vent implements an observer.EventLog backed by a CloudEvents HTTP client, following the eventing sources container runtime contract.
Package recorder_collector holds a class to collect the logs from a recorder vented event log.
Package recorder_collector holds a class to collect the logs from a recorder vented event log.
Package recorder_vent implements an observer.EventLog backed by Kubernetes Events using an event recorder.
Package recorder_vent implements an observer.EventLog backed by Kubernetes Events using an event recorder.
Package writer_vent implements an observer.EventLog backed by a io.Writer instance, events are converted to json and written out to the writer.
Package writer_vent implements an observer.EventLog backed by a io.Writer instance, events are converted to json and written out to the writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL