Documentation ¶
Index ¶
- Constants
- type ContextIdentifier
- type ContextIdentifierList
- type ContextOptions
- func (o *ContextOptions) DeleteMetricsAssociatedWithPod(name string, namespace string, vec *prometheus.MetricVec)
- func (o *ContextOptions) GetLabelNames() (labels []string)
- func (o *ContextOptions) GetLabelValues(flow *pb.Flow) (labels []string, err error)
- func (o *ContextOptions) GetLabelValuesInvertSourceDestination(flow *pb.Flow) (labels []string, err error)
- func (o *ContextOptions) Status() string
- type FlowProcessor
- type Handler
- type Handlers
- type Map
- type NamedHandler
- type Options
- type Plugin
- type PluginConflicts
- type Registry
Constants ¶
const ContextOptionsHelp = `` /* 782-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 namespace and pod name for identification purposes in the form of namespace/pod-name. ContextPod // ContextPodName uses the pod name for identification purposes ContextPodName // 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 for both egress and ingress traffic Destination ContextIdentifierList // Destination is the destination context to include in metrics for egress traffic (overrides Destination) DestinationEgress ContextIdentifierList // Destination is the destination context to include in metrics for ingress traffic (overrides Destination) DestinationIngress ContextIdentifierList // Source is the source context to include in metrics for both egress and ingress traffic Source ContextIdentifierList // Source is the source context to include in metrics for egress traffic (overrides Source) SourceEgress ContextIdentifierList // Source is the source context to include in metrics for ingress traffic (overrides Source) SourceIngress ContextIdentifierList // Labels is the full set of labels that have been allowlisted when using the // ContextLabels ContextIdentifier. Labels labelsSet // contains filtered or unexported fields }
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) DeleteMetricsAssociatedWithPod ¶
func (o *ContextOptions) DeleteMetricsAssociatedWithPod(name string, namespace string, vec *prometheus.MetricVec)
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 FlowProcessor ¶
type FlowProcessor interface { // ProcessFlow must processes a flow event and perform metrics // accounting ProcessFlow(ctx context.Context, flow *pb.Flow) error }
FlowProcessor is a metric handler which requires flows to perform metrics accounting. 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 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 // ListMetricVec returns an array of MetricVec used by a handler ListMetricVec() []*prometheus.MetricVec // Context used by this metrics handler Context() *ContextOptions // Status returns the configuration status of the metric handler Status() string }
Handler is a basic metric handler.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers contains all the metrics handlers.
func NewHandlers ¶
func NewHandlers(log logrus.FieldLogger, registry *prometheus.Registry, in []NamedHandler) (*Handlers, error)
func (Handlers) ProcessFlow ¶
ProcessFlow processes a flow by calling ProcessFlow it on to all enabled metric handlers
func (Handlers) ProcessPodDeletion ¶
func (h Handlers) ProcessPodDeletion(pod *slim_corev1.Pod)
ProcessPodDeletion queries all handlers for a list of MetricVec and removes metrics directly associated to deleted pod.
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 NamedHandler ¶
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.