goflowlib

package
v0.0.0-...-04763f7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package goflowlib provides converters between the goflow library and the types used internally for netflow at Datadog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFlow

func ConvertFlow(srcFlow *flowpb.FlowMessage, namespace string) *common.Flow

ConvertFlow convert goflow flow structure to internal flow structure

func ConvertFlowWithAdditionalFields

func ConvertFlowWithAdditionalFields(srcFlow *common.FlowMessageWithAdditionalFields, namespace string) *common.Flow

ConvertFlowWithAdditionalFields convert goflow flow structure and additional fields to internal flow structure

func ConvertMetric

func ConvertMetric(metric *promClient.Metric, metricFamily *promClient.MetricFamily) (
	metrics.MetricType,
	string,
	float64,
	[]string,
	error,
)

ConvertMetric converts prometheus metric to datadog compatible metrics

func GetLogrusLevel

func GetLogrusLevel(logger log.Component) *logrus.Logger

GetLogrusLevel returns logrus log level from log.GetLogLevel()

Types

type AggregatorFormatDriver

type AggregatorFormatDriver struct {
	// contains filtered or unexported fields
}

AggregatorFormatDriver is used as goflow formatter to forward flow data to aggregator/EP Forwarder

func NewAggregatorFormatDriver

func NewAggregatorFormatDriver(flowAgg chan *common.Flow, namespace string, listenerFlowCount *atomic.Int64) *AggregatorFormatDriver

NewAggregatorFormatDriver returns a new AggregatorFormatDriver

func (*AggregatorFormatDriver) Format

func (d *AggregatorFormatDriver) Format(data interface{}) ([]byte, []byte, error)

Format desc

func (*AggregatorFormatDriver) Init

Init desc

func (*AggregatorFormatDriver) Prepare

func (d *AggregatorFormatDriver) Prepare() error

Prepare desc

type FlowRunnableState

type FlowRunnableState interface {
	// FlowRoutine starts flow processing workers
	FlowRoutine(workers int, addr string, port int, reuseport bool) error

	// Shutdown trigger shutdown of the flow processing workers
	Shutdown()
}

FlowRunnableState provides common interface for StateNetFlow/StateSFlow/StateNFLegacy/etc

type FlowStateWrapper

type FlowStateWrapper struct {
	State    FlowRunnableState
	Hostname string
	Port     uint16
}

FlowStateWrapper is a wrapper for StateNetFlow/StateSFlow/StateNFLegacy to provide additional info like hostname/port

func StartFlowRoutine

func StartFlowRoutine(
	flowType common.FlowType,
	hostname string,
	port uint16,
	workers int,
	namespace string,
	fieldMappings []config.Mapping,
	flowInChan chan *common.Flow,
	logger log.Component,
	atomicErr *atomic.String,
	listenerFlowCount *atomic.Int64) (*FlowStateWrapper, error)

StartFlowRoutine starts one of the goflow flow routine depending on the flow type

func (*FlowStateWrapper) Shutdown

func (s *FlowStateWrapper) Shutdown()

Shutdown is a wrapper for StateNetFlow/StateSFlow/StateNFLegacy Shutdown method

Directories

Path Synopsis
Package additionalfields provides a producer collecting additional fields from Netflow/IPFIX packets.
Package additionalfields provides a producer collecting additional fields from Netflow/IPFIX packets.
Package netflowstate provides a Netflow state manager on top of goflow default producer, to allow additional fields collection.
Package netflowstate provides a Netflow state manager on top of goflow default producer, to allow additional fields collection.

Jump to

Keyboard shortcuts

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