Skip to content

improve(go.d/proxysql): add hostgroup summary metrics#21549

Merged
ilyam8 merged 2 commits intonetdata:masterfrom
ilyam8:go.d-proxysql-hostgroup
Jan 13, 2026
Merged

improve(go.d/proxysql): add hostgroup summary metrics#21549
ilyam8 merged 2 commits intonetdata:masterfrom
ilyam8:go.d-proxysql-hostgroup

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Jan 12, 2026

Summary

This PR:

  1. Adding hostgroup as a label to all backend charts for better grouping and filtering
  2. Adding new per-hostgroup metrics that show the count of backends in each state (ONLINE, SHUNNED, OFFLINE_SOFT, OFFLINE_HARD)
Test Plan
Additional Information
For users: How does this change affect me?

Summary by cubic

Adds hostgroup-level summary metrics to the ProxySQL collector and labels all backend charts with hostgroup for easier grouping and filtering. Also exposes per-hostgroup counts of backends by status and manages charts dynamically as hostgroups change.

  • New Features
    • New chart: proxysql.hostgroup_backends_status (online, shunned, offline_soft, offline_hard), labeled by hostgroup.
    • Added hostgroup label to all backend charts.
    • Collector tracks hostgroups in cache and adds/removes hostgroup charts automatically.

Written for commit 2974dcd. Summary will update on new commits.

@github-actions github-actions bot added area/collectors Everything related to data collection collectors/go.d area/metadata Integrations metadata area/go labels Jan 12, 2026
@ilyam8 ilyam8 requested a review from Copilot January 12, 2026 22:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ProxySQL collector by adding hostgroup-level summary metrics to provide better visibility into backend server groupings and their health status.

Changes:

  • Added per-hostgroup metrics showing counts of backends in each status (ONLINE, SHUNNED, OFFLINE_SOFT, OFFLINE_HARD)
  • Added hostgroup label to all backend charts for improved filtering and grouping
  • Implemented dynamic hostgroup chart management using a cache-based approach

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
metadata.yaml Defines new hostgroup metric schema and adds hostgroup label to backend metrics
cache.go Introduces hostgroupCache struct and management methods for tracking hostgroups
collector.go Initializes the hostgroups cache map in the collector constructor
collect.go Implements logic to count backends per hostgroup by status and manages hostgroup chart lifecycle
charts.go Adds hostgroup chart templates and chart creation/removal methods; updates backend charts to include hostgroup label
collector_test.go Adds comprehensive test expectations for the new hostgroup metrics and validates chart-metric alignment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/go/plugin/go.d/collector/proxysql/charts.go">

<violation number="1" location="src/go/plugin/go.d/collector/proxysql/charts.go:654">
P2: `removeHostgroupCharts` matches hostgroups by a prefix that is missing the trailing `_`, so removing hostgroup `1` will also delete charts for hostgroup `10` and any other ID sharing that prefix.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@ilyam8 ilyam8 merged commit edffdbe into netdata:master Jan 13, 2026
116 checks passed
@ilyam8 ilyam8 deleted the go.d-proxysql-hostgroup branch January 13, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection area/go area/metadata Integrations metadata collectors/go.d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants