Skip to main content

gaps.go

gaps.go - Overview

This file implements functions for filling gaps in time series data. It provides a mechanism to ensure that graph panels display continuous data by inserting zero values where data points are missing.

Detailed Documentation

StepIntervalForFunction

Purpose:

Determines the appropriate step interval for a given query, considering potential dependencies on other queries within a composite query.

Parameters:

  • params (*v3.QueryRangeParamsV3): The query range parameters, including the composite query and builder queries.
  • query (string): The name of the query for which to determine the step interval.

Returns:

  • int64: The step interval in milliseconds.

fillGap

Purpose:

Fills the gaps in a single time series by adding data points with zero values at missing timestamps.

Parameters:

  • series (*v3.Series): The time series data to fill gaps in.
  • start (int64): The start timestamp of the range to fill.
  • end (int64): The end timestamp of the range to fill.
  • step (int64): The step interval in seconds between data points.

Returns:

  • *v3.Series: A new time series with gaps filled.

FillGaps

Purpose:

Fills gaps in a list of query results, ensuring that graph panels display continuous data.

Parameters:

  • results ([]*v3.Result): A slice of query results to process.
  • params (*v3.QueryRangeParamsV3): The query range parameters, including composite query information needed to determine step intervals and panel types.

Returns:

None. The function modifies the results slice in place, filling gaps as necessary.

Include in Getting Started: NO