imetrics

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package imetrics supports recording and submission of internal metrics

Index

Constants

View Source
const (
	InternalMetricsExporterDisabled   = InternalMetricsExporter("disabled")
	InternalMetricsExporterPrometheus = InternalMetricsExporter("prometheus")
	InternalMetricsExporterOTEL       = InternalMetricsExporter("otel")
)
View Source
const (
	InstrumentationErrorInspectionFailed               = "inspection_failed"
	InstrumentationErrorNoInstrumentableFunctionsFound = "no_instrumentable_functions_found"
	InstrumentationErrorAttachingSockFilter            = "attaching_sock_filter"
	InstrumentationErrorAttachingSockMsg               = "attaching_sock_msg"
	InstrumentationErrorCgroupNotFound                 = "cgroup_not_found"
	InstrumentationErrorAttachingCgroup                = "attaching_cgroup"
	InstrumentationErrorAttachingKprobe                = "attaching_kprobe"
	InstrumentationErrorAttachingUprobe                = "attaching_uprobe"
	InstrumentationErrorAttachingIter                  = "attaching_iter"
	InstrumentationErrorInvalidTracepoint              = "invalid_tracepoint"
)

Instrumentation status constants for the instrumented_processes metric

Variables

View Source
var BpfLatenciesBuckets = []float64{
	0.0000001,
	0.0000005,
	0.000001,
	0.000002,
	0.000005,
	0.00001,
	0.00002,
	0.00005,
	0.0001,
	0.0002,
	0.0005,
	0.001,
	0.002,
	0.005,
}
View Source
var InformerLagBuckets = []float64{0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256}

Functions

This section is empty.

Types

type Config

type Config struct {
	Prometheus              PrometheusConfig        `yaml:"prometheus,omitempty"`
	Exporter                InternalMetricsExporter `yaml:"exporter,omitempty" env:"OTEL_EBPF_INTERNAL_METRICS_EXPORTER"`
	BpfMetricScrapeInterval time.Duration           `yaml:"bpf_metric_scrape_interval" env:"OTEL_EBPF_BPF_METRIC_SCRAPE_INTERVAL"`
}

Config options for the different metrics exporters

type InternalMetricsExporter

type InternalMetricsExporter string

func (InternalMetricsExporter) Valid

func (t InternalMetricsExporter) Valid() bool

type NoopReporter

type NoopReporter struct{}

NoopReporter is a metrics Reporter that just does nothing

func (NoopReporter) AvoidInstrumentationMetrics

func (n NoopReporter) AvoidInstrumentationMetrics(_, _, _ string)

func (NoopReporter) AvoidInstrumentationTraces

func (n NoopReporter) AvoidInstrumentationTraces(_, _, _ string)

func (NoopReporter) BpfInternalMetricsScrapeInterval

func (n NoopReporter) BpfInternalMetricsScrapeInterval() time.Duration

func (NoopReporter) BpfMapEntries

func (n NoopReporter) BpfMapEntries(_, _, _ string, _ int)

func (NoopReporter) BpfMapMaxEntries

func (n NoopReporter) BpfMapMaxEntries(_, _, _ string, _ int)

func (NoopReporter) BpfProbeLatency

func (n NoopReporter) BpfProbeLatency(_, _, _ string, _ float64)

func (NoopReporter) InformerLag

func (n NoopReporter) InformerLag(_ float64)

func (NoopReporter) InstrumentProcess

func (n NoopReporter) InstrumentProcess(_ string)

func (NoopReporter) InstrumentationError

func (n NoopReporter) InstrumentationError(_, _ string)

func (NoopReporter) OTELMetricExport

func (n NoopReporter) OTELMetricExport(_ int)

func (NoopReporter) OTELMetricExportError

func (n NoopReporter) OTELMetricExportError(_ error)

func (NoopReporter) OTELTraceExport

func (n NoopReporter) OTELTraceExport(_ int)

func (NoopReporter) OTELTraceExportError

func (n NoopReporter) OTELTraceExportError(_ error)

func (NoopReporter) PrometheusRequest

func (n NoopReporter) PrometheusRequest(_, _ string)

func (NoopReporter) Start

func (n NoopReporter) Start(_ context.Context)

func (NoopReporter) TracerFlush

func (n NoopReporter) TracerFlush(_ int)

func (NoopReporter) UninstrumentProcess

func (n NoopReporter) UninstrumentProcess(_ string)

type PrometheusConfig

type PrometheusConfig struct {
	Port int    `yaml:"port,omitempty" env:"OTEL_EBPF_INTERNAL_METRICS_PROMETHEUS_PORT"`
	Path string `yaml:"path,omitempty" env:"OTEL_EBPF_INTERNAL_METRICS_PROMETHEUS_PATH"`
}

type PrometheusReporter

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

PrometheusReporter is an internal metrics Reporter that exports to Prometheus

func NewPrometheusReporter

func NewPrometheusReporter(cfg *Config, manager *connector.PrometheusManager, registry *prometheus.Registry) *PrometheusReporter

