Skip to content

Commit

Permalink
Issue #68: Add the support for SQL connectors
Browse files Browse the repository at this point in the history
* Renamed SQL to SQL/JDBC in TechnologyType description.
* Updated integration tests to check the database tag and
  MySQL connector page.
  • Loading branch information
NassimBtk committed Nov 27, 2024
1 parent 4337b04 commit 640cf3d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ metrics:
type: Gauge
unit: s
db.queries:
description: The total number of statements executed by the server, including statements within stored programs but excluding `COM_PING` and `COM_STATISTICS` commands.
description: The total number of statements executed by the server.
type: Counter
unit: "{statement}"
db.tables:
description: The total number of tables in the database.
type: Gauge
unit: "{table}"

Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ monitors:
attributes:
id: $1
db.version: $2
db.tables: $3
metrics:
db.tables: $3
db.aborted_connections{reason="client_disconnected"}: $4
db.aborted_connections{reason="failed_attempt"}: $5
db.io.{db.io.direction="received"}: $6
Expand Down
17 changes: 16 additions & 1 deletion src/it/metricshub-connectors/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ assert htmlText.indexOf("WBEMGenDiskNT") > -1 : "metricshub-connectors-directory
assert htmlText.indexOf("WBEMGenHBA") > -1 : "metricshub-connectors-directory: WBEMGenHBA must be listed"
assert htmlText.indexOf("WBEMGenLUN") > -1 : "metricshub-connectors-directory: WBEMGenLUN must be listed"
assert htmlText.indexOf("WBEMGenNetwork") > -1 : "metricshub-connectors-directory: WBEMGenNetwork must be listed"
assert htmlText.indexOf("MySQL") > -1 : "metricshub-connectors-directory: MySQL must be listed"

// Check generated reference files
String directoryPath = 'target/site/connectors'
Expand All @@ -56,7 +57,8 @@ String [] fileNamesToCheck = [
'wbemgenhba.html',
'wbemgenlun.html',
'wbemgennetwork.html',
'winstoragespaces.html'
'winstoragespaces.html',
'mysql.html'
]

fileNamesToCheck.each { fileName ->
Expand All @@ -74,6 +76,7 @@ String [] tagsFileNamesToCheck = [
'vm.html',
'hyper-v.html',
'hardware.html',
'database.html',
]

String [] hardwareConnectors = [
Expand Down Expand Up @@ -257,3 +260,15 @@ assert htmlText.indexOf("Windows Storage Spaces") > -1 : "WinStoreSpaces: Unexpe
assert htmlText.indexOf("WMI/WinRM") > -1 : "WinStoreSpaces: Unexpected Technology and protocols"
assert htmlText.indexOf("<code>root\\Microsoft\\Windows\\Storage</code>") > -1 : "WinStoreSpaces: Unexpected namespaces"
assert htmlText.indexOf("metricshub HOSTNAME -t storage -c +WinStorageSpaces --wmi -u USER") > -1 : "WinStoreSpaces: Page must indicate the expected CLI example."

// MySQL
htmlText = new File(basedir, "target/site/connectors/mysql.html").text
assert htmlText.indexOf("Any platform running MySQL") > -1 : "MySQL: Unexpected Typical platform"
assert htmlText.indexOf("Microsoft Windows, Linux") > -1 : "MySQL: Unexpected Operating Systems"
assert htmlText.indexOf("MySQL Database") > -1 : "MySQL: Unexpected Leverages"
assert htmlText.indexOf("SQL/JDBC") > -1 : "MySQL: Unexpected Technology and protocols"
assert htmlText.indexOf("metricshub HOSTNAME -t win -c +MySQL --jdbc -u USER --jdbc-url URL") > -1 : "MySQL: Page must indicate the expected CLI example."
assert htmlText.indexOf("<code>SELECT @@version_comment REGEXP 'mysql' AS is_mysql;</code>") > -1 : "MySQL: Page must indicate the activation criterion."
assert htmlText.indexOf("Expected Result:") > -1 : "MySQL: Page must indicate the Expected Result message."
assert htmlText.indexOf("<code>1</code>") > -1 : "MySQL: Page must indicate the expected result value."
assert htmlText.indexOf('<h3 id="metrics">Metrics</h3>') > - 1 : "MySQL: Page must indicate 'Metrics' as HTML H3 element"
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public enum TechnologyType {
WMI("WMI/WinRM"),

/**
* SQL
* SQL through JDBC
*/
SQL("SQL");
SQL("SQL/JDBC");

@Getter
private String displayName;
Expand Down

0 comments on commit 640cf3d

Please sign in to comment.