Rack-mini-profiler showing up in production for admins?


(Jaime Iniesta) #1

Hi, I just installed Discourse following the instructions at discourse/INSTALL-digital-ocean.md at master · discourse/discourse · GitHub and found that rack-mini-profiler is activated:

Is this intended? How can I disable it?

Thanks! And congrats, it’s been super easy to install Discourse following this guide.


(Arpit Jalan) #2

That’s odd!

Nope.

Did you followed the guide as is? (did you access the rails console?)


(Jaime Iniesta) #3

Yes, I followed the guide as is, and I didn’t access the rails console, should I?


(Jaime Iniesta) #4

Ah, one I thing I just noticed, the profiler only appears when I’m logged in as an admin.


(Arpit Jalan) #5

No, I was just clarifying.

This is the odd case, I’ll check.


(Jeff Atwood) #6

This is correct, if you are the admin, you will see profiler timings.


(Jaime Iniesta) #7

Ah, alright, thanks for the clarification.


(Kane York) #8

Yeah, this is completely intended @techAPJ - it’s a very good idea to be keeping an eye out for performance regressions, and MiniProfiler shoves it in your face! :stuck_out_tongue:


(Sam Saffron) #9

If you do not want it add

DISCOURSE_ENABLE_MINI_PROFILER: "false"

To your env: section in your container definition and run:

./launcher rebuild app


(axil) #10

Is it removed from newer versions? I’m using 1.1.0.beta7 and I see it is still there in defaults.conf.


(Jeff Atwood) #11

Is is there for developer admins only, e.g. the accounts that installed Discourse. Is that correct @sam? I am very hazy on what makes a ‘developer’ admin account vs. regular admin.


(cpradio) #12

There is a setting in app.yml


(Sam Saffron) #13
def is_developer?
    @user &&
    is_admin? &&
    (Rails.env.development? ||
      (
        Rails.configuration.respond_to?(:developer_emails) &&
        Rails.configuration.developer_emails.include?(@user.email)
      )
    )
  end
  1. Is admin
  2. Running in DEV, OR, In the DISCOURSE_DEVELOPER_EMAILS list which is set via the ENV var or in discourse.conf

(axil) #14

That must be it. After installing, I removed my email from app.yml so that I could put it under version control and ran rebuild again. So if I wanted mini-profiler to be back, all I have to do is to rebuild the container with the DISCOURSE_DEVELOPER_EMAILS env variable. Thanks.


(Brian Boatright) #15

I just installed and setup Discourse on a VPS at Linode and read the FAQ and Admin Read Me. Maybe I overlooked it but the profiler isn’t mentioned and might cause confusion for non-developer types who install Discourse.

The problem with the profiler stats is that it interferes with the editor when creating a topic, at least it just did for me when you get down to a smaller window size, even 1280px wide.

This screenshot shows the profiler overlaying editor field at 1280px wide. I think it would be better to have it sit over to the right instead of the left to avoid covering up the editor toolbar and text field.


(Dean Taylor) #16

I would simply use Alt+P to toggle the profiler stats off whilst they are in the way…
… back on after.


(Brian Boatright) #17

That’s great, didn’t know it had a shortcut.

Can we get the shortcut and the profiler mentioned in the Admin Read Me?


(Sam Saffron) #18

If you remove yourself from the developer list in the container config, mini profiler will go away.