Skip to content

Conversation

@0xgouda
Copy link
Collaborator

@0xgouda 0xgouda commented Nov 28, 2025

  • Add a new stat_statements_jit metric
  • Add a new panel to the 0. Health Check dashboard that displays the JIT percentage in the total query execution time.
  • Add a new panel to the Global Health Check dashboard that displays the Top n dbnames with the highest JIT percentages.

TODO:

  • Adjust the thresholds.
  • Test the queries on a database with jit_generation_time > 0.
  • Test stat_statements_jit metric on older PostgreSQL versions.

Closes: #1046

@coveralls
Copy link

coveralls commented Nov 28, 2025

Pull Request Test Coverage Report for Build 19829454390

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 73.648%

Totals Coverage Status
Change from base Build 19765583712: 0.0%
Covered Lines: 3678
Relevant Lines: 4994

💛 - Coveralls

@0xgouda 0xgouda force-pushed the add-stat-statements-jit-metric branch from d11d8a8 to da3e81c Compare November 28, 2025 18:33
It queries `pg_stat_statements` to identify queries
with high percent of execution time spent in JIT.
It queries the `stat_statements_jit` metric table to
identify the percentage of jit in the current total
query execution time within the specified grafana
time window.
It queries the `stat_statements_jit` metric table to
identify the percentage of jit in the current total
query execution time for each dbname
within the specified grafana time window.
The `Auto` option will contain a value identical to the current
time range, so we can partially avoid the imprecision of `$__timeGroup()`
the minimum version where `jit_generation_time` field
is available in `pg_stat_statements`.
@0xgouda 0xgouda force-pushed the add-stat-statements-jit-metric branch from 2c034f7 to 041510b Compare December 1, 2025 09:48
@0xgouda 0xgouda marked this pull request as ready for review December 1, 2025 09:50
@0xgouda 0xgouda requested a review from pashagolub December 1, 2025 09:51
@0xgouda 0xgouda added enhancement New feature or request dashboards Grafana dashboards related labels Dec 1, 2025
@pashagolub
Copy link
Collaborator

pashagolub commented Dec 1, 2025

We don't need another metric. We need updated stat_statements metric with a new column

@0xgouda
Copy link
Collaborator Author

0xgouda commented Dec 1, 2025

We don't need another metric. We need updated stat_statements metric with a new column

That's what I did at first, but I noticed that stat_statements_calls metric exists and it directly aggregates the calls column instead of relying on the calls column in the stat_statements metric, so I did the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboards Grafana dashboards related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitor JIT costs

3 participants