100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Add additional useful query exporter metric (#2741)
Rich Turnere4ea91998a9f
diff --git a/deployment/query-exporter/config.yaml b/deployment/query-exporter/config.yamlindex 5a7e5228c..2e8a2e507 100644--- a/deployment/query-exporter/config.yaml+++ b/deployment/query-exporter/config.yaml@@ -38,6 +38,14 @@ metrics:type: gaugedescription: Count of connections with state of idle in transaction+ pg_long_running_queries_count:+ type: gauge+ description: Count of queries that have been running for longer than 30 seconds++ pg_longest_query_duration_seconds:+ type: gauge+ description: Duration of the longest running query in seconds+pg_hot_update_percent:type: gaugelabels: [table_name]@@ -229,6 +237,19 @@ queries:(SELECT count(*) AS total_used FROM pg_stat_activity) active,(SELECT count(*) AS idle_in_xact_count FROM pg_stat_activity WHERE state = 'idle in transaction') idle_xact;+ long_running_queries:+ interval: 60 # 1 minute+ databases: [openremote]+ metrics: [pg_long_running_queries_count, pg_longest_query_duration_seconds]+ sql: |+ SELECT+ COUNT(*)::numeric AS pg_long_running_queries_count,+ COALESCE(EXTRACT(EPOCH FROM MAX(now() - query_start)), 0)::numeric AS pg_longest_query_duration_seconds+ FROM pg_stat_activity+ WHERE state = 'active'+ AND now() - query_start > interval '30 seconds'+ AND pid <> pg_backend_pid();+table_tuples:interval: 300 # 5 minutesdatabases: [openremote]