enrich_query.go
enrich_query.go - Overview
This file contains functions for enriching log queries with metadata, specifically for v3 queries. The functions determine if enrichment is required and then enrich the query parameters with the appropriate field metadata.
Detailed Documentation
EnrichmentRequired(params *v3.QueryRangeParamsV3) bool
- Purpose: Determines if enrichment is required for a given query range parameters v3.
- Parameters:
params
:*v3.QueryRangeParamsV3
- The query range parameters v3.
- Returns:
bool
: True if enrichment is required, false otherwise.
isEnriched(field v3.AttributeKey) bool
- Purpose: Checks if a field is already enriched, by checking the field key against a list of static fields.
- Parameters:
field
:v3.AttributeKey
- The attribute key to check.
- Returns:
bool
: True if the field is enriched, false otherwise.
Enrich(params *v3.QueryRangeParamsV3, fields map[string]v3.AttributeKey)
- Purpose: Enriches a query range parameters v3 with metadata.
- Parameters:
params
:*v3.QueryRangeParamsV3
- The query range parameters v3 to enrich.fields
:map[string]v3.AttributeKey
- A map of field metadata.
- Returns: None
EnrichLogsQuery(query *v3.BuilderQuery, fields map[string]v3.AttributeKey) error
- Purpose: Enriches a logs query with metadata.
- Parameters:
query
:*v3.BuilderQuery
- The builder query to enrich.fields
:map[string]v3.AttributeKey
- A map of field metadata.
- Returns:
error
: An error, if any.
enrichFieldWithMetadata(field v3.AttributeKey, fields map[string]v3.AttributeKey) v3.AttributeKey
- Purpose: Enriches a single attribute key with metadata from the provided fields map.
- Parameters:
field
:v3.AttributeKey
- The attribute key to enrich.fields
:map[string]v3.AttributeKey
- A map of field metadata.
- Returns:
v3.AttributeKey
: The enriched attribute key.
jsonFilterEnrich(filter v3.FilterItem) v3.FilterItem
- Purpose: Enriches a JSON filter item by determining the data type of the value.
- Parameters:
filter
:v3.FilterItem
- The filter item to enrich.
- Returns:
v3.FilterItem
: The enriched filter item.
jsonReplaceField(filter v3.FilterItem, fields map[string]v3.AttributeKey) v3.FilterItem
- Purpose: Replaces a field in a JSON filter item with its corresponding metadata from the provided fields map.
- Parameters:
filter
:v3.FilterItem
- The filter item to process.fields
:map[string]v3.AttributeKey
- A map of field metadata.
- Returns:
v3.FilterItem
: The modified filter item.
parseStrValue(valueStr string, operator v3.FilterOperator) (string, interface{})
- Purpose: Parses a string value and determines its data type.
- Parameters:
valueStr
:string
- The string value to parse.operator
:v3.FilterOperator
- The operator being used in the filter.
- Returns:
string
: The data type of the parsed value.interface{}
: The parsed value.
Code Examples
N/A
Include in Getting Started: NO