Skip to content

Add permalink anchors to query and error entries in HTML report - #891

Open
ritojoao wants to merge 1 commit into
darold:masterfrom
ritojoao:feat-857-anchors
Open

ritojoao wants to merge 1 commit into
darold:masterfrom
ritojoao:feat-857-anchors

Conversation

@ritojoao

Copy link
Copy Markdown

Hi Gilles,

Thank you for pgBadger and for being open to the idea in #857. Here is a small change for it.

Each entry in the top queries and top errors lists already has a unique id on its details cell, for example time-consuming-queries-examples-details-rank-1. This PR adds a small pilcrow link () at the top right of that cell, before the query. The link points to that id, so a specific entry can be shared with a URL like index.html#time-consuming-queries-examples-details-rank-3.

It adds 14 links (14 added lines, only in pgbadger):

  • time consuming queries, most frequent queries and slowest normalized queries (3)
  • time consuming prepare and time consuming bind queries (2)
  • most frequent waiting queries and queries that waited the most (2)
  • queries generating the most temporary files and the largest temporary files (2)
  • most cancellation queries and most cancelled queries (2)
  • most frequent errors (1)
  • pgbouncer most frequent errors (1)
  • pgbouncer most used reserved pool (1)

The links use an inline style (float:right;text-decoration:none;). The embedded CSS is generated by tools/updt_embedded_rsc.pl, which needs yui-compressor, and I do not have it. If you prefer a CSS class, I can change it.

I did not change the docs, since this is a visual detail of the report and nothing in doc/pgBadger.pod describes it. Please tell me if you would like a line in the docs or in the ChangeLog.

I have not looked at the result in a browser.

How I checked it:

  • I generated reports from several files in t/fixtures before and after the change. Apart from the new links, the HTML is identical, and the number of SQL entries and of ids is the same.
  • Every link target id appears exactly once in the reports I generated. The change adds no new id.
  • The pgbouncer fixtures have no errors or reserved pool lines, so I added a few such lines to a copy of pgbouncer.log.gz to see those two links.
  • prove -l t/ gives the same result before and after. t/02_basics.t (test 17) and t/08_remote_watch.t (test 6) fail on my machine with or without the change.

One thing I noticed and left alone: a few older ids such as query-e-1 are reused in different sections, so they are not unique in some reports. My links do not use them. I can send a separate fix if you want.

Fixes #857

Each entry of the top queries and top errors lists already has a unique
id on its details cell. Add a small link pointing to that id so a
specific entry can be linked. 14 places are changed:

- time consuming queries, most frequent queries, slowest normalized
  queries
- time consuming prepare and time consuming bind queries
- most frequent waiting queries and queries that waited the most
- queries generating the most temporary files and the largest
  temporary files
- most cancellation queries and most cancelled queries
- most frequent errors
- pgbouncer most frequent errors
- pgbouncer most used reserved pool

The link is placed before the query block, floated to the right.

Fixes darold#857

Signed-off-by: João Rito <16895040+ritojoao@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more permalinks to reports

1 participant