query_builder.go
query_builder.go - Overview
-
Overview This file contains functions for preparing metric queries based on the provided parameters, including handling different temporality types (delta, cumulative) and panel types.
-
Detailed Documentation
PrepareMetricQuery(start, end int64, queryType v3.QueryType, panelType v3.PanelType, mq *v3.BuilderQuery, options metricsV3.Options) (string, error)
- Purpose: Prepares a metric query for fetching data from the database, considering various factors like temporality, panel type, and query parameters.
- Parameters:
start
: int64 - Start timestamp in milliseconds.end
: int64 - End timestamp in milliseconds.queryType
: v3.QueryType - Type of the query.panelType
: v3.PanelType - Type of the panel (e.g., graph, table).mq
: *v3.BuilderQuery - Builder query object containing query parameters.options
: metricsV3.Options - Additional options for the query.
- Returns:
string
: The prepared query string.error
: An error object if any issue occurs during query preparation.
BuildPromQuery(promQuery *v3.PromQuery, step, start, end int64) *model.QueryRangeParams
- Purpose: Builds a
QueryRangeParams
object for executing a PromQL query. - Parameters:
promQuery
: *v3.PromQuery - PromQL query object.step
: int64 - Step interval in seconds.start
: int64 - Start timestamp in milliseconds.end
: int64 - End timestamp in milliseconds.
- Returns:
*model.QueryRangeParams
: AQueryRangeParams
object configured with the provided parameters.
-
Code Examples
None
-
Clarity and Accuracy
All documented functions have clear descriptions and parameter/return value explanations.
-
Markdown & MDX Perfection
The documentation uses proper markdown syntax for headings, lists, and code blocks.
-
Edge Cases To Avoid Breaking MDX
- No unescaped special characters.
- No broken links or images.
- No raw HTML tags.
- No HTML comments.
- No tables.
- Lists are properly indented.
- Code blocks and headings are properly closed.
-
Getting Started Relevance Include in Getting Started: NO