Cost Query Engine

BETA FEATURE - Cost Query Engine is fully functional but interface may evolve based on feedback.


Overview

Cost Query Engine enables advanced workload cost analysis through interactive filters:

  • Filter Builder - Build complex queries with visual filter selection
  • Multi-dimensional Analysis - Filter by cluster, namespace, workload type, cost, efficiency, labels
  • Saved Queries - Save and reload filter combinations
  • Visual Analytics - Cost trends, resource distribution charts, comparisons
  • Export Results - Download filtered data as CSV

Philosophy: "Answer any cost question with visual filters, no SQL required."

Access: Select cluster (Clusters page or sidebar dropdown) → Cost Query Engine


Filter Types

Infrastructure Filters:

  • Cluster - Filter by specific clusters
  • Namespace - Limit results to namespaces
  • Environment - Production, staging, development
  • Architecture - amd64, arm64

Workload Filters:

  • Workload Type - Deployment, StatefulSet, DaemonSet, Job
  • HPA Status - Enabled or disabled autoscaling
  • Labels - Filter by Kubernetes labels (key-value pairs)

Cost & Efficiency Filters:

  • Cost Range - Minimum and maximum monthly cost
  • Efficiency Range - Filter by resource efficiency percentage (0-100%)

Search & Sort:

  • Search by workload name, cluster, or namespace
  • Sort by cost, efficiency, replicas, or name
  • Ascending or descending order

Building Queries

Step 1: Add Filters

  1. Click "Add Filter" button
  2. Select filter type from dropdown
  3. Configure values (multi-select for most types)
  4. Click "Add to Query"
  5. Filter appears in "Pending Filters" badge

Step 2: Run Query

  1. Review pending filters
  2. Click "Run Query" button
  3. Results appear in active tab

Step 3: Refine Results

  • Add more filters to narrow results
  • Remove filters by clicking X icon
  • Use search bar for quick name filtering

Tabs

Overview:

  • Cost trend chart (daily costs over time)
  • Resource distribution pie chart (CPU, Memory, Storage)
  • Summary statistics (total cost, potential savings)

Workloads:

  • Detailed workload table with filtered results
  • Columns: Name, Cluster, Namespace, Type, Cost, Efficiency
  • Pagination with configurable items per page
  • Click workload name to view details

Charts:

  • Interactive visualizations of filtered data
  • Bar charts, pie charts, area charts
  • Customizable dimensions and metrics

Compare:

  • Save filter sets as "Comparison Sets"
  • Side-by-side comparison of different filter combinations
  • Identify cost differences between environments or teams

Saved Queries

Save Current Query:

  1. Configure desired filters
  2. Click "Save Query" button
  3. Enter query name
  4. Query saved to browser localStorage

Load Saved Query:

  1. Click "Load Query" button
  2. Select from saved queries list
  3. Filters automatically applied
  4. Click "Run Query" to execute

Delete Query:

  • Click trash icon next to saved query name

Export

Export to CSV:

  1. Run query with desired filters
  2. Click "Export" button
  3. Select "Download CSV"
  4. File includes all filtered workloads with full details

Export includes:

  • Workload name, cluster, namespace, type
  • CPU, memory, storage costs
  • Efficiency metrics
  • Labels and metadata

Common Workflows

Find Expensive Workloads in Production:

  1. Add filter: Environment = "production"
  2. Add filter: Cost Range > $1000/month
  3. Run Query
  4. Sort by cost descending
  5. Review top results in Workloads tab

Compare Team Costs:

  1. Add filter: Label = "team:backend"
  2. Run Query and save as "Backend Team"
  3. Clear filters
  4. Add filter: Label = "team:frontend"
  5. Run Query and save as "Frontend Team"
  6. Navigate to Compare tab to see side-by-side

Identify Low Efficiency Workloads:

  1. Add filter: Efficiency Range = 0-50%
  2. Add filter: Workload Type = "Deployment"
  3. Run Query
  4. Export results for optimization review