🌐 AI搜索 & 代理 主页
Skip to content

Commit d615014

Browse files
Added pg_index_pilot_config metric
1 parent 2479c30 commit d615014

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

config/pgwatch-prometheus/metrics.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,42 @@ metrics:
19621962
- is_valid
19631963
- estimated_tuples
19641964
- best_ratio
1965+
1966+
pg_index_pilot_config:
1967+
sqls:
1968+
12: |
1969+
select
1970+
coalesce(datname, '*') as tag_datname,
1971+
coalesce(schemaname, '*') as tag_schemaname,
1972+
coalesce(relname, '*') as tag_relname,
1973+
coalesce(indexrelname, '*') as tag_indexrelname,
1974+
key as tag_config_key,
1975+
case
1976+
when key = 'index_size_threshold' then
1977+
case
1978+
when value ~ '^[0-9]+MB$' then (regexp_replace(value, 'MB$', '')::numeric * 1024 * 1024)::bigint
1979+
when value ~ '^[0-9]+kB$' then (regexp_replace(value, 'kB$', '')::numeric * 1024)::bigint
1980+
when value ~ '^[0-9]+GB$' then (regexp_replace(value, 'GB$', '')::numeric * 1024 * 1024 * 1024)::bigint
1981+
else 0
1982+
end
1983+
when key = 'minimum_reliable_index_size' then
1984+
case
1985+
when value ~ '^[0-9]+kB$' then (regexp_replace(value, 'kB$', '')::numeric * 1024)::bigint
1986+
when value ~ '^[0-9]+MB$' then (regexp_replace(value, 'MB$', '')::numeric * 1024 * 1024)::bigint
1987+
else 0
1988+
end
1989+
when key = 'index_rebuild_scale_factor' then value::numeric
1990+
when key = 'reindex_history_retention_period' then
1991+
case when value ~ 'years?' then regexp_replace(value, ' years?', '')::int else 0 end
1992+
when key = 'skip' then case when value::boolean then 1 else 0 end
1993+
else 0
1994+
end as config_value_normalized,
1995+
value as tag_config_value_raw
1996+
from index_pilot.config_settings
1997+
order by id;
1998+
gauges:
1999+
- config_value_normalized
2000+
19652001

19662002
presets:
19672003
full:
@@ -2003,4 +2039,5 @@ presets:
20032039
pg_vacuum_progress: 30
20042040
pg_index_pilot:
20052041
metrics:
2006-
pg_index_pilot: 30
2042+
pg_index_pilot: 30
2043+
pg_index_pilot_config: 7200

0 commit comments

Comments
 (0)