pods_query.go
Pods_query.go - Overview
- Overview
This file defines a PodsTableListQuery
variable, which is a pre-configured query for retrieving and displaying Kubernetes pod metrics in a table format. It uses the v3.QueryRangeParamsV3
struct to define a composite query with multiple builder queries for different pod metrics like CPU, memory, restarts and phase.
- Detailed Documentation
PodsTableListQuery
- Purpose: Defines a complex query to fetch various metrics related to Kubernetes pods and format them for display in a table. It includes queries for CPU utilization, memory utilization, restart counts, and pod phase.
- Type:
v3.QueryRangeParamsV3
v3.QueryRangeParamsV3
fields:
CompositeQuery
:- Type:
*v3.CompositeQuery
- Description: Defines the structure of the composite query, including individual builder queries.
- Type:
CompositeQuery.BuilderQueries
:- Type:
map[string]*v3.BuilderQuery
- Description: A map of named builder queries. Each key represents a query name (e.g., "A", "B"), and each value is a pointer to a
v3.BuilderQuery
struct.
- Type:
Version
:- Type:
string
- Description: Specifies the version of the query format ("v4").
- Type:
FormatForWeb
:- Type:
bool
- Description: Indicates whether the data should be formatted for web display (
true
).
- Type:
v3.BuilderQuery
fields (for each query A-K):
QueryName
:- Type:
string
- Description: A unique identifier for the query (e.g., "A", "B", "C").
- Type:
DataSource
:- Type:
v3.DataSource
- Description: Specifies the source of the data (
v3.DataSourceMetrics
).
- Type:
AggregateAttribute
:- Type:
v3.AttributeKey
- Description: Defines the attribute to aggregate (e.g., CPU usage, memory usage).
- Type:
AggregateAttribute.Key
:- Type:
string
- Description: The name of the metric to aggregate (e.g., from
metricNamesForPods
).
- Type:
AggregateAttribute.DataType
:- Type:
v3.AttributeKeyDataType
- Description: The data type of the attribute (
v3.AttributeKeyDataTypeFloat64
for numeric metrics,v3.AttributeKeyDataTypeString
for string attributes).
- Type:
Temporality
:- Type:
v3.Temporality
- Description: Specifies the temporality of the metric (
v3.Unspecified
).
- Type:
Filters
:- Type:
*v3.FilterSet
- Description: Defines filters to apply to the data.
- Type:
Filters.Operator
:- Type:
string
- Description: The logical operator to combine filters ("AND").
- Type:
Filters.Items
:- Type:
[]v3.FilterItem
- Description: A slice of filter items.
- Type:
GroupBy
:- Type:
[]v3.AttributeKey
- Description: Defines how to group the data.
- Type:
GroupBy[].Key
:- Type:
string
- Description: The attribute key to group by (
k8sPodUIDAttrKey
).
- Type:
GroupBy[].DataType
:- Type:
v3.AttributeKeyDataType
- Description: The data type of the group by attribute (
v3.AttributeKeyDataTypeString
).
- Type:
GroupBy[].Type
:- Type:
v3.AttributeKeyType
- Description: The type of the group by attribute (
v3.AttributeKeyTypeResource
).
- Type:
Expression
:- Type:
string
- Description: An expression to use for calculations (same as
QueryName
in this case).
- Type:
ReduceTo
:- Type:
v3.ReduceToOperator
- Description: Specifies how to reduce the data (
v3.ReduceToOperatorAvg
,v3.ReduceToOperatorSum
, orv3.ReduceToOperatorLast
).
- Type:
TimeAggregation
:- Type:
v3.TimeAggregation
- Description: Specifies how to aggregate data over time (
v3.TimeAggregationAvg
orv3.TimeAggregationAnyLast
).
- Type:
SpaceAggregation
:- Type:
v3.SpaceAggregation
- Description: Specifies how to aggregate data across space (
v3.SpaceAggregationSum
,v3.SpaceAggregationAvg
, orv3.SpaceAggregationCount
,v3.SpaceAggregationMax
).
- Type:
Functions
:- Type:
[]v3.Function
- Description: Specifies functions to apply to the data. Only applicable to query "G".
- Type:
Disabled
:- Type:
bool
- Description: Indicates whether the query is disabled (
false
).
- Type:
v3.CompositeQuery
fields:
PanelType
:- Type:
v3.PanelType
- Description: Defines the panel type for display (
v3.PanelTypeTable
).
- Type:
QueryType
:- Type:
v3.QueryType
- Description: Specifies the type of query (
v3.QueryTypeBuilder
).
- Type:
- Code Examples
None.
- Clarity and Accuracy
The documentation accurately reflects the code.
- Markdown & MDX Perfection
The markdown is properly formatted.
Include in Getting Started: NO