func (*PrometheusReporter) AvoidInstrumentationMetrics

func (p *PrometheusReporter) AvoidInstrumentationMetrics(serviceName, serviceNamespace, serviceInstanceID string)

func (*PrometheusReporter) AvoidInstrumentationTraces

func (p *PrometheusReporter) AvoidInstrumentationTraces(serviceName, serviceNamespace, serviceInstanceID string)

func (*PrometheusReporter) BpfInternalMetricsScrapeInterval

func (p *PrometheusReporter) BpfInternalMetricsScrapeInterval() time.Duration

func (*PrometheusReporter) BpfMapEntries

func (p *PrometheusReporter) BpfMapEntries(mapID, mapName, mapType string, entriesTotal int)

func (*PrometheusReporter) BpfMapMaxEntries

func (p *PrometheusReporter) BpfMapMaxEntries(mapID, mapName, mapType string, maxEntries int)

func (*PrometheusReporter) BpfProbeLatency

func (p *PrometheusReporter) BpfProbeLatency(probeID, probeType, probeName string, latencySeconds float64)

func (*PrometheusReporter) InformerLag

func (p *PrometheusReporter) InformerLag(seconds float64)

func (*PrometheusReporter) InstrumentProcess

func (p *PrometheusReporter) InstrumentProcess(processName string)

func (*PrometheusReporter) InstrumentationError

func (p *PrometheusReporter) InstrumentationError(processName string, errorType string)

func (*PrometheusReporter) OTELMetricExport

func (p *PrometheusReporter) OTELMetricExport(length int)

func (*PrometheusReporter) OTELMetricExportError

func (p *PrometheusReporter) OTELMetricExportError(err error)

func (*PrometheusReporter) OTELTraceExport

func (p *PrometheusReporter) OTELTraceExport(length int)

func (*PrometheusReporter) OTELTraceExportError

func (p *PrometheusReporter) OTELTraceExportError(err error)

func (*PrometheusReporter) PrometheusRequest

func (p *PrometheusReporter) PrometheusRequest(port, path string)

func (*PrometheusReporter) Start

func (p *PrometheusReporter) Start(ctx context.Context)

func (*PrometheusReporter) TracerFlush

func (p *PrometheusReporter) TracerFlush(length int)

func (*PrometheusReporter) UninstrumentProcess

func (p *PrometheusReporter) UninstrumentProcess(processName string)

type Reporter

type Reporter interface {
	// Start the reporter
	Start(ctx context.Context)
	// TracerFlush is invoked every time the eBPF tracer flushes a group of len traces.
	TracerFlush(length int)
	// OTELMetricExport is invoked every time the OpenTelemetry Metrics exporter successfully exports metrics to
	// a remote collector. It accounts the length, in metrics, for each invocation.
	OTELMetricExport(length int)
	// OTELMetricExportError is invoked every time the OpenTelemetry Metrics export fails with an error
	OTELMetricExportError(err error)
	// OTELTraceExport is invoked every time the OpenTelemetry Traces exporter successfully exports traces to
	// a remote collector. It accounts the length, in traces, for each invocation.
	OTELTraceExport(i int)
	// OTELTraceExportError is invoked every time the OpenTelemetry Traces export fails with an error
	OTELTraceExportError(err error)
	// PrometheusRequest is invoked every time the Prometheus exporter is invoked, for a given port and path
	PrometheusRequest(port, path string)
	// InstrumentProcess is invoked every time a new process is successfully instrumented
	InstrumentProcess(processName string)
	// UninstrumentProcess is invoked every time a process is removed from the instrumented processes
	UninstrumentProcess(processName string)
	// InstrumentationError is invoked every time an instrumentation attempt fails
	InstrumentationError(processName string, errorType string)
	// AvoidInstrumentationMetrics is invoked every time a service is avoided due to OTLP metrics detection
	AvoidInstrumentationMetrics(serviceName, serviceNamespace, serviceInstanceID string)
	// AvoidInstrumentationTraces is invoked every time a service is avoided due to OTLP traces detection
	AvoidInstrumentationTraces(serviceName, serviceNamespace, serviceInstanceID string)
	// BpfProbeLatency is invoked every time a BPF probe latency is recorded
	BpfProbeLatency(probeID, probeType, probeName string, latencySeconds float64)
	// BpfMapEntries is invoked every time a BPF map size is recorded
	BpfMapEntries(mapID, mapName, mapType string, entriesTotal int)
	// BpfMapMaxEntries is invoked every time a BPF map max size is recorded
	BpfMapMaxEntries(mapID, mapName, mapType string, maxEntries int)
	// BpfInternalMetricsScrapeInterval returns the configured scrape interval for BPF internal metrics
	BpfInternalMetricsScrapeInterval() time.Duration
	// InformerLag shows the lag between a Kubernetes is updated until it's received and stored by OBI
	InformerLag(seconds float64)
}

Reporter of internal metrics

Jump to

Keyboard shortcuts

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