utils.go
utils.go - Overview
-
Overview This file provides utility functions for handling traces in the v3 version of the query service. It includes functions for checking trace ID filters, extracting string values, handling pointer values, adding timestamp filters, and defining default selected columns for traces list view.
-
Detailed Documentation
TracesListViewDefaultSelectedColumns
- Purpose: Defines the default set of columns to be displayed in the traces list view.
- Type:
[]v3.AttributeKey
- Elements:
serviceName
(string, tag, column)name
(string, tag, column)durationNano
(array of float64, tag, column)httpMethod
(string, tag, column)responseStatusCode
(string, tag, column)
TraceIdFilterUsedWithEqual
- Purpose: Checks if a trace ID filter with the
Equal
orIn
operator is used in the traces query and returns the list of trace IDs if found. - Parameters:
params
(*v3.QueryRangeParamsV3): The query parameters containing the composite query.
- Returns:
bool
: Indicates whether a trace ID filter is used.[]string
: A slice of trace IDs extracted from the filter, if present.
extractFormattedStringValues
- Purpose: Extracts formatted string values from a given interface{}. It handles string and []interface{} types, extracting string values from them.
- Parameters:
v
(interface{}: The interface from which to extract string values.
- Returns:
[]string
: A slice of extracted string values. Returns an empty slice if the input is not a string or a slice of strings.
getPointerValue
- Purpose: Dereferences a pointer to its underlying value if the input is a pointer type. If the input is not a pointer, it returns the input value unchanged.
- Parameters:
v
(interface{}): The interface to check and dereference if it's a pointer.
- Returns:
interface{}
: The dereferenced value if the input was a pointer, or the original value otherwise.
AddTimestampFilters
- Purpose: Adds timestamp filters (minTime and maxTime) to the query if a traceID filter is present.
- Parameters:
minTime
(int64): The minimum timestamp.maxTime
(int64): The maximum timestamp.params
(*v3.QueryRangeParamsV3): The query parameters.
- Returns: None
- Code Examples
Not applicable.
Include in Getting Started: NO