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

An option to enable/disable it within XbyK #15

Open
ChristopherBass opened this issue Sep 25, 2024 · 3 comments
Open

An option to enable/disable it within XbyK #15

ChristopherBass opened this issue Sep 25, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@ChristopherBass
Copy link

ChristopherBass commented Sep 25, 2024

Is your feature request related to a problem? Please describe.
A development team's shared development environment occasionally wants to have MiniProfiler available on a site for testing purposes, but wants to be able to turn it on conditionally with it defaulting to off (so it isn't running during every request).
Currently, because XbyK's MiniProfiler is turned on/off at app-start (in Program.cs), it is only activateable/deactivatable via an app restart.

Describe the solution you'd like
Potential solutions:

  • An in-CMS setting of some sort (This would be the ideal, if a setting like that can be exposed somehow)
  • A server cookie that, when active, enables MiniProfiler for that request. When missing, MiniProfiler does not run during that request
  • A querystring that enables MiniProfiler for the duration of that request
  • Some API endpoint in the MiniProfiler that would say 'activate/deactivate miniprofiler', to which we could attach our own logic

Describe alternatives you've considered
Editing the configuration files to add a setting that turns it on/off (and restarting the site if necessary) is cumbersome on sites where the environments are in a remote location (like Azure) with locked-down file access.

@seangwright seangwright added the enhancement New feature or request label Sep 25, 2024
@seangwright
Copy link
Member

seangwright commented Sep 25, 2024

We expose the options and follow up any customizations by forcing options.TrackConnectionOpenClose to be true in our extension call.

You can use this overload of the DI registration and then set options.ShouldProfile to be request based with a query param or something like that.

It would be up to you to conditionally enable the middleware per-environment.

@seangwright seangwright removed the enhancement New feature or request label Sep 27, 2024
@Sapphirress Sapphirress added the enhancement New feature or request label Oct 11, 2024
@Sapphirress
Copy link
Contributor

Hello @ChristopherBass, thank you for your feature suggestion. Does @seangwright's explanation help you solve this issue by yourself?
We are currently not inclined in delivering your proposed solution, unless we see more customers having the same need. Thanks for understanding.

@ChristopherBass
Copy link
Author

I haven't had an opportunity to try it myself but I trust Sean's explanation, I'm sure I'll be able to use it when I'm back on that project.
Is this a common enough need to be worth adding his explanation to documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants