sentrysoftware / metricshub

Universal Metrics Collection for OpenTelemetry
https://metricshub.com
GNU Affero General Public License v3.0
15 stars 4 forks source link

Develop SQL Extension #422

Open NassimBtk opened 1 month ago

NassimBtk commented 1 month ago

Specification

JDBC SQL User's Configuration

metricshub.yaml

resources:
  db-host:
    attributes:
    # ...
    protocols:
      jdbc:
        username: #
        password: #
        url: #  
        timeout: # 
        type: # 
        port: # 
        database: #
Attribute Data Type Description Default Value
username string The username used to authenticate with the database. null
password char[] The password used for authentication (can be encrypted). null
url char[] The connection URL for the database (can be encrypted). null or generated based on type and database.
timeout int The time in seconds before a connection attempt times out. 120 seconds
type string The type of database engine (e.g., oracle, postgresql, mariadb, mssql, informix, derby, h2, ...). null
port int The port number to connect to the database. null or generated based on type
database string The database name to connect to. null

SQL Criterion

criteria:
- type: sql
  query: # 
  expectedResult: #
  errorMessage:
Attribute Key Data Type Description
type string Specifies the type of SQL criterion (sql).
query string The SQL query string to be executed (e.g., SELECT Column1, Column2 FROM TABLE).
expectedResult string The expected result in the SQL response
errorMessage string The error message to display in case of criterion failure

SQL Source

<source-name>:
   type: sql
   query: # 
Attribute Key Data Type Description
type string Specifies the type of SQL source (sql).
query string The SQL query string to be executed (e.g., SELECT Column1, Column2 FROM TABLE).

To differentiate the current source, which executes inner SQL queries using the internal MetricsHub DB engine, we should consider renaming the type of the inner SQL source to reflect its engine-based nature. A suitable option could be localSql.

NassimBtk commented 1 month ago

@bertysentry your thoughts! 😉