Skip to main content

pvcs_query.go

Pvcs_query.go - Overview

  1. Overview

This file defines a pre-configured query (PvcsTableListQuery) for retrieving and displaying Persistent Volume Claims (PVCs) metrics in a table format. It uses a composite query consisting of multiple builder queries to fetch volume capacity, available space, inodes, free inodes, and used inodes.

  1. Detailed Documentation

PvcsTableListQuery

  • Purpose: Defines a complex query to fetch and format PVC metrics for tabular display.
  • Type: v3.QueryRangeParamsV3
  • Fields:
    • CompositeQuery: A v3.CompositeQuery struct containing the details of how to build the query.
      • BuilderQueries: A map of named v3.BuilderQuery structs, each defining a sub-query.
        • "A": Query for k8s.volume.available.
          • QueryName: "A"
          • DataSource: v3.DataSourceMetrics
          • AggregateAttribute: Specifies the k8s.volume.available metric.
            • Key: metricNamesForVolumes["available"]
            • DataType: v3.AttributeKeyDataTypeFloat64
          • Temporality: v3.Unspecified
          • Filters: Filters out entries where k8s.persistentvolumeclaim.name is empty.
            • Operator: "AND"
            • Items: A list containing a filter that ensures k8s.persistentvolumeclaim.name is not empty.
          • GroupBy: Groups the results by k8s.persistentvolumeclaim.name.
          • Expression: "A"
          • ReduceTo: v3.ReduceToOperatorLast
          • TimeAggregation: v3.TimeAggregationAvg
          • SpaceAggregation: v3.SpaceAggregationSum
          • Disabled: false
        • "B": Query for k8s.volume.capacity.
          • QueryName: "B"
          • DataSource: v3.DataSourceMetrics
          • AggregateAttribute: Specifies the k8s.volume.capacity metric.
            • Key: metricNamesForVolumes["capacity"]
            • DataType: v3.AttributeKeyDataTypeFloat64
          • Temporality: v3.Unspecified
          • Filters: Filters out entries where k8s.persistentvolumeclaim.name is empty.
            • Operator: "AND"
            • Items: A list containing a filter that ensures k8s.persistentvolumeclaim.name is not empty.
          • GroupBy: Groups the results by k8s.persistentvolumeclaim.name.
          • Expression: "B"
          • ReduceTo: v3.ReduceToOperatorLast
          • TimeAggregation: v3.TimeAggregationAvg
          • SpaceAggregation: v3.SpaceAggregationSum
          • Disabled: false
        • "F1": Query for calculated available space which equals k8s.volume.capacity - k8s.volume.available
          • QueryName: "F1"
          • DataSource: v3.DataSourceMetrics
          • Expression: "B - A"
          • Filters: Empty filter set.
          • ReduceTo: v3.ReduceToOperatorLast
        • "C": Query for k8s.volume.inodes.
          • QueryName: "C"
          • DataSource: v3.DataSourceMetrics
          • AggregateAttribute: Specifies the k8s.volume.inodes metric.
            • Key: metricNamesForVolumes["inodes"]
            • DataType: v3.AttributeKeyDataTypeFloat64
          • Temporality: v3.Unspecified
          • Filters: Filters out entries where k8s.persistentvolumeclaim.name is empty.
            • Operator: "AND"
            • Items: A list containing a filter that ensures k8s.persistentvolumeclaim.name is not empty.
          • GroupBy: Groups the results by k8s.persistentvolumeclaim.name.
          • Expression: "C"
          • ReduceTo: v3.ReduceToOperatorLast
          • TimeAggregation: v3.TimeAggregationAvg
          • SpaceAggregation: v3.SpaceAggregationSum
          • Disabled: false
        • "D": Query for k8s.volume.inodes_free.
          • QueryName: "D"
          • DataSource: v3.DataSourceMetrics
          • AggregateAttribute: Specifies the k8s.volume.inodes_free metric.
            • Key: metricNamesForVolumes["inodes_free"]
            • DataType: v3.AttributeKeyDataTypeFloat64
          • Temporality: v3.Unspecified
          • Filters: Filters out entries where k8s.persistentvolumeclaim.name is empty.
            • Operator: "AND"
            • Items: A list containing a filter that ensures k8s.persistentvolumeclaim.name is not empty.
          • GroupBy: Groups the results by k8s.persistentvolumeclaim.name.
          • Expression: "D"
          • ReduceTo: v3.ReduceToOperatorLast
          • TimeAggregation: v3.TimeAggregationAvg
          • SpaceAggregation: v3.SpaceAggregationSum
          • Disabled: false
        • "E": Query for k8s.volume.inodes_used.
          • QueryName: "E"
          • DataSource: v3.DataSourceMetrics
          • AggregateAttribute: Specifies the k8s.volume.inodes_used metric.
            • Key: metricNamesForVolumes["inodes_used"]
            • DataType: v3.AttributeKeyDataTypeFloat64
          • Temporality: v3.Unspecified
          • Filters: Filters out entries where k8s.persistentvolumeclaim.name is empty.
            • Operator: "AND"
            • Items: A list containing a filter that ensures k8s.persistentvolumeclaim.name is not empty.
          • GroupBy: Groups the results by k8s.persistentvolumeclaim.name.
          • Expression: "E"
          • ReduceTo: v3.ReduceToOperatorLast
          • TimeAggregation: v3.TimeAggregationAvg
          • SpaceAggregation: v3.SpaceAggregationSum
          • Disabled: false
      • PanelType: v3.PanelTypeTable specifies the visualization as a table.
      • QueryType: v3.QueryTypeBuilder indicates a composite query.
    • Version: "v4" specifies the version of the query structure.
    • FormatForWeb: true indicates that the query results should be formatted for web display.
  1. Code Examples

Not applicable, as the file primarily defines a data structure.

Include in Getting Started: NO