Tijani-Dia / dj-tracker

A Django app that tracks your queries to help optimize them. Demo: https://dj-tracker-bakerydemo.herokuapp.com/dj-tracker/

Home Page:https://tijani-dia.github.io/dj-tracker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Databases other than default

gabriel-v opened this issue · comments

Hi,

I got a bunch of different databases under the DATABASES django config, not only the default one. I use a custom router set in DATABASE_ROUTERS to pick what database to use - a different one might hit for each view / event.

  1. Where would I patch in a config option to overwrite what database should be tracked instead of default?
  2. Would you be interested in a change to track all databases by default? This would also require UI changes (a drop-down in the corner?)

Thanks!

I've never really used it in a configuration with multiple databases except with the trackings database which we shouldn't track. However, I'm wondering why other databases aren't tracked by default. The logic to track a query is based on the request's path or the model being used. Can you please confirm this behavior?

Where would I patch in a config option to overwrite what database should be tracked instead of default?

I don't think it'd be an easy patch. May be though.

Would you be interested in a change to track all databases by default? This would also require UI changes (a drop-down in the corner?)

I'd say this would be the ideal solution and I think it makes sense to track other databases too.

I'll have at look at this for the next release. A PR would be welcome too!

Can you please confirm this behavior?

You're right - all databases are tracked. This works.

I guess it would be nice to track the database id for each query / query group - but I can usually understand the context and figure out the database from looking at routes and stack traces.

all databases are tracked

Awesome!

I guess it would be nice to track the database id for each query / query group

I agree too.