Documentation ¶
Index ¶
- Constants
- Variables
- func AllAttributeNames() map[attr.Name]struct{}
- func ParseOTELResourceVariable(envVar string, handler VarHandler)
- type AttrGroups
- type AttrReportGroup
- type AttrSelector
- type Default
- type Field
- type Getter
- type InclusionLists
- type Name
- type NamedGetters
- type Section
- type Selection
- type VarHandler
Constants ¶
const ( GroupKubernetes = AttrGroups(1 << iota) GroupPrometheus GroupHTTPRoutes GroupNetIfaceDirection GroupNetCIDR GroupPeerInfo // TODO Beyla 2.0: remove when we remove ReportPeerInfo configuration option GroupTarget // TODO Beyla 2.0: remove when we remove ReportTarget configuration option GroupTraces )
Variables ¶
var ( BeylaNetworkFlow = Name{ Section: "beyla.network.flow", Prom: "beyla_network_flow_bytes_total", OTEL: "beyla.network.flow.bytes", } HTTPServerRequestSize = Name{ Section: "http.server.request.body.size", Prom: "http_server_request_body_size_bytes", OTEL: "http.server.request.body.size", } HTTPClientRequestSize = Name{ Section: "http.client.request.body.size", Prom: "http_client_request_body_size_bytes", OTEL: "http.client.request.body.size", } HTTPServerDuration = Name{ Section: "http.server.request.duration", Prom: "http_server_request_duration_seconds", OTEL: "http.server.request.duration", } HTTPClientDuration = Name{ Section: "http.client.request.duration", Prom: "http_client_request_duration_seconds", OTEL: "http.client.request.duration", } RPCServerDuration = Name{ Section: "rpc.server.duration", Prom: "rpc_server_duration_seconds", OTEL: "rpc.server.duration", } RPCClientDuration = Name{ Section: "rpc.client.duration", Prom: "rpc_client_duration_seconds", OTEL: "rpc.client.duration", } DBClientDuration = Name{ Section: "db.client.operation.duration", Prom: "db_client_operation_duration_seconds", OTEL: "db.client.operation.duration", } ProcessCPUTime = Name{ Section: "process.cpu.time", Prom: "process_cpu_time_seconds_total", OTEL: "process.cpu.time", } ProcessCPUUtilization = Name{ Section: "process.cpu.utilization", Prom: "process_cpu_utilization_ratio", OTEL: "process.cpu.utilization", } ProcessMemoryUsage = Name{ Section: "process.memory.usage", Prom: "process_memory_usage_bytes", OTEL: "process.memory.usage", } ProcessMemoryVirtual = Name{ Section: "process.memory.virtual", Prom: "process_memory_virtual_bytes", OTEL: "process.memory.virtual", } ProcessDiskIO = Name{ Section: "process.disk.io", Prom: "process_disk_io_bytes_total", OTEL: "process.disk.io", } ProcessNetIO = Name{ Section: "process.network.io", Prom: "process_network_io_bytes_total", OTEL: "process.network.io", } MessagingPublishDuration = Name{ Section: "messaging.publish.duration", Prom: "messaging_publish_duration_seconds", OTEL: "messaging.publish.duration", } MessagingProcessDuration = Name{ Section: "messaging.process.duration", Prom: "messaging_process_duration_seconds", OTEL: "messaging.process.duration", } )
var (
Traces = Name{
Section: "traces",
}
)
Functions ¶
func AllAttributeNames ¶
AllAttributeNames returns a set with all the names in the attributes database as returned by the getDefinitions function
func ParseOTELResourceVariable ¶ added in v1.9.0
func ParseOTELResourceVariable(envVar string, handler VarHandler)
Types ¶
type AttrGroups ¶
type AttrGroups int
AttrGroups will let enabling by default some groups of attributes under given circumstances. For example, will let enabling kubernetes metadata attributes only if Beyla is running under Kubernetes and kube metadata is enabled.
func (*AttrGroups) Add ¶
func (e *AttrGroups) Add(groups AttrGroups)
func (*AttrGroups) Has ¶
func (e *AttrGroups) Has(groups AttrGroups) bool
type AttrReportGroup ¶
type AttrReportGroup struct { // Disabled is true if the attribute group is going to be ignored under // some conditions (e.g. the kubernetes metadata when kubernetes is disabled) Disabled bool // SubGroups are attribute groups related to this instance. If this instance is // enabled, they might be also enabled (unless they are explicitly disabled) SubGroups []*AttrReportGroup // Attributes map of name: enabled for this group Attributes map[attr.Name]Default }
AttrReportGroup defines groups of attributes allowed by a given metrics.
func (*AttrReportGroup) All ¶
func (p *AttrReportGroup) All() map[attr.Name]struct{}
All te attributes for this group and their subgroups, unless they are disabled.
func (*AttrReportGroup) Default ¶
func (p *AttrReportGroup) Default() map[attr.Name]struct{}
Default attributes for this group and their subgroups, unless they are disabled.
type AttrSelector ¶
type AttrSelector struct {
// contains filtered or unexported fields
}
AttrSelector returns, for each metric, the attributes that have to be reported according to the user-provided selection and/or other conditions (e.g. kubernetes is enabled)
func NewAttrSelector ¶
func NewAttrSelector(groups AttrGroups, selectorCfg Selection) (*AttrSelector, error)
NewAttrSelector returns an AttrSelector instance based on the user-provided attributes Selection and the auto-detected attribute AttrGroups
type Default ¶
type Default bool
Default is true if an attribute must be reported by default, when no "include" selector is specified by the user
type Field ¶
type Field[T, O any] struct { // ExposedName of a metric will vary between OTEL and Prometheus: dot.notation or underscore_notation. ExposedName string Get Getter[T, O] }
Field stores how to expose a metric attribute: its exposed name and how to get its O-typed value from the data record of type T
func OpenTelemetryGetters ¶
func OpenTelemetryGetters[T, O any](getter NamedGetters[T, O], names []attr.Name) []Field[T, O]
OpenTelemetryGetters builds a list of Getter getters for the names provided by the user configuration, ready to be passed to an OpenTelemetry exporter.
func PrometheusGetters ¶
func PrometheusGetters[T, O any](getter NamedGetters[T, O], names []attr.Name) []Field[T, O]
PrometheusGetters builds a list of Getter getters for the names provided by the user configuration, ready to be passed to a Prometheus exporter. It differentiates two name formats: the exposed name for the attribute (uses _ for word separation, as required by Prometheus); and the internal name of the attribute (uses . for word separation, as internally Beyla stores the metadata).
type Getter ¶
type Getter[T, O any] func(T) O
Getter is a function that defines how to get a given metric attribute of the type O (e.g. string or attribute.KeyValue) from a data record of the generic type T (e.g. *ebpf.Record or *request.Span)
type InclusionLists ¶
type InclusionLists struct { // Include is a list of metric attributes that have to be reported. It can be an attribute // name or a wildcard (e.g. k8s.dst.* to include all the attributes starting with k8s.dst). // If no include list is provided, the default attribute set will be reported. Include []string `yaml:"include"` // Exclude will remove attributes from the include list (or the default attribute set). // It can be an attribute name or a wildcard. Exclude []string `yaml:"exclude"` }
type Name ¶
type Name struct { // Section name in the attributes.select configuration option. It is // a normalized form accorting to the normalizeMetric function below. // It makes sure that it does not have metric nor aggregation suffix. Section Section // Prom name of a metric for the Prometheus exporter Prom string // OTEL name of a metric for the OTEL exporter OTEL string }
Name of a metric in three forms
type NamedGetters ¶
NamedGetters returns the Getter for an attribute, given its internal name representation. If the record does not provide any value for the given name, the second argument is false.
type Section ¶
type Section string
Section of the attributes.select configuration. They are metric names using the dot.notation and suppressing any .total .sum or .count suffix. They are used as a standardized key in the attributes.select map, whichever metric format or name the user provides.
type Selection ¶
type Selection map[Section]InclusionLists
Selection specifies which attributes are allowed for each metric. The key is the metric name (either in Prometheus or OpenTelemetry format) The value is the enumeration of included/excluded attribute globs
func (Selection) Matching ¶
func (incl Selection) Matching(metricName Name) []InclusionLists
Matching returns all the entries of the inclusion list matching the provided metric name. This would include "glob-like" entries. They are returned from more to less broad scope (for example, for a metric named foo_bar it could return the inclusion lists defined with keys "*", "foo_*" and "foo_bar", in that order).
func (Selection) Normalize ¶
func (incl Selection) Normalize()
Normalize the user-provided input (error-prone, allowing multiple formats) for unified access from the code: - Convert underscores (prom-like) to dots (OTEL-like) - Remove metric suffixes such as .sum, .total, .bucket, etc... - Remove unit suffixes such as .seconds or .bytes Only normalize the metric names, as the attribute names are already normalized in the PrometheusGetters and OpenTelemetryGetters function TODO: validate too
type VarHandler ¶ added in v1.9.0
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package attr contains definition of the attribute names of for the metrics, especially for the metrics whose reported attributes are selected in the attributes.select YAML option
|
Package attr contains definition of the attribute names of for the metrics, especially for the metrics whose reported attributes are selected in the attributes.select YAML option |