Home / Function/ getPgStatMonitorLogsQuery() — supabase Function Reference

getPgStatMonitorLogsQuery() — supabase Function Reference

Architecture documentation for the getPgStatMonitorLogsQuery() function in QueryPerformance.constants.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  52ebd51a_00f5_f874_a337_97608d009760["getPgStatMonitorLogsQuery()"]
  8afea200_94fd_d6c2_5605_0880960a2b8b["WithMonitor()"]
  8afea200_94fd_d6c2_5605_0880960a2b8b -->|calls| 52ebd51a_00f5_f874_a337_97608d009760
  style 52ebd51a_00f5_f874_a337_97608d009760 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts lines 106–128

export const getPgStatMonitorLogsQuery = (startTime: string, endTime: string) =>
  `
select 
  id,
  pgl.timestamp as timestamp,
  'postgres' as log_type,
  CAST(pgl_parsed.sql_state_code AS STRING) as status,
  CASE
      WHEN pgl_parsed.error_severity = 'LOG' THEN 'success'
      WHEN pgl_parsed.error_severity = 'WARNING' THEN 'warning'
      WHEN pgl_parsed.error_severity = 'FATAL' THEN 'error'
      WHEN pgl_parsed.error_severity = 'ERROR' THEN 'error'
      ELSE null
  END as level,
  event_message as event_message
from postgres_logs as pgl
cross join unnest(pgl.metadata) as pgl_metadata
cross join unnest(pgl_metadata.parsed) as pgl_parsed
WHERE pgl.event_message LIKE '%[pg_stat_monitor]%'
  AND pgl.timestamp >= CAST('${startTime}' AS TIMESTAMP)
  AND pgl.timestamp <= CAST('${endTime}' AS TIMESTAMP)
ORDER BY timestamp DESC
`.trim()

Subdomains

Called By

Frequently Asked Questions

What does getPgStatMonitorLogsQuery() do?
getPgStatMonitorLogsQuery() is a function in the supabase codebase.
What calls getPgStatMonitorLogsQuery()?
getPgStatMonitorLogsQuery() is called by 1 function(s): WithMonitor.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free