Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Nov 10, 2025

Summary

Fixes #13659

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

@ilyam8 ilyam8 requested a review from Copilot November 10, 2025 11:50
@github-actions github-actions bot added area/collectors Everything related to data collection collectors/go.d area/go labels Nov 10, 2025
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 introduces a new generic SQL collector module for Netdata that enables monitoring of MySQL, PostgreSQL, and Oracle databases through custom SQL queries. The collector provides a flexible framework for executing arbitrary SQL queries and converting results into Netdata metrics with dynamic chart generation.

Key changes:

  • New SQL collector supporting MySQL, PostgreSQL, and Oracle drivers with configurable connection pooling
  • Dynamic chart generation based on query results with customizable metadata
  • DSN redaction functionality to protect sensitive credentials in logs

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/go/plugin/go.d/collector/sql/collector.go Main collector implementation with lifecycle methods and default configuration
src/go/plugin/go.d/collector/sql/config.go Configuration structures for database connection, queries, and chart metadata
src/go/plugin/go.d/collector/sql/driver.go Driver imports and supported drivers registry
src/go/plugin/go.d/collector/sql/init.go Configuration validation logic
src/go/plugin/go.d/collector/sql/collect.go Core collection logic, database operations, and DSN redaction utility
src/go/plugin/go.d/collector/sql/charts.go Dynamic chart creation based on query configuration
src/go/plugin/go.d/collector/sql/collector_test.go Tests for DSN redaction functionality
src/go/plugin/go.d/collector/init.go Module registration in the global collector registry

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

@ktsaou
Copy link
Member

ktsaou commented Nov 10, 2025

@cubic-dev-ai review this PR

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Nov 10, 2025

@cubic-dev-ai review this PR

@ktsaou I've started the AI code review. It'll take a few minutes to complete.

Copy link

@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.

2 issues found across 9 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="src/go/plugin/go.d/collector/sql/collect.go">

<violation number="1" location="src/go/plugin/go.d/collector/sql/collect.go:94">
A single parse failure marks this metric as permanently skipped, so later valid values are never collected. Drop or reset the skip flag instead of leaving it true for the lifetime of the collector.</violation>
</file>

<file name="src/go/plugin/go.d/collector/sql/driver.go">

<violation number="1" location="src/go/plugin/go.d/collector/sql/driver.go:14">
The supportedDrivers entry &quot;postgres&quot; does not match the driver name registered by github.com/jackc/pgx/v5/stdlib (&quot;pgx&quot;). A config that passes verifyConfig will still hit sql.Open(&quot;postgres&quot;, ...) and fail with an unknown driver error. Update the key to the actual driver name or register the alias.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@github-actions github-actions bot added the area/metadata Integrations metadata label Nov 13, 2025
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.

[Feat]: A generic "sql-query" collector

2 participants