Skip to main content

translator.go

translator.go - Overview

  1. Overview This file contains functions for building query parameters and ClickHouse queries related to Kafka messaging queues. It translates generic messaging queue requests into specific queries for fetching and processing data from ClickHouse.

  2. Detailed Documentation

Function: BuildQueryRangeParams

  • Purpose: Constructs QueryRangeParamsV3 for Kafka messaging queues based on the provided MessagingQueue and query context.
  • Parameters:
    • messagingQueue (*MessagingQueue): The messaging queue configuration.
    • queryContext (string): The context of the query (e.g., "producer-consumer-eval").
  • Returns:
    • *v3.QueryRangeParamsV3: The constructed query range parameters.
    • error: An error if the span evaluation feature is disabled or if there are issues building the queries.

Function: buildClickHouseQueryNetwork

  • Purpose: Generates a ClickHouse query for network latency and throughput based on the provided MessagingQueue and queue type.
  • Parameters:
    • messagingQueue (*MessagingQueue): The messaging queue configuration.
    • queueType (string): The type of the queue (e.g., KafkaQueue).
  • Returns:
    • *v3.ClickHouseQuery: The generated ClickHouse query.
    • error: An error if consumer_group or partition are not found in the request variables.

Function: buildBuilderQueriesProducerBytes

  • Purpose: Builds builder queries for producer byte rates.
  • Parameters:
    • unixMilliStart (int64): Start time in milliseconds.
    • unixMilliEnd (int64): End time in milliseconds.
    • attributeCache (*Clients): Client attributes.
  • Returns:
    • map[string]*v3.BuilderQuery: A map of builder queries.
    • error: An error if any.

Function: buildBuilderQueriesNetwork

  • Purpose: Builds builder queries for network latency.
  • Parameters:
    • unixMilliStart (int64): Start time in milliseconds.
    • unixMilliEnd (int64): End time in milliseconds.
    • attributeCache (*Clients): Client attributes.
  • Returns:
    • map[string]*v3.BuilderQuery: A map of builder queries.
    • error: An error if any.

Function: BuildBuilderQueriesKafkaOnboarding

  • Purpose: Builds QueryRangeParamsV3 for Kafka onboarding queries.
  • Parameters:
    • messagingQueue (*MessagingQueue): The messaging queue configuration.
  • Returns:
    • *v3.QueryRangeParamsV3: The constructed query range parameters.
    • error: An error if any.

Function: BuildQRParamsWithCache

  • Purpose: Builds QueryRangeParamsV3 using cached attributes.
  • Parameters:
    • messagingQueue (*MessagingQueue): The messaging queue configuration.
    • queryContext (string): The context of the query.
    • attributeCache (*Clients): Client attributes cache.
  • Returns:
    • *v3.QueryRangeParamsV3: The constructed query range parameters.
    • error: An error if any.

Function: BuildClickHouseQuery

  • Purpose: Constructs a ClickHouseQuery based on the provided MessagingQueue, queue type, and query context.
  • Parameters:
    • messagingQueue (*MessagingQueue): The messaging queue configuration.
    • queueType (string): The type of the queue (e.g., KafkaQueue).
    • queryContext (string): The context of the query (e.g., "producer", "consumer").
  • Returns:
    • *v3.ClickHouseQuery: The constructed ClickHouse query.
    • error: An error if required variables (e.g., "topic", "partition", "consumer_group") are missing from the messaging queue configuration.

Function: buildCompositeQuery

  • Purpose: Constructs a CompositeQuery from a ClickHouseQuery and a query context.
  • Parameters:
    • chq (*v3.ClickHouseQuery): The ClickHouse query.
    • queryContext (string): The context of the query.
  • Returns:
    • *v3.CompositeQuery: The constructed composite query.
    • error: An error if any.
  1. Code Examples

N/A

  1. Clarity and Accuracy

The documentation accurately reflects the purpose, parameters, and returns of each function as evident from the code.

  1. Markdown & MDX Perfection

The markdown syntax is valid and well-formatted.

  1. Edge Cases To Avoid Breaking MDX

No MDX errors were identified.

  1. Getting Started Relevance

Include in Getting Started: NO