Re: Pluggable cumulative statistics
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-18T05:56:20Z
Lists: pgsql-hackers
Attachments
- v7-0001-Switch-PgStat_Kind-from-enum-to-uint32.patch (text/x-diff) patch v7-0001
- v7-0002-Introduce-pluggable-APIs-for-Cumulative-Statistic.patch (text/x-diff) patch v7-0002
- v7-0003-Add-helper-routines-to-retrieve-custom-data-for-f.patch (text/x-diff) patch v7-0003
- v7-0004-doc-Add-section-for-Custom-Cumulative-Statistics-.patch (text/x-diff) patch v7-0004
- v7-0005-injection_points-Add-statistics-for-custom-points.patch (text/x-diff) patch v7-0005
- v7-0006-injection_points-Add-example-for-fixed-numbered-s.patch (text/x-diff) patch v7-0006
On Tue, Jul 16, 2024 at 10:27:25AM +0900, Michael Paquier wrote: > Perhaps we should have a few more inline functions like > pgstat_get_entry_len() to retrieve the parts of the custom data in the > snapshot and shmem control structures for fixed-numbered stats. That > would limit what extensions need to know about > pgStatLocal.shmem->custom_data[] and > pgStatLocal.snapshot.custom_data[], which is easy to use incorrectly. > They don't need to know about pgStatLocal at all, either. > > Thinking over the weekend on this patch, splitting injection_stats.c > into two separate files to act as two templates for the variable and > fixed-numbered cases would be more friendly to developers, as well. I've been toying a bit with these two ideas, and the result is actually neater: - The example for fixed-numbered stats is now in its own new file, called injection_stats_fixed.c. - Stats in the dshash are at the same location, injection_stats.c. - pgstat_internal.h gains two inline routines called pgstat_get_custom_shmem_data and pgstat_get_custom_snapshot_data that hide completely the snapshot structure for extensions when it comes to custom fixed-numbered stats, see the new injection_stats_fixed.c that uses them. -- Michael
Commits
-
injection_points: Add some fixed-numbered statistics
- f68cd847fa40 18.0 landed
-
injection_points: Add some cumulative stats for injection points
- 75534436a477 18.0 landed
-
Add helper routines to retrieve data for custom fixed-numbered pgstats
- 2eff9e678d35 18.0 landed
-
Introduce pluggable APIs for Cumulative Statistics
- 7949d9594582 18.0 landed
-
Switch PgStat_Kind from an enum to a uint32 type
- 3188a4582a8c 18.0 landed
-
Improve comment of pgstat_read_statsfile()
- 72c0b24b2ddd 18.0 landed
-
Add a new 'F' entry type for fixed-numbered stats in pgstats file
- 9e4664d950c1 18.0 landed
-
Add PgStat_KindInfo.init_shmem_cb
- 21471f18e9d9 18.0 landed
-
Use pgstat_kind_infos to write fixed shared statistics
- b68b29bc8fec 18.0 landed
-
Replace hardcoded identifiers of pgstats file by #defines
- 9fd02525793f 18.0 landed