Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a new --dbname-filter flag #256

Merged
merged 4 commits into from Dec 16, 2021

Conversation

kmoppel
Copy link
Contributor

@kmoppel kmoppel commented Dec 12, 2021

Allows to blend out any activities from DBs that are not of interest - DB size, TPS, running / waiting / blocking queries. To understand when a regex filter is specified I've added a star (*) to the DATABASE column...hopefully this is enough. Looks like that:
Screenshot from 2021-12-12 18-58-08

@blogh
Copy link
Collaborator

blogh commented Dec 13, 2021

Hi,

I was thinking about adding more filters, it's great you made this patch !
I will try to have a stab a it this week or next week.

Thx a lot for the patch.

@blogh
Copy link
Collaborator

blogh commented Dec 13, 2021

Just tested it; works as expected.

Maybe we should add that the regexp are documented in the following link in a FAQ entry and/or in the man page ?
https://www.postgresql.org/docs/current/functions-matching.html#POSIX-SYNTAX-DETAILS

@dlax
Copy link
Member

dlax commented Dec 14, 2021

If we want to add more filters, maybe it'd be nicer to have a single --filter option that would take a key/value to indicate the object we filter on; e.g. --filter=dbname:<regex> --filter=username:<regex>.

@dlax dlax self-requested a review December 14, 2021 09:26
@kmoppel-cognite
Copy link
Contributor

@blogh Thanks for verifying that it works! But about adding the link to regex docs...probably just overkill...as the people using this tool, especially the more exotic flags, are already very technical people and surely know what a regex means / looks like :)

@kmoppel-cognite
Copy link
Contributor

@dlax Sure, not against the idea...but then the architecture for such generic filters probably needs to come from your side.
The hardest part will probably be keeping the SQL templates more or less sane in case of dynamic input...

@blogh
Copy link
Collaborator

blogh commented Dec 15, 2021

@kmoppel I am not sure about that, but we can wait about the questions and add the FAQ entry then.

@dlax
Copy link
Member

dlax commented Dec 15, 2021

Added the generic --filter flag; can you give it a try?

@blogh
Copy link
Collaborator

blogh commented Dec 15, 2021

I like the changes :)

@dlax dlax force-pushed the introduce-dbname-filter-flag branch from c404358 to 32a8f8d Compare December 16, 2021 08:06
@dlax
Copy link
Member

dlax commented Dec 16, 2021

I've cleaned up the git history.
This looks good to me now so we can merge this I think.
@blogh, what do you think?

(I'll fix the lint issue, due to mypy new version, in the meantime.)

kmoppel-cognite and others added 4 commits December 16, 2021 09:17
If specified the input will be matched as Postgres regex against all
fetched activites - DB info, normal activities and waiting / blocking
info. A star (*) in the UI for the DATABASE column will hint at the
option being active.
The fixture is not needed as we can just build a new "data" object in
the test. Also compare active connections with and without filtering.
@dlax dlax force-pushed the introduce-dbname-filter-flag branch from 32a8f8d to 5011745 Compare December 16, 2021 08:17
README.md Show resolved Hide resolved
@dlax dlax merged commit 5011745 into dalibo:master Dec 16, 2021
@dlax
Copy link
Member

dlax commented Dec 16, 2021

Merged.
Thank you @kmoppel for the patch and @blogh for the review!

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.

None yet

4 participants