Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/ecto_psql_extras.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ defmodule EctoPSQLExtras do
@callback info :: %{
required(:title) => binary,
required(:columns) => [%{name: atom, type: atom}],
required(:parameters) => [
%{
required(:name) => atom,
required(:type) => atom,
optional(:default) => term,
optional(:description) => binary
}
],
optional(:order_by) => [{atom, :asc | :desc}],
optional(:index) => integer,
optional(:default_args) => list,
Expand Down
3 changes: 2 additions & 1 deletion lib/queries/all_locks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ defmodule EctoPSQLExtras.AllLocks do
%{name: :query_snippet, type: :string},
%{name: :mode, type: :string},
%{name: :age, type: :interval}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/bloat.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule EctoPSQLExtras.Bloat do
%{name: :object_name, type: :string},
%{name: :bloat, type: :numeric},
%{name: :waste, type: :bytes}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/blocking.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule EctoPSQLExtras.Blocking do
%{name: :blocking_pid, type: :integer},
%{name: :blocked_statement, type: :string},
%{name: :blocked_duration, type: :interval}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/cache_hit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ defmodule EctoPSQLExtras.CacheHit do
columns: [
%{name: :name, type: :string},
%{name: :ratio, type: :numeric}
]
],
parameters: []
}
end

Expand Down
8 changes: 8 additions & 0 deletions lib/queries/calls.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ defmodule EctoPSQLExtras.Calls do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/calls_17.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ defmodule EctoPSQLExtras.Calls17 do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/calls_legacy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ defmodule EctoPSQLExtras.CallsLegacy do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
3 changes: 2 additions & 1 deletion lib/queries/connections.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ defmodule EctoPSQLExtras.Connections do
%{name: :username, type: :string},
%{name: :client_address, type: :string},
%{name: :application_name, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/db_settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.DbSettings do
%{name: :setting, type: :string},
%{name: :unit, type: :string},
%{name: :short_desc, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/diagnose.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.Diagnose do
%{name: :ok, type: :boolean},
%{name: :check_name, type: :string},
%{name: :message, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/duplicate_indexes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule EctoPSQLExtras.DuplicateIndexes do
%{name: :idx2, type: :string},
%{name: :idx3, type: :string},
%{name: :idx4, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/extensions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ defmodule EctoPSQLExtras.Extensions do
%{name: :default_version, type: :string},
%{name: :installed_version, type: :string},
%{name: :comment, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/index_cache_hit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ defmodule EctoPSQLExtras.IndexCacheHit do
%{name: :block_reads, type: :integer},
%{name: :total_read, type: :integer},
%{name: :ratio, type: :numeric}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/index_size.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.IndexSize do
%{name: :schema, type: :string},
%{name: :name, type: :string},
%{name: :size, type: :bytes}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/index_usage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.IndexUsage do
%{name: :name, type: :string},
%{name: :percent_of_times_index_used, type: :numeric},
%{name: :rows_in_table, type: :int}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/indexes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.Indexes do
%{name: :indexname, type: :string},
%{name: :tablename, type: :string},
%{name: :columns, type: :string}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/kill_all.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ defmodule EctoPSQLExtras.KillAll do
title: "Kill all the active database connections",
columns: [
%{name: :killed, type: :boolean}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/locks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ defmodule EctoPSQLExtras.Locks do
%{name: :query_snippet, type: :string},
%{name: :mode, type: :string},
%{name: :age, type: :interval}
]
],
parameters: []
}
end

Expand Down
8 changes: 8 additions & 0 deletions lib/queries/long_running_queries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ defmodule EctoPSQLExtras.LongRunningQueries do
%{name: :pid, type: :int},
%{name: :duration, type: :interval},
%{name: :query, type: :string}
],
parameters: [
%{
name: :threshold,
type: :string,
default: "500 milliseconds",
description: "Minimum query duration."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/null_indexes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ defmodule EctoPSQLExtras.NullIndexes do
%{name: :indexed_column, type: :string},
%{name: :null_frac, type: :string},
%{name: :expected_saving, type: :string}
],
parameters: [
%{
name: :min_relation_size_mb,
type: :integer,
default: 0,
description: "Minimum relation size in megabytes."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/outliers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ defmodule EctoPSQLExtras.Outliers do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/outliers_17.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ defmodule EctoPSQLExtras.Outliers17 do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
8 changes: 8 additions & 0 deletions lib/queries/outliers_legacy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ defmodule EctoPSQLExtras.OutliersLegacy do
%{name: :prop_exec_time, type: :percent},
%{name: :calls, type: :integer},
%{name: :sync_io_time, type: :interval}
],
parameters: [
%{
name: :limit,
type: :integer,
default: 10,
description: "Maximum queries to return."
}
]
}
end
Expand Down
3 changes: 2 additions & 1 deletion lib/queries/records_rank.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.RecordsRank do
%{name: :schema, type: :string},
%{name: :name, type: :string},
%{name: :estimated_count, type: :integer}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/seq_scans.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.SeqScans do
%{name: :schema, type: :string},
%{name: :name, type: :string},
%{name: :count, type: :integer}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/ssl_used.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ defmodule EctoPSQLExtras.SSLUsed do
index: 9,
columns: [
%{name: :ssl_is_used, type: :boolean}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/table_cache_hit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ defmodule EctoPSQLExtras.TableCacheHit do
%{name: :block_reads, type: :integer},
%{name: :total_read, type: :integer},
%{name: :ratio, type: :numeric}
]
],
parameters: []
}
end

Expand Down
8 changes: 8 additions & 0 deletions lib/queries/table_foreign_keys.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ defmodule EctoPSQLExtras.TableForeignKeys do
def info do
%{
title: "Foreign keys info",
default_args: [table_name: nil],
columns: [
%{name: :table_name, type: :string},
%{name: :constraint_name, type: :string},
%{name: :column_name, type: :string},
%{name: :foreign_table_name, type: :string},
%{name: :foreign_column_name, type: :string}
],
parameters: [
%{
name: :table_name,
type: :string,
description: "Filter foreign keys by table name. Omit to search all tables."
}
]
}
end
Expand Down
3 changes: 2 additions & 1 deletion lib/queries/table_indexes_size.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.TableIndexesSize do
%{name: :schema, type: :string},
%{name: :table, type: :string},
%{name: :index_size, type: :bytes}
]
],
parameters: []
}
end

Expand Down
8 changes: 8 additions & 0 deletions lib/queries/table_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ defmodule EctoPSQLExtras.TableSchema do
def info do
%{
title: "Column names and types",
default_args: [table_name: nil],
columns: [
%{name: :column_name, type: :string},
%{name: :data_type, type: :string},
%{name: :is_nullable, type: :boolean},
%{name: :column_default, type: :string},
%{name: :table_name, type: :string}
],
parameters: [
%{
name: :table_name,
type: :string,
description: "Filter results by table name. Omit to search all tables."
}
]
}
end
Expand Down
3 changes: 2 additions & 1 deletion lib/queries/table_size.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule EctoPSQLExtras.TableSize do
%{name: :schema, type: :string},
%{name: :name, type: :string},
%{name: :size, type: :bytes}
]
],
parameters: []
}
end

Expand Down
3 changes: 2 additions & 1 deletion lib/queries/total_index_size.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ defmodule EctoPSQLExtras.TotalIndexSize do
index: 13,
columns: [
%{name: :size, type: :bytes}
]
],
parameters: []
}
end

Expand Down
Loading
Loading