metrics

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedRemoteRuler

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

CachedRemoteRuler is a thread-safe ruler that retrieves rules from an external service. It has a per-tenant cache: rulesPerTenant

func (*CachedRemoteRuler) RecordingRules

func (r *CachedRemoteRuler) RecordingRules(tenant string) []*model.RecordingRule

type Config

type Config struct {
	Enabled     bool `yaml:"enabled"`
	RulesSource struct {
		ClientAddress string `yaml:"client_address"`
	} `yaml:"rules_source"`
	RemoteWriteAddress string `yaml:"remote_write_address"`
}

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

func (*Config) Validate

func (c *Config) Validate() error

type Exporter

type Exporter interface {
	Send(tenant string, series []prompb.TimeSeries) error
	Flush()
}

func NewExporter

func NewExporter(remoteWriteAddress string, logger log.Logger, reg prometheus.Registerer) (Exporter, error)

type RecordingRulesClient

type RecordingRulesClient interface {
	RecordingRules(tenant string) ([]*model.RecordingRule, error)
}

type RoundTripper

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

func (*RoundTripper) RoundTrip

func (m *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Ruler

type Ruler interface {
	// RecordingRules return a validated set of rules for a tenant, with the following guarantees:
	// - a "__name__" label is present among ExternalLabels. It contains a valid prometheus metric name, and starts
	//   with `profiles_recorded_`
	// - a "profiles_rule_id" label is present among ExternalLabels. It identifies the rule.
	// - a matcher with name "__profile__type__" is present in Matchers
	RecordingRules(tenant string) []*phlaremodel.RecordingRule
}

func NewCachedRemoteRuler

func NewCachedRemoteRuler(client RecordingRulesClient, logger log.Logger) (Ruler, error)

func NewStaticRulerFromOverrides

func NewStaticRulerFromOverrides(overrides *validation.Overrides) Ruler

type SampleObserver

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

func NewSampleObserver

func NewSampleObserver(recordingTime int64, exporter Exporter, ruler Ruler, labels labels.Labels) *SampleObserver

func (*SampleObserver) Close

func (o *SampleObserver) Close()

func (*SampleObserver) Evaluate

func (o *SampleObserver) Evaluate(row block.ProfileEntry) func()

Evaluate manages three kind of states.

  • Per tenant state: Gets initialized on new tenant. It fetches tenant's rules and creates a new recording for each rule. Data of old state is flushed to the exporter.
  • Per dataset state: Gets initialized on new dataset. It holds the subset of rules that matter to that dataset, and some set of pointers symbol-to-rule.
  • Per series (or batch of rows) state: Holds the fingerprint of the series (every batch of rows of the same fingerprint), and whether there's a matching rule that requires symbols to be observed. In addition, the state of every recording is computed, i.e. whether the rule matches the new batch of rows, and a reference of the sample to be aggregated to. (Note that every rule will eventually create multiple single-sample (aggregated) series, depending on the rule.GroupBy space. More info in initState).

This call is not thread-safe

func (*SampleObserver) ObserveSymbols

func (o *SampleObserver) ObserveSymbols(strings []string, functions []schemav1.InMemoryFunction, locations []schemav1.InMemoryLocation, stacktraceValues [][]int32, stacktraceIds []uint32)

ObserveSymbols will skip observation if no rule evaluated true for matchers. At the end of this process we'll have a map stacktraceId -> matching rule, so later we can get stacktraces from the row and quickly look up for matching rules

type StaticExporter

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

func (*StaticExporter) Flush

func (e *StaticExporter) Flush()

func (*StaticExporter) Send

func (e *StaticExporter) Send(tenantId string, data []prompb.TimeSeries) error

type StaticRuler

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

func (StaticRuler) RecordingRules

func (ruler StaticRuler) RecordingRules(tenant string) []*model.RecordingRule

Jump to

Keyboard shortcuts

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