Skip to content

Commit

Permalink
vm-image: Expose new LFC working set size metrics
Browse files Browse the repository at this point in the history
In general, rename:

- lfc_approximate_working_set_size to
- lfc_approximate_working_set_size_seconds

For the "main" metrics that are actually scraped and used internally,
the old one is just marked as deprecated.
For the "autoscaling" metrics, we're not currently using the old one, so
we can get away with just replacing it.

Also, for the user-visible metrics we'll only store & expose a few
different time windows, to avoid making the UI overly busy or bloating
our internal metrics storage.

But for the autoscaling-related scraper, we aren't storing the metrics,
and it's useful to be able to programmatically operate on the trendline
of how WSS increases (or doesn't!) window size. So there, we can just
output datapoints for each minute.

Part of neondatabase/autoscaling#872.
See also #7466.
  • Loading branch information
sharnoff committed Jul 5, 2024
1 parent 13522fb commit 8452edf
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions vm-image-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ files:
query: |
select sum(pg_database_size(datname)) as total from pg_database;
# DEPRECATED
- metric_name: lfc_approximate_working_set_size
type: gauge
help: 'Approximate working set size in pages of 8192 bytes'
Expand All @@ -244,6 +245,20 @@ files:
query: |
select neon.approximate_working_set_size(false) as approximate_working_set_size;
- metric_name: lfc_approximate_working_set_size_seconds
type: gauge
help: 'Approximate working set size in pages of 8192 bytes'
key_labels: [duration]
values: [size]
# NOTE: This is the "public" / "human-readable" version. Here, we supply a small selection
# of durations in a pretty-printed form.
query: |
select
x as duration,
neon.approximate_working_set_size_seconds(extract('epoch' from x::interval)::int) as size
from
(values ('1m'),('15m'),('1h')) as t (x);
- metric_name: current_lsn
type: gauge
help: 'Current LSN of the database'
Expand Down Expand Up @@ -377,13 +392,19 @@ files:
query: |
select pg_size_bytes(current_setting('neon.file_cache_size_limit')) as lfc_cache_size_limit;
- metric_name: lfc_approximate_working_set_size
- metric_name: lfc_approximate_working_set_size_seconds
type: gauge
help: 'Approximate working set size in pages of 8192 bytes'
key_labels:
values: [approximate_working_set_size]
key_labels: [duration_minutes]
values: [size]
# NOTE: This is the "internal" / "machine-readable" version. This outputs the working set
# size looking back 1..60 minutes, labeled with the number of minutes.
query: |
select neon.approximate_working_set_size(false) as approximate_working_set_size;
select
x::text as duration_minutes,
neon.approximate_working_set_size_seconds(60 * x) as size
from
(select generate_series as x from generate_series(1, 60));
build: |
# Build cgroup-tools
#
Expand Down

0 comments on commit 8452edf

Please sign in to comment.