Skip to content

Cherry-pick #18955 to 7.x: Add MySQL query metricset with lightweight module and SQL helper#19847

Merged
sayden merged 1 commit intoelastic:7.xfrom
sayden:backport_18955_7.x
Jul 13, 2020
Merged

Cherry-pick #18955 to 7.x: Add MySQL query metricset with lightweight module and SQL helper#19847
sayden merged 1 commit intoelastic:7.xfrom
sayden:backport_18955_7.x

Conversation

@sayden
Copy link
Copy Markdown
Contributor

@sayden sayden commented Jul 13, 2020

Cherry-pick of PR #18955 to 7.x branch. Original message:

What does this PR do?

This PR adds a SQL helper (at Metricbeat level) with logic to execute SQL queries and return their results. The module can use this abstraction layer to simply pass in the SQL driver and the queries they need to execute to later create Beats events.

This PR introduce:

  • Major changes in sql module.
  • Completely new SQL helper with refactored code from sql module.
  • query Metricset in MySQL module which uses the SQL helper. This Metricset is to use it as a Lightweight "parent" module.
  • performance metricset using the query metricset as Lightweight parent module. Use it as a guidance about how to make it work.
  • overview metricset with a bunch of key metrics, also using Lightweight modules. This is the metricset to remove of this PR. Removed
  • Rework of the SQL module to use the SQL helper too. Basically the code from sql module was moved to the sql helper.

Why is it important?

The way the sql was working was a bit limited compared to the underlying power it has. Moving it one layer up from the modules, allows the use of its logic by any module while maintaining each module functionality regarding specific DSN or security, for example, instead of introducing all that logic into the sql module.

The way it works now also allows to create metricsets on CockroachDB module using lightweight modules.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Related issues

Fixes: #18898
Implements: #15048

@sayden sayden added [zube]: In Review backport Team:Services (Deprecated) Label for the former Integrations-Services team labels Jul 13, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 13, 2020
@sayden sayden self-assigned this Jul 13, 2020
@sayden sayden merged commit e0235ae into elastic:7.x Jul 13, 2020
@sayden sayden deleted the backport_18955_7.x branch October 29, 2021 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Team:Services (Deprecated) Label for the former Integrations-Services team [zube]: Done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants