Skip to main content
Version: 2.6.0

Flux Meter

Purpose

The Flux Meter provides a way to translate a flux of flows matching a Flow Selector to a Prometheus histogram.

Naming

Flux Meter is referred to by its name. It's strongly recommended to assign globally unique names to Flux Meters. A good practice is to prefix the Flux Meter name with the policy name.

warning

Flux Meters with repeated names within the same Agent Group will fail to load at the agents.

Metric

The default metric tracked by Flux Meter is the flow's workload duration in milliseconds. The Flux Meter might be configured to track any arbitrary metric from OpenTelemetry attributes on log or span telemetry streams based on the insertion method. For instance, any of the metrics defined in the Envoy access log specification might be used by Flux Meter.

Buckets

The buckets used by histogram metric can be provided as configuration to Flux Meter. Buckets effect the accuracy of quantile calculations at Prometheus through PromQL. Prometheus recommends defining buckets close to the actual distribution of metric values to achieve good accuracy.

note

Buckets are needed only for quantile queries, for example, getting the 95th percentile of duration across pods in a service. The buckets do not matter if you are only interested in the average duration or throughput metrics from a Flux Meter.

Usage

PromQL components can refer to the metrics generated by Flux Meter. The histogram metric generated by Flux Meter is named flux_meter and has the following labels:

  1. flux_meter_name: Name of the Flux Meter metric
  2. decision_type: Flow control decision from Agent
  3. status_code: HTTP status code of the flow. Relevant only for traffic-based Control Points.
  4. flow_status: Protocol independent status for the flow.
  5. Other common labels available at all agents, such as instance.
info

For more details, please refer to metrics and labels collected by Flux Meters.

Query to get average duration (assuming default Flux Meter metric):

sum(increase(flux_meter_sum{flux_meter_name=\"<name>\"}[10s]))/sum(increase(flux_meter_count{flux_meter_name=\"<name>\"}[10s]))

Query to get requests per second:

sum(rate(flux_meter_count{flux_meter_name=\"<name>\"}[10s]))

Query to get 95th percentile of duration:

histogram_quantile(0.95, sum(rate(flux_meter_bucket{flux_meter_name=\"<name>\"}[5m])) by (le))

PromQL Components in a Circuit can use the Flux Meter metric in a PromQL query as described above. The PromQL Component generates a signal representing the results of the PromQL query.

Control Loop

A control loop can use a duration signal generated using the Flux Meter metric as a signal to a Controller which determines the desired Concurrency of a Service.

Observability

Flux Meters are a great way to measure SLOs of your Service down to fine-grained APIs attributes such as endpoints, user types (subscriber user compared to guest user).