Skip to main content

process.go

process.go - Overview

This file implements the main post-processing logic for query results. It applies having clauses, metric limits, functions, reduce functions, and formula calculations to refine and transform the data before it is presented to the user.

Detailed Documentation

PostProcessResult

Purpose:

Applies a series of post-processing steps to query results, including filtering with having clauses, limiting the number of series, applying functions, reducing series to single values, and evaluating formulas.

Parameters:

  • result ([]*v3.Result): The slice of query results to process.
  • queryRangeParams (*v3.QueryRangeParamsV3): The query range parameters, including the composite query and builder queries containing all post-processing configurations.

Returns:

  • []*v3.Result: The processed query results.
  • error: An error if any of the post-processing steps fail.

ApplyFunctions

Purpose:

Applies a list of functions to each query result.

Parameters:

  • results ([]*v3.Result): The slice of query results to process.
  • queryRangeParams (*v3.QueryRangeParamsV3): The query range parameters, including the composite query and builder queries containing the function definitions.

Returns:

None. The function modifies the results slice in place, applying the functions to each result.

tablePanelResultProcessor

Purpose:

Ensures that all data points in a table panel result have the same timestamp.

Parameters:

  • results ([]*v3.Result): The slice of query results to process.

Returns:

None. The function modifies the results slice in place, ensuring consistent timestamps for table panels.

Include in Getting Started: NO