Skip to main content

query_builder.go - Overview

  1. Overview This file provides utility functions for constructing metric queries. It includes functions for adding metric value filters and formatting values for ClickHouse and PromQL queries.

  2. Detailed Documentation

AddMetricValueFilter(mq *v3.BuilderQuery) *v3.MetricValueFilter

  • Purpose: Extracts the metric value filter from a builder query, if present.
  • Parameters:
    • mq (*v3.BuilderQuery): The builder query to extract the filter from.
  • Returns: A pointer to a v3.MetricValueFilter if found, otherwise nil.

FormattedValue(v interface{}) string

  • Purpose: Formats a value to be used in a ClickHouse query.
  • Parameters:
    • v (interface<{}>): The value to format.
  • Returns: A string representing the formatted value.

PromFormattedValue(v interface{}) string

  • Purpose: Formats a value to be used in a PromQL query.
  • Parameters:
    • v (interface<{}>): The value to format.
  • Returns: A string representing the formatted value.

Include in Getting Started: NO