SQL extensions: Query behind a metric

Summary

This troubleshooting guide will help you look up the SQL query that is running to pull data for a particular metric for a SQL extension.

Problem

When working with metric data generated by a SQL extension sometimes it’s useful to know the SQL query that generated the metrics to understand that data batter.

Troubleshooting steps

  1. Go to HUB tile → Download (Release Notes / expand version → Download Version). Read file extension.zip/extension.yaml from the zip file.
  2. Find sql* section (sqlOracle, sqlPostgres etc)
  3. Look in the extension.yaml for a metric key. It will be besides a specific query. For example:
interval: 
    minutes: var:query-interval 
    query: > 
      SELECT  
            CONT.NAME, 
            CAST(CONT.OPEN_TIME AS DATE) AS OPEN_TIME_CASTED, 
            CONT.OPEN_MODE, 
            CONT.RESTRICTED, 
            INST.INSTANCE_NAME, 
            CDB.CDB_NAME 
        FROM 
            GV$CONTAINERS CONT 
            JOIN GV$INSTANCE INST ON INST.INST_ID = CONT.INST_ID 
            CROSS JOIN (SELECT sys_context('USERENV', 'CDB_NAME') as CDB_NAME FROM DUAL) CDB 
    metrics: 
      - key: com.dynatrace.extension.sql-oracle.database_topology 
        value: const:1
5 Likes

Nice tip! :money_mouth_face: