Documentation ¶
Index ¶
Constants ¶
const ContextOptionsHelp = `` /* 515-byte string literal not displayed */
ContextOptionsHelp is the help text for context options
const ( // DefaultPrometheusNamespace is the default namespace (prefix) used // for all Hubble related Prometheus metrics DefaultPrometheusNamespace = "hubble" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextIdentifier ¶
type ContextIdentifier int
ContextIdentifier describes the identification method of a transmission or receiving context
const ( // ContextDisabled disables context identification ContextDisabled ContextIdentifier = iota // ContextIdentity uses the full set of identity labels for identification purposes ContextIdentity // ContextNamespace uses the namespace name for identification purposes ContextNamespace // ContextPod uses the pod name for identification purposes ContextPod // ContextPodShort uses a short version of the pod name. It should // typically map to the deployment/replicaset name ContextPodShort // ContextDNS uses the DNS name for identification purposes ContextDNS // ContextIP uses the IP address for identification purposes ContextIP // ContextReservedIdentity uses reserved labels in the identity label list for identification // purpose. It uses "reserved:kube-apiserver" label if it's present in the identity label list. // Otherwise, it uses the first label in the identity label list with "reserved:" prefix. ContextReservedIdentity // ContextWorkloadName uses the pod's workload name for identification. ContextWorkloadName // ContextApp uses the pod's app label for identification. ContextApp )
func (ContextIdentifier) String ¶
func (c ContextIdentifier) String() string
String return the context identifier as string
type ContextIdentifierList ¶
type ContextIdentifierList []ContextIdentifier
func (ContextIdentifierList) String ¶
func (cs ContextIdentifierList) String() string
type ContextOptions ¶
type ContextOptions struct { // Destination is the destination context to include in metrics Destination ContextIdentifierList // Source is the source context to include in metrics Source ContextIdentifierList // Labels is the full set of labels that have been allowlisted when using the // ContextLabels ContextIdentifier. Labels labelsSet }
ContextOptions is the set of options to define whether and how to include sending and/or receiving context information
func ParseContextOptions ¶
func ParseContextOptions(options Options) (*ContextOptions, error)
ParseContextOptions parses a set of options and extracts the context relevant options
func (*ContextOptions) GetLabelNames ¶
func (o *ContextOptions) GetLabelNames() (labels []string)
GetLabelNames returns a slice of label names required to fulfil the configured context description requirements
func (*ContextOptions) GetLabelValues ¶
func (o *ContextOptions) GetLabelValues(flow *pb.Flow) (labels []string, err error)
GetLabelValues returns the values of the context relevant labels according to the configured options. The order of the values is the same as the order of the label names returned by GetLabelNames()
func (*ContextOptions) GetLabelValuesInvertSourceDestination ¶
func (o *ContextOptions) GetLabelValuesInvertSourceDestination(flow *pb.Flow) (labels []string, err error)
GetLabelValuesInvertSourceDestination is the same as GetLabelValues but the source and destination labels are inverted. This is primarily for metrics that leverage the response/return flows where the source and destination are swapped from the request flow.
func (*ContextOptions) Status ¶
func (o *ContextOptions) Status() string
Status returns the configuration status of context options suitable for use with Handler.Status
type Handler ¶
type Handler interface { // Init must initialize the metric handler by validating and parsing // the options and then registering all required metrics with the // specifies Prometheus registry Init(registry *prometheus.Registry, options Options) error // ProcessFlow must processes a flow event and perform metrics // accounting ProcessFlow(ctx context.Context, flow *pb.Flow) error // Status returns the configuration status of the metric handler Status() string }
Handler is a metric handler. It is called upon receival of raw event data and is responsible to perform metrics accounting according to the scope of the metrics plugin.
type Map ¶
Map is a set of metrics with their corresponding options
func ParseMetricList ¶
ParseMetricList parses a slice of metric options and returns a map of enabled metrics
type Options ¶
Options are options provided to a metric handler
func ParseOptions ¶
ParseOptions parses a metric handler option string into a options map
type Plugin ¶
type Plugin interface { // NewHandler returns a new metric handler of the respective plugin NewHandler() Handler // HelpText returns a human readable help text including a description // of the options HelpText() string }
Plugin is a metric plugin. A metric plugin is associated a name and is responsible to spawn metric handlers of a certain type.
type PluginConflicts ¶
type PluginConflicts interface { // ConflictingPlugin returns a list of other plugin names that this plugin // conflicts with. ConflictingPlugins() []string }
PluginConflicts is an optional interface that plugins can implement to declare other plugins they conflict with.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds a set of registered metric handlers
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the default registry of all available metric plugins
func NewRegistry ¶
func NewRegistry(log logrus.FieldLogger) *Registry
NewRegistry returns a new Registry
func (*Registry) ConfigureHandlers ¶
ConfigureHandlers enables a set of metric handlers and initializes them. Only metrics handlers which have been previously registered via the Register() function can be configured.