Skip to content

feat: Add connection/worker tracking and standardize metric tags#15

Merged
elchinoo merged 4 commits intomainfrom
v2-redesign-core
Aug 6, 2025
Merged

feat: Add connection/worker tracking and standardize metric tags#15
elchinoo merged 4 commits intomainfrom
v2-redesign-core

Conversation

@elchinoo
Copy link
Copy Markdown
Owner

@elchinoo elchinoo commented Aug 6, 2025

Summary

This PR enhances the StormDB plugin system with comprehensive connection/worker tracking and standardizes metric tag structures for consistent analysis.

Key Features

🔧 Database Schema Enhancement

  • New Migration 004: Adds active_connections and active_workers columns to test_run_result table
  • Optimized Indexes: New indexes for efficient querying by connection and worker counts
  • Documentation: Clear comments explaining the purpose of new fields

📊 Core System Updates

  • Enhanced TestResult struct: Added optional ActiveConnections and ActiveWorkers fields
  • Updated StorageManager: Handles new fields in all CRUD operations with proper null handling
  • Backward compatibility: Existing data continues to work seamlessly

🏷️ Standardized Tag Structure

Previously, metrics had inconsistent tag structures making analysis difficult. Now all metrics include:

  • metric_type: Type of measurement (e.g., 'cumulative_tps', 'avg_latency_ms')
  • iteration: Background save iteration (null for final results)
  • connections: Number of database connections
  • batch_size: Batch size (null for TPCC metrics)
  • total_transactions: Total transaction count
  • total_rows: Total rows processed (null for TPCC)
  • batch_count: Number of batches (null for TPCC)
  • test_phase: 'measurement' or 'final_results'

TPCC-specific additions:

  • scale_factor: TPC-C scale factor
  • transaction_type: Type of TPC-C transaction

🔄 Enhanced Plugin Functionality

Bulk-Load Plugin

  • Real-time tracking: Monitors active connections and workers during execution
  • Background metrics: Enhanced with connection/worker information
  • Consistent tagging: All metrics follow the standardized structure

TPCC-Scalability Plugin

  • Connection correlation: Links performance to connection levels
  • Worker tracking: Monitors worker thread activity
  • Standardized output: Consistent tag structure across all metrics

Impact

Before

-- Inconsistent tag structures made analysis difficult
{"batch_size": 100, "connections": 10, "metric_type": "avg_latency_ms"}
{"iteration": 264, "total_rows": 17844837, "connections": 10, "metric_type": "cumulative_row_rate"}
{"connections": 48, "metric_type": "total_transactions", "test_phase": "measurement"}

After

-- Consistent structure enables easy analysis
{"metric_type": "avg_latency_ms", "iteration": null, "connections": 10, "batch_size": 100, "total_transactions": 1000, "total_rows": 100000, "batch_count": 2, "test_phase": "final_results"}
{"metric_type": "cumulative_row_rate", "iteration": 264, "connections": 10, "batch_size": null, "total_transactions": 343716, "total_rows": 17844837, "batch_count": 2, "test_phase": "measurement"}

Testing

  • ✅ All code compiles successfully
  • ✅ Both plugins build without errors
  • ✅ Core StormDB application builds successfully
  • ✅ Database schema migration ready for deployment

Migration Required

After merging, run the new migration:

-- This will be applied automatically by the migration system
-- migrations/004_add_connection_worker_tracking.sql

Resolves the metrics inconsistency issues and provides comprehensive connection/worker tracking for better performance analysis.

…f hardcoded values

CRITICAL FIX: Plugins were using hardcoded metric IDs (1, 7) which may not exist
in the database, causing silent failures in result storage.

Changes:
- Both bulk-load and tpcc-scalability plugins now properly look up metric IDs
  from database using GetMetric() instead of hardcoded values
- Added comprehensive debug logging to trace data flow
- Enhanced error handling in StoreResults with detailed logging
- Added validation that results are actually being stored

This ensures that test metrics are properly persisted to the database
instead of silently failing due to invalid metric references.
- Add backgroundMetricsSaver goroutine to both bulk-load and tpcc-scalability plugins
- Metrics are now saved to database every second during test execution
- Added comprehensive logging to track metrics collection and storage
- Ensures real-time data persistence instead of only saving at test end
- Thread-safe implementation with proper context cancellation
- Add migration 004 to include active_connections and active_workers columns in test_run_result table
- Update TestResult struct to include optional ActiveConnections and ActiveWorkers fields
- Enhance StorageManager to handle new connection/worker fields in StoreResults and GetResults
- Standardize tag structure across both plugins for consistent analysis:
  * All metrics now include: metric_type, iteration, connections, batch_size, total_transactions, total_rows, batch_count, test_phase
  * Use null values for non-applicable fields to maintain consistency
  * Add scale_factor for TPCC metrics and transaction_type for transaction counts
- Update bulk-load plugin to track active connections and workers in all metrics
- Update tpcc-scalability plugin with consistent tag structure and connection/worker tracking
- Improve background metrics collection with real-time worker and connection statistics

This ensures all metrics have consistent structure for easier analysis and querying.
@elchinoo elchinoo merged commit 864ecf5 into main Aug 6, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant