function

package
v1.29.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Field string `json:"field"` // The field on which the aggregation operates.
}

Base represents a common structure for functions that operate on a specific field. Field: The name of the field to be aggregated.

type Latency

type Latency struct {
	Divisor  string `json:"divisor"`
	Dividend string `json:"dividend"`
}

Latency represents a function that calculates latency as a ratio of two metrics. Divisor: The denominator in the latency calculation. Dividend: The numerator in the latency calculation.

func (*Latency) GenerateAggregation

func (p *Latency) GenerateAggregation(metricName string) (map[string]interface{}, error)

GenerateAggregation implements the `Function` interface and generates an aggregation for the `latency` function.

type LatencySumFuncValueInGroup

type LatencySumFuncValueInGroup struct {
	Latency // Embeds the Latency struct for fields `Divisor` and `Dividend`.
	Group   struct {
		Field string `json:"field"` // The field used for grouping.
		Func  string `json:"func"`  // The aggregation function to apply within each group (e.g., max, min, sum).
		Size  uint   `json:"size"`  // The maximum number of groups to return.
	} `json:"group"`
}

LatencySumFuncValueInGroup represents a function that calculates the latency as a sum of values in a grouped aggregation. It combines a `Latency` calculation with a grouping operation and applies a specified aggregation function within each group. The group defines the field to group by, the aggregation function to apply, and the maximum number of groups to include.

func (*LatencySumFuncValueInGroup) GenerateAggregation

func (p *LatencySumFuncValueInGroup) GenerateAggregation(metricName string) (map[string]interface{}, error)

GenerateAggregation implements the `Function` interface and generates an aggregation for the `latency_sum_func_value_in_group` function.

type Rate

type Rate struct {
	Base
	Scale uint `json:"scale"` // The scaling factor used in the rate calculation.
}

Rate extends the Base structure to include scaling for rate calculations. Scale: A multiplier applied to the rate calculation for normalization.

func (*Rate) GenerateAggregation

func (p *Rate) GenerateAggregation(metricName string) (map[string]interface{}, error)

GenerateAggregation implements the `Function` interface and generates an aggregation for the `rate` function.

type RateSumFuncValueInGroup

type RateSumFuncValueInGroup struct {
	Rate  // Embeds the Rate struct for fields `Field` and `Scale`.
	Group struct {
		Field string `json:"field"` // The field used for grouping.
		Func  string `json:"func"`  // The aggregation function to apply within each group (e.g., max, min, sum).
		Size  uint   `json:"size"`  // The maximum number of groups to return.
	} `json:"group"`
}

RateSumFuncValueInGroup represents a function that calculates the rate as a sum of values in a grouped aggregation. It combines a `Rate` calculation with a grouping operation and applies a specified aggregation function within each group. The group defines the field to group by, the aggregation function to apply, and the maximum number of groups to include.

func (*RateSumFuncValueInGroup) GenerateAggregation

func (p *RateSumFuncValueInGroup) GenerateAggregation(metricName string) (map[string]interface{}, error)

GenerateAggregation implements the `Function` interface and generates an aggregation for the `rate_sum_func_value_in_group` function. This function constructs an aggregation pipeline that computes the sum of values for a given field within groups, calculates the derivative, and then applies a bucket script to scale the resulting value by a provided `scale` factor.

type SumFuncValueInGroup

type SumFuncValueInGroup struct {
	Rate  // Embeds the Rate struct for rate-specific fields like `Field` and `Scale`.
	Group struct {
		Field string `json:"field"` // The field used for grouping.
		Func  string `json:"func"`  // The aggregation function to apply within each group (e.g., max, min, sum).
		Size  uint   `json:"size"`  // The maximum number of groups to return.
	} `json:"group"`
}

SumFuncValueInGroup represents a function to calculate a sum of values in a grouped aggregation. It combines a `Rate` calculation with a grouping operation and a specified aggregation function within each group. The group defines the field to group by, the aggregation function to apply, and the maximum number of groups to include.

func (*SumFuncValueInGroup) GenerateAggregation

func (p *SumFuncValueInGroup) GenerateAggregation(metricName string) (map[string]interface{}, error)

GenerateAggregation implements the `Function` interface and generates an aggregation for the `sum_func_value_in_group` function.

Jump to

Keyboard shortcuts

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