prom

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpanMetricsLatency = "traces_spanmetrics_latency"
	SpanMetricsCalls   = "traces_spanmetrics_calls_total"
	SpanMetricsSizes   = "traces_spanmetrics_size_total"
	TracesTargetInfo   = "traces_target_info"
	TargetInfo         = "target_info"

	ServiceGraphClient = "traces_service_graph_request_client_seconds"
	ServiceGraphServer = "traces_service_graph_request_server_seconds"
	ServiceGraphFailed = "traces_service_graph_request_failed_total"
	ServiceGraphTotal  = "traces_service_graph_request_total"
)

using labels and names that are equivalent names to the OTEL attributes but following the different naming conventions

View Source
const (
	BeylaBuildInfo = "beyla_build_info"

	LanguageLabel = "target_lang"
)

metrics for Beyla statistics

Variables

This section is empty.

Functions

func NetPrometheusEndpoint

func NetPrometheusEndpoint(
	ctx context.Context,
	ctxInfo *global.ContextInfo,
	cfg *NetPrometheusConfig,
) (pipe.FinalFunc[[]*ebpf.Record], error)

func ProcPrometheusEndpoint

func ProcPrometheusEndpoint(
	ctx context.Context, ctxInfo *global.ContextInfo, cfg *ProcPrometheusConfig,
) pipe.FinalProvider[[]*process.Status]

ProcPrometheusEndpoint provides a pipeline node that export the process information as prometheus metrics

func PrometheusEndpoint

func PrometheusEndpoint(
	ctx context.Context,
	ctxInfo *global.ContextInfo,
	cfg *PrometheusConfig,
	attrSelect attributes.Selection,
) pipe.FinalProvider[[]request.Span]

Types

type Expirer

type Expirer[T prometheus.Metric] struct {
	// contains filtered or unexported fields
}

Expirer drops metrics from labels that haven't been updated during a given timeout

func NewExpirer

func NewExpirer[T prometheus.Metric](wrapped *prometheus.MetricVec, clock func() time.Time, expireTime time.Duration) *Expirer[T]

NewExpirer creates a metric that wraps a given CounterVec. Its labeled instances are dropped if they haven't been updated during the last timeout period

func (*Expirer[T]) Collect

func (ex *Expirer[T]) Collect(metrics chan<- prometheus.Metric)

Collect wraps prometheus.Collector Wrap method

func (*Expirer[T]) Describe

func (ex *Expirer[T]) Describe(descs chan<- *prometheus.Desc)

Describe wraps prometheus.Collector Describe method

func (*Expirer[T]) WithLabelValues

func (ex *Expirer[T]) WithLabelValues(lbls ...string) *MetricEntry[T]

WithLabelValues returns the Counter for the given slice of label values (same order as the variable labels in Desc). If that combination of label values is accessed for the first time, a new Counter is created. If not, a cached copy is returned and the "last access" cache time is updated.

type MetricEntry

type MetricEntry[T prometheus.Metric] struct {
	// contains filtered or unexported fields
}

type NetPrometheusConfig

type NetPrometheusConfig struct {
	Config             *PrometheusConfig
	AttributeSelectors attributes.Selection
	GloballyEnabled    bool
}

NetPrometheusConfig for network metrics just wraps the global prom.NetPrometheusConfig as provided by the user

func (NetPrometheusConfig) Enabled

func (p NetPrometheusConfig) Enabled() bool

nolint:gocritic

type ProcPrometheusConfig

type ProcPrometheusConfig struct {
	Metrics            *PrometheusConfig
	AttributeSelectors attributes.Selection
}

ProcPrometheusConfig for process metrics just wraps the global prom.ProcPrometheusConfig as provided by the user

func (ProcPrometheusConfig) Enabled

func (p ProcPrometheusConfig) Enabled() bool

nolint:gocritic

type PrometheusConfig

type PrometheusConfig struct {
	Port int    `yaml:"port" env:"BEYLA_PROMETHEUS_PORT"`
	Path string `yaml:"path" env:"BEYLA_PROMETHEUS_PATH"`

	// Deprecated. Going to be removed in Beyla 2.0. Use attributes.select instead
	ReportTarget bool `yaml:"report_target" env:"BEYLA_METRICS_REPORT_TARGET"`
	// Deprecated. Going to be removed in Beyla 2.0. Use attributes.select instead
	ReportPeerInfo bool `yaml:"report_peer" env:"BEYLA_METRICS_REPORT_PEER"`

	DisableBuildInfo bool `yaml:"disable_build_info" env:"BEYLA_PROMETHEUS_DISABLE_BUILD_INFO"`

	// Features of metrics that are can be exported. Accepted values are "application" and "network".
	Features []string `yaml:"features" env:"BEYLA_PROMETHEUS_FEATURES" envSeparator:","`
	// Allows configuration of which instrumentations should be enabled, e.g. http, grpc, sql...
	Instrumentations []string `yaml:"instrumentations" env:"BEYLA_PROMETHEUS_INSTRUMENTATIONS" envSeparator:","`

	Buckets otel.Buckets `yaml:"buckets"`

	// TTL is the time since a metric was updated for the last time until it is
	// removed from the metrics set.
	TTL                         time.Duration `yaml:"ttl" env:"BEYLA_PROMETHEUS_TTL"`
	SpanMetricsServiceCacheSize int           `yaml:"service_cache_size"`

	AllowServiceGraphSelfReferences bool `yaml:"allow_service_graph_self_references" env:"BEYLA_PROMETHEUS_ALLOW_SERVICE_GRAPH_SELF_REFERENCES"`

	// Registry is only used for embedding Beyla within the Grafana Agent.
	// It must be nil when Beyla runs as standalone
	Registry *prometheus.Registry `yaml:"-"`
}

TODO: TLS

func (*PrometheusConfig) Enabled

func (p *PrometheusConfig) Enabled() bool

nolint:gocritic

func (*PrometheusConfig) EndpointEnabled

func (p *PrometheusConfig) EndpointEnabled() bool

func (*PrometheusConfig) NetworkMetricsEnabled

func (p *PrometheusConfig) NetworkMetricsEnabled() bool

func (*PrometheusConfig) OTelMetricsEnabled

func (p *PrometheusConfig) OTelMetricsEnabled() bool

func (*PrometheusConfig) ServiceGraphMetricsEnabled

func (p *PrometheusConfig) ServiceGraphMetricsEnabled() bool

func (*PrometheusConfig) SpanMetricsEnabled

func (p *PrometheusConfig) SpanMetricsEnabled() bool

Jump to

Keyboard shortcuts

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