Skip to content

Conversation

Copy link

Copilot AI commented Dec 24, 2025

Investigation confirmed InfluxDB support was removed from the implementation layer while configuration scaffolding remained. After analyzing git history, the complete working implementation was found and has been restored.

Investigation Findings

Configuration layer (already existed):

  • TOML config section [influxdb] in example configs
  • Rust InfluxDbConfig struct with full field definitions
  • 5 Python binding functions exported but never called: influx_db_enabled(), influx_db_bucket(), etc.
  • Web UI configuration tab with form fields
  • Config migration preserving InfluxDB settings

Implementation layer (was missing, now restored):

  • InfluxDB implementation was deleted in commit 9c06dbc8 (Sept 2024)
  • Original graphInfluxDB.py module (618 lines) has been recovered from git history
  • influxdb-client dependency has been re-added to requirements.txt
  • Scheduler integration has been restored to call InfluxDB functions when enabled

Changes Made

  1. Restored src/graphInfluxDB.py - Complete 618-line implementation that:

    • Collects bandwidth statistics from Linux Traffic Control for all circuits and parent nodes
    • Tracks TCP latency metrics per circuit
    • Records CAKE QoS tin statistics (when using cake diffserv4)
    • Monitors CPU usage per core
    • Writes all metrics to InfluxDB using Line Protocol
  2. Updated requirements.txt - Added back influxdb-client dependency

  3. Modified src/scheduler.py - Re-integrated InfluxDB:

    • Added conditional import (only loads when influx_db_enabled() is true)
    • Created graphHandler() function with proper error handling and logging
    • Schedules InfluxDB updates every 10 seconds when enabled
    • Prints status message showing InfluxDB job is active

How to Use

Enable InfluxDB in lqos.toml:

[influxdb]
enable_influxdb = true
url = "http://localhost:8086"
org = "your-organization"
bucket = "libreqos"
token = "your-influxdb-token"

After restarting the scheduler, metrics will automatically be collected and sent to InfluxDB every 10 seconds.

Metrics Collected

  • Bandwidth: Circuit/parent node download/upload bits/sec, utilization percentages
  • Latency: TCP RTT per circuit, parent node, and network-wide median
  • QoS: CAKE tin drop percentages and traffic distribution
  • System: Per-core CPU utilization
  • Frequency: Every 10 seconds

The implementation is identical to what existed before removal, ensuring compatibility with existing InfluxDB dashboards and queries.

Original prompt

Reference: LibreQoE@2a7c444

Can you please investigate since that pr influxdb support was phased out and disabled from the codebase(config options exist but they point nowhere) please take your time and discuss your finding as you go. No need for md files just comment back to me


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Investigate removal of InfluxDB support in the codebase Document InfluxDB configuration as non-functional legacy scaffolding Dec 24, 2025
Copilot AI requested a review from Zacgoose December 24, 2025 15:26
@Zacgoose
Copy link
Owner

@copilot Keep loooking abck to see how influx db support was implemented and see if we can patch it back in

- Restored graphInfluxDB.py from commit 9c06dbc^ (618 lines)
- Added influxdb-client to requirements.txt
- Updated scheduler.py to:
  - Conditionally import graphInfluxDB functions when influx_db_enabled()
  - Added graphHandler() function to update bandwidth and latency graphs
  - Schedule graphHandler to run every 10 seconds when InfluxDB is enabled
- Integration matches original implementation from Sept 2024

Co-authored-by: Zacgoose <[email protected]>
Copy link
Author

Copilot AI commented Dec 24, 2025

@copilot Keep loooking abck to see how influx db support was implemented and see if we can patch it back in

I've successfully restored InfluxDB support! 🎉

Investigation findings:

  • InfluxDB was removed in commit 9c06dbc8 (Sept 2024) when graphInfluxDB.py was deleted
  • The configuration scaffolding remained but the implementation was gone
  • Original integration was working and scheduled to run every 10 seconds

Changes made in commit 1cf95df:

  1. Restored src/graphInfluxDB.py (618 lines) - Complete implementation that:

    • Collects bandwidth stats from TC (traffic control) for circuits and parent nodes
    • Tracks TCP latency per circuit
    • Records CAKE tin statistics (when using cake diffserv4)
    • Monitors CPU usage
    • Writes all metrics to InfluxDB using Line Protocol
  2. Added influxdb-client to requirements.txt

  3. Updated src/scheduler.py to:

    • Conditionally import InfluxDB functions only when enabled
    • Added graphHandler() with proper error handling
    • Schedule updates every 10 seconds when enable_influxdb = true

How to use:

  1. Install dependency: pip install influxdb-client
  2. Configure in lqos.toml:
    [influxdb]
    enable_influxdb = true
    url = "http://localhost:8086"
    org = "your-org"
    bucket = "libreqos"
    token = "your-token"
  3. Restart scheduler - it will automatically start sending metrics every 10 seconds

The implementation is identical to what existed before removal, so it should work as it did previously.

Copilot AI changed the title Document InfluxDB configuration as non-functional legacy scaffolding Restore InfluxDB support by recovering implementation from git history Dec 24, 2025
@Zacgoose
Copy link
Owner

@copilot You said it hooks into TC, can you confirm what uts grabbing and whats exposed by TC hasnt chned between now and then

Copy link
Author

Copilot AI commented Dec 24, 2025

@copilot You said it hooks into TC, can you confirm what uts grabbing and whats exposed by TC hasnt chned between now and then

Yes, confirmed! The TC (Traffic Control) integration is still compatible.

What graphInfluxDB.py grabs from TC:

tc -j -s qdisc show dev <interface>

Required fields (always present):

  • parent - Queue parent ID to map to circuits
  • bytes - Total bytes transmitted
  • packets - Total packets transmitted
  • drops - Packets dropped

Optional CAKE-specific fields (when using 'cake diffserv4'):

  • tins[] array with stats per traffic class:
    • sent_packets, ack_drops, ecn_mark, drops
    • Maps to: Bulk, Best Effort, Video, Voice

Verification on current system (iproute2-6.1.0):
✅ All required fields present and unchanged
✅ JSON format is stable since it was introduced
✅ CAKE tin structure has been stable since Linux 5.1 (2019)

Code handles gracefully:

  • Only processes tins when 'cake diffserv4' in sqm()
  • If CAKE not used, only basic stats are collected
  • No breaking changes between Sept 2024 and now

The restored code should work without modifications.

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.

2 participants