Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Jan 8, 2026

Summary

This fixes how the ProxySQL go.d collector derives per-backend status_* metrics from stats_mysql_connection_pool.

  • ProxySQL returns status as a string (e.g. ONLINE, SHUNNED, OFFLINE_SOFT, OFFLINE_HARD), but the collector was comparing it to numeric codes ("1".."4"), causing all status metrics to be reported as 0.

  • Update the collector to set backend_*_status_<STATE> based on value == <STATE> for the known states.

Test Plan
Additional Information
For users: How does this change affect me?

Summary by cubic

Fixes ProxySQL backend status mapping in the go.d collector. Status metrics now match the string states returned by ProxySQL, fixing the 0-only values.

  • Bug Fixes
    • Compare status to string states: ONLINE, SHUNNED, OFFLINE_SOFT, OFFLINE_HARD.
    • Emit backend_status_ using a simple loop (1 when matched, else 0).
    • Update tests and v2.0.10 test data to reflect real status values.

Written for commit f9f5aa6. Summary will update on new commits.

@github-actions github-actions bot added area/collectors Everything related to data collection collectors/go.d area/go labels Jan 8, 2026
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.

No issues found across 3 files

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 fixes a bug in the ProxySQL go.d collector where backend status metrics were incorrectly mapped. The collector was comparing ProxySQL's string status values (e.g., "ONLINE", "SHUNNED") against numeric codes ("1"-"4"), causing all status metrics to incorrectly report as 0.

Key Changes:

  • Updated status comparison logic to match string values instead of numeric codes
  • Corrected test expectations to reflect accurate status reporting
  • All four status states (ONLINE, SHUNNED, OFFLINE_SOFT, OFFLINE_HARD) now properly detected

Reviewed changes

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

File Description
src/go/plugin/go.d/collector/proxysql/collect.go Changed status comparison from numeric codes to string matching using a loop over known states
src/go/plugin/go.d/collector/proxysql/collector_test.go Updated test expectations so status metrics now correctly show 1 when matched (instead of always 0)

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

@ilyam8 ilyam8 enabled auto-merge (squash) January 8, 2026 17:01
@ilyam8 ilyam8 merged commit 8ea58d7 into netdata:master Jan 8, 2026
121 checks passed
@ilyam8 ilyam8 deleted the fix-go.d-proxysql-backend-status branch January 8, 2026 17:46
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
@stelfrag stelfrag mentioned this pull request Jan 9, 2026
Ferroin pushed a commit that referenced this pull request Jan 12, 2026
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 collectors/go.d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants