topology

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPromCounter added in v1.8.0

func GetPromCounter(config map[interface{}]interface{}) prometheus.Counter

GetPromCounter creates a prometheus.Counter from config. if same config exsits before, GetPromCounter would return the counter created before. Because tow counters with the same config leads to panic. Better practice maybe to let it panic, so owner can fix the config when program fails to start. But if user use multi workers to run gohangout, panic are bound to happen, this is bad. So we use a manager to return one counter with save config. Better way is to add {worker: idx} to ConstLabels, but it is too hard to implement it by code.

Types

type Filter

type Filter interface {
	Filter(map[string]interface{}) (map[string]interface{}, bool)
}

type FilterBox

type FilterBox struct {
	Filter Filter
	// contains filtered or unexported fields
}

func BuildFilterBoxes

func BuildFilterBoxes(config map[string]interface{}, buildFilter buildFilterFunc) []*FilterBox

func NewFilterBox

func NewFilterBox(config map[interface{}]interface{}) *FilterBox

func (*FilterBox) PostProcess

func (f *FilterBox) PostProcess(event map[string]interface{}, success bool) map[string]interface{}

func (*FilterBox) Process

func (b *FilterBox) Process(event map[string]interface{}) map[string]interface{}

type Input

type Input interface {
	ReadOneEvent() map[string]interface{}
	Shutdown()
}
type NilProcessorInLink struct{}

func (*NilProcessorInLink) Process

func (n *NilProcessorInLink) Process(event map[string]interface{}) map[string]interface{}

type Output

type Output interface {
	Emit(map[string]interface{})
	Shutdown()
}

type OutputBox

type OutputBox struct {
	Output
	*condition_filter.ConditionFilter
	// contains filtered or unexported fields
}

func BuildOutputs

func BuildOutputs(config map[string]interface{}, buildOutput buildOutputFunc) []*OutputBox

func (*OutputBox) Process

func (p *OutputBox) Process(event map[string]interface{}) map[string]interface{}

Process implement Processor interface

type OutputsProcessor

type OutputsProcessor []*OutputBox

func (OutputsProcessor) Process

func (p OutputsProcessor) Process(event map[string]interface{}) map[string]interface{}

Process implement Processor interface

type Processor

type Processor interface {
	Process(map[string]interface{}) map[string]interface{}
}

FilterBox and OutputBox is Processor

type ProcessorNode

type ProcessorNode struct {
	Processor Processor
	Next      *ProcessorNode
}

ProcessorNode is a node in the filter/output link

func AppendProcessorsToLink(head *ProcessorNode, processors ...Processor) *ProcessorNode

AppendProcessorsToLink add new processors to tail, return head node

func (*ProcessorNode) Process

func (node *ProcessorNode) Process(event map[string]interface{}) map[string]interface{}

Processor will process event , and pass it to next, and then next , until last one(generally output)

Jump to

Keyboard shortcuts

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