Skip to main content

enrich.go

enrich.go - Overview

  1. Overview This file contains functions for enriching trace query parameters with metadata, ensuring that queries work correctly regardless of whether attributes are materialized or dematerialized. It handles the enrichment of keys used in aggregation, filtering, grouping, ordering, and selection within trace queries.

  2. Detailed Documentation

Function: isEnriched

  • Purpose: Checks if a given attribute key is already enriched, meaning it's a timestamp, ID, value, or a static field and doesn't require further enrichment.
  • Parameters:
    • field (v3.AttributeKey): The attribute key to check.
  • Returns:
    • bool: Returns true if the field is already enriched, false otherwise.

Function: enrichKeyWithMetadata

  • Purpose: Enriches an attribute key with metadata by checking if it's a static field or looking it up in a provided map of keys. If no metadata is found, it enriches with default values.
  • Parameters:
    • key (v3.AttributeKey): The attribute key to enrich.
    • keys (map[string]v3.AttributeKey): A map of attribute keys used for enrichment lookup.
  • Returns:
    • v3.AttributeKey: The enriched attribute key.

Function: Enrich

  • Purpose: Enriches the query parameters within a QueryRangeParamsV3 struct, specifically targeting trace queries. It iterates through the builder queries and calls EnrichTracesQuery for each trace query.
  • Parameters:
    • params (*v3.QueryRangeParamsV3): The query parameters to enrich.
    • keys (map[string]v3.AttributeKey): A map of attribute keys used for enrichment lookup.
  • Returns:
    • None

Function: EnrichTracesQuery

  • Purpose: Enriches various parts of a BuilderQuery related to traces, including the aggregate attribute, filter items, group by attributes, order by attributes, and select columns, using the provided metadata.
  • Parameters:
    • query (*v3.BuilderQuery): The trace query to enrich.
    • keys (map[string]v3.AttributeKey): A map of attribute keys used for enrichment lookup.
  • Returns:
    • None

Function: enrichOrderBy

  • Purpose: Enriches a slice of OrderBy structs with metadata, ensuring each OrderBy item has its key enriched.
  • Parameters:
    • items ([]v3.OrderBy): The slice of OrderBy items to enrich.
    • keys (map[string]v3.AttributeKey): A map of attribute keys used for enrichment lookup.
  • Returns:
    • []v3.OrderBy: A new slice containing the enriched OrderBy items.
  1. Code Examples None

Include in Getting Started: NO