Coder Social home page Coder Social logo

miniprofiler's Introduction

miniprofiler's People

Contributors

a-h avatar alexandrejobin avatar alup avatar atotic avatar barmstrong avatar bgrainger avatar bunk avatar c17r avatar dixon avatar dyfrgi avatar engwan avatar eviltrout avatar felixbuenemann avatar jamesarosen avatar jeradrose avatar jimmymain avatar josh avatar joshrobb avatar jskimming avatar kiwidev avatar maddyblue avatar nzkoz avatar rtomayko avatar rynonl avatar samsaffron avatar stebet avatar tommathias avatar vlado avatar yellis avatar zr40 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miniprofiler's Issues

"Uncaught TypeError: Object has no method 'appendTo'" when trying to use with Rails and Turbolinks

I noticed an issue when trying to use MiniProfiler with the new Rails Turbolinks gem:
https://github.com/rails/turbolinks

Turbolinks makes AJAX requests for new pages and just replaces the body element. This causes a problem with miniprofiler because after swapping out the body, the $('#profilerTemplate') call return no matching elements.

I'm using the following workaround (Coffeescript) to reset the main MiniProfiler script each page change, but I'm not sure if there's a better way to do it.

(MiniProfiler is great by the way.)

resetMiniProfilerScript =->
  script = document.getElementById('mini-profiler')
  if script
    copy = document.createElement 'script'
    copy.setAttribute attr.name, attr.value for attr in script.attributes
    copy.appendChild document.createTextNode script.innerHTML
    { parentNode, nextSibling } = script
    parentNode.removeChild script
    parentNode.insertBefore copy, nextSibling

on_ready =->
  resetMiniProfilerScript()

# doc.ready init
$ ->
  on_ready()
  $(document).bind('page:change', on_ready)

StackExchange.Profiling.EntityFramework not working with EF5

I've upgrade my web application project from .NET 4.0 to 4.5.
One of the assemblies that was updated was EntityFramework from version 4.1 to version 5.0. I'm using NuGet EntityFramework assemblies.

I saw there is a project for EF6. Should I create another one for EF5 ?

When I run my application now I get this exception:

System.IO.FileLoadException was unhandled by user code
  HResult=-2146234304
  Message=Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=MiniProfiler.EntityFramework
  FileName=EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  FusionLog=""
  StackTrace:
       at StackExchange.Profiling.MiniProfilerEF.IsEF41HackRequired()
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean applyEFHack, Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 53
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 25

Rack::MiniProfiler.authorize_request vs Rack::MiniProfiler.config.pre_authorize_cb

I'm having a little trouble understanding the difference between these two.

Ideally, I'd like it to only show the miniprofiler if I call authorize_request. This seems to be the case in production. But in development it ignores authorize_request and obeys pre_authorize_cb so I have some duplicate logic in there.

Was just curious why the separate methods? Maybe there was some historical reason or another purpose I'm not aware of. Would it make sense to consolidate the two?

Thanks for the awesome gem. It's been a life saver.

1 million of files in tmp/miniprofiler ?

Hi,

I used mini-profiler in production and after 1 week my sysadmin had to shut it down because it has created more than 1 million of files in tmp/miniprofiler. Should I rotate these files manually ? Is this normal ?

Thanks.

[Rails] Calls mini-profile-resources/includes.tmpl, but no div is displayed

Running in rails development environment. Not showing up.

I see it calling:
http://localhost:3000/mini-profiler-resources/includes.tmpl?v=33d69ecf833daec8db07a9a0b6cf0bd3&_=1361324472050

And the response is:

<script id="profilerTemplate" type="text/x-jquery-tmpl">
{{if HasDuplicateSqlTimings}}!{{/if}} ${MiniProfiler.formatDuration(DurationMilliseconds)} ms
${Name} (${MiniProfiler.formatDuration(DurationMilliseconds)} ms) ${MachineName} on ${MiniProfiler.renderDate(Started)}
{{if HasSqlTimings}} {{/if}} {{each CustomTimingNames}} {{/each}} {{tmpl({timing:Root, page:this.data}) "#timingTemplate"}} {{if HasSqlTimings}} {{/if}} {{each CustomTimingNames}} {{/each}}
duration (ms) with children (ms) from start (ms)query time (ms)${$value.toLowerCase()} (ms)
{{if !ClientTimings}} {{tmpl "#linksTemplate"}} {{/if}} show time with children ${MiniProfiler.formatDuration(DurationMillisecondsInSql / DurationMilliseconds * 100)} % in sql ${MiniProfiler.formatDuration(CustomTimingStats[$value].Duration / DurationMilliseconds * 100)} % in ${$value.toLowerCase()}
{{if ClientTimings}} {{each MiniProfiler.getClientTimings(ClientTimings)}} {{/each}}
client event duration (ms) from start (ms)
${$value.name} {{if $value.duration >= 0}} ${MiniProfiler.formatDuration($value.duration)} {{/if}} +${MiniProfiler.formatDuration($value.start)}
{{tmpl "#linksTemplate"}}
{{/if}}
{{if HasSqlTimings}}
{{each(i, s) MiniProfiler.getSqlTimings(Root)}} {{tmpl({ g:s.prevGap }) "#sqlGapTemplate"}} {{tmpl({ i:i, s:s }) "#sqlTimingTemplate"}} {{if s.nextGap}} {{tmpl({ g:s.nextGap }) "#sqlGapTemplate"}} {{/if}} {{/each}}
step
time from start
query type
duration
call stack
query

show trivial gaps

{{/if}}
</script> <script id="linksTemplate" type="text/x-jquery-tmpl"> share {{if HasTrivialTimings}} show trivial {{/if}} </script> <script id="timingTemplate" type="text/x-jquery-tmpl"> ${MiniProfiler.renderIndent(timing.Depth)} ${timing.Name.slice(0,45)}{{if timing.Name && timing.Name.length > 45 }}...{{/if}} ${MiniProfiler.formatDuration(timing.DurationWithoutChildrenMilliseconds)} ${MiniProfiler.formatDuration(timing.DurationMilliseconds)} +${MiniProfiler.formatDuration(timing.StartMilliseconds)} {{if timing.HasSqlTimings}} {{if timing.HasDuplicateSqlTimings}}!{{/if}} ${timing.SqlTimings.length} sql ${MiniProfiler.formatDuration(timing.SqlTimingsDurationMilliseconds)} {{else}} {{/if}} {{each page.CustomTimingNames}} {{if timing.CustomTimings[$value]}} ${timing.CustomTimings[$value].length} ${$value.toLowerCase()} ${MiniProfiler.formatDuration(timing.CustomTimingStats[$value].Duration)} {{else}} {{/if}} {{/each}} {{if timing.HasChildren}} {{each timing.Children}} {{tmpl({timing: $value, page: page}) "#timingTemplate"}} {{/each}} {{/if}} </script> <script id="sqlTimingTemplate" type="text/x-jquery-tmpl">
${s.ParentTimingName}
T+${MiniProfiler.formatDuration(s.StartMilliseconds)} ms
{{if s.IsDuplicate}}DUPLICATE{{/if}} ${MiniProfiler.renderExecuteType(s.ExecuteType)}
${MiniProfiler.formatDuration(s.DurationMilliseconds)} ms
${s.StackTraceSnippet}
    <pre class="prettyprint lang-sql"><code>${s.FormattedCommandString}   </code></pre>
  </div>
</td>
</script> <script id="sqlGapTemplate" type="text/x-jquery-tmpl"> ${g.duration} ms
${g.topReason.name} — ${g.topReason.duration.toFixed(2)} ms
</script>

But the page is does not have any information overlaid on top of it.

Rails 2.3.12, Ruby 1.9.3, mysql2, mongoid

Thanks,
Ahmed

miniprofiler for pure json API in sinatra/padrino

Hi, i'm trying to use miniprofiler for my project which is written using padrino/sinatra (Ruby). The problem is that the backend is a pure API and only offer json's as views, so "injecting" method is not possible.

There is any way to render miniprofilers views or redirect them, from/to a specific path (something like "/miniprofiler" ), and treat them as dedicate views?

Thanks in advance.

results-index view broken in latest master

Hi, I've been looking into using the latest master and have found that the 'results-index' view broken.

I've produced a fix on my fork that gets it working again, but I haven't submitted a pull request as I'm unsure whether the fix is appropriate since I've added just enough to get it working. A wider re-factor may be appropriate so ensure the 'results-index' is consistent with the the way the 'results' view is produced.

Please provide feedback. I'm happy to help, by either submitting the fix as a pull request, or adapting the fix to be consistent with the re-factoring described above, though I would require some guidance if you request the latter.

miniprofiler and heroku-deflator

When I run rack-mini-profiler with heroku-deflater, I get an internal server error. There seems to be an incompatibility issue.

And since they are both used for optimization, it would be nice to test them together.

skip_schema_queries setting seems to be ignored in development

I can't seem to change the skip_schema_queries setting to true in the development environment, I tried setting Rack::MiniProfiler.config.skip_schema_queries directly in the initializer and also using a Rails.configuration.after_initialize block, but I still get the schema queries in the profiler output. Is there anything I'm missing? I did restart my server several times and made sure there were no old Ruby processes hanging around.

Internal Server Error

We're seeing this on MiniProfiler 0.1.27.

Usually after a longer wait time where the local development server is not running (say overnight) this will crop up the next morning on the first page load:

!! Unexpected error while processing request: No such file or directory - /Users/user/code/project/tmp/miniprofiler/mp_views_3b8d0774d3f759f36dd96f694bb39df4

The local development server then needs to be killed/restarted and all is fine.

Any ideas?

EF Model First - table valued function parameters called with nvarchar(max), breaks full text search

I haven't tried Code-First or other UDF variations on this, but here's my particular problem:

I'm using EF Model First (.edmx) with SQL Server. I have a TVF with an nvarchar parameter to do full text searching. It works fine without the EF Profiler. When I use the profiler, the generated SQL calls the parameter as nvarchar(max) (instead of nvarchar(4000)), which is incompatible with freetexttable() and throws an error. Here are the SQL outputs from a test function captured with SQL Server Profiler:

CREATE FUNCTION [dbo].[KeywordSearch]
(   
    @keywords nvarchar(4000) = null
)
RETURNS TABLE 
AS
RETURN 
    SELECT 0 as col
GO

--SQL as called without MiniProfilerEF
exec sp_executesql N'SELECT 
1 AS [C1], 
[Extent1].[col] AS [col]
FROM [dbo].[KeywordSearch](@keywords) AS [Extent1]',N'@keywords nvarchar(4000)',@keywords=N'test'

--SQL as called *with* MiniProfilerEF
exec sp_executesql N'SELECT 
1 AS [C1], 
[Extent1].[col] AS [col]
FROM [dbo].[KeywordSearch](@keywords) AS [Extent1]',N'@keywords nvarchar(max) ',@keywords=N'test'

I have this reproducible as a VS console app project here: https://dl.dropbox.com/u/16940699/MiniProfilerTvfParameterTest.zip

I believe this is the same issue as http://stackoverflow.com/questions/15100640/changing-my-query-and-causing-sql-exception

Interestingly, LinqPad shows the same behavior, and there's a related question here: http://stackoverflow.com/questions/13031103/when-using-entity-framework-with-linqpad-or-efproviderwrappertoolkit-table-valu

Mini Profiler profiles itself on virtual paths

When my application is on the root folder, for example http://localhost:3333/, all works as expected.
When I use another path, http://localhost:3333/subsite/, I get a lot of noise - all requests to /mini-profiler-resources are also visible on the next request, making the profiler mostly useless...

A simple workaround is to set IgnoredPaths:

MiniProfiler.Settings.IgnoredPaths = new[] { "/scripts/", "/content/",
                                             "/favicon.ico", "/mini-profiler-resources" };

This is an easy fix, but it looks like a bug somewhere...

Memory leak on JRuby

JRuby application servers that can do hot redeploys will shut down the old JRuby runtime without exiting the process. In a few places, rack-mini-profiler creates threads that won't shut down until the process dies. Each of these threads will cause a stopped JRuby runtime to sit around in memory much longer than necessary (they appear to be weakrefs and as such, should eventually be GC'd).

Rack::MiniProfiler::FileStore
Rack::MiniProfiler::MemoryStore

are definitely problematic.

Rack::MiniProfiler may be problematic. This one create a thread that can be exited under certain circumstances. I'd have to trace through to see when that happens.

The simple fix is to flag the thread in an at_exit handler. I did this for another project:

https://github.com/wr0ngway/lumber/blob/a35520abace41a87b455b15398be630e7ef5b2da/lib/lumber/level_util.rb#L83

If you're open to a similar solution I can pull together a pull request.

MiniProfiler does not work with Entity Framework 6 and breaks the application if it is upgraded to EF6.

Entity Framework 6 has done some architectural changes as outlined in the following two URLs.

Updating Applications to use EF6 - http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6

Rebuilding EF providers for EF6 - http://entityframework.codeplex.com/wikipage?title=Rebuilding%20EF%20providers%20for%20EF6

This causes MiniProfiler to break the application due to incompatibilities with the newly moved base classes and the new provider model.

It breaks like this (using a DbContext):

Unable to cast object of type 'StackExchange.Profiling.Data.EFProfiledDbConnection' to type 'System.Data.SqlClient.SqlConnection'. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.InvalidCastException: Unable to cast object of type 'StackExchange.Profiling.Data.EFProfiledDbConnection' to type 'System.Data.SqlClient.SqlConnection'.

I think it would be necessary to create a separate project for EF6 integration since it is not backwards compatible. Also at the moment it only supports .NET 4.5.

Here is a working sample project using EF5 and MiniProfiler which exhibits this behavior as soon as it is upgraded to use EF6: http://sdrv.ms/XUzWpA

initializer failure running in production heroku

Solution: The problem was I had the gem under the group(:development) and therefore the heroku bundle did not actually contain the gem itself. I moved the reference to allow other environments to work. I will update this and cancel the issue.

I have MiniProfiler running great locally on Rails 3.1.6 with my dev machine. On heroku, I get a 'uninitialized constant Rack::MiniProfiler' error and have been stuck trying to find out what is different about the environments that causes initialization to fail.

within my config/initializers/mini_profiler.rb file. This file looks like this:

require 'rack-mini-profiler'

configuredUri = ENV['REDISTOGO_URL'] || 'redis://localhost:6379'
$redisConnectionUri ||= URI.parse(configuredUri)

Set RedisStore since Heroku in production does not allow local disk I/O

if Rails.env.production?
Rack::MiniProfiler.config.storage_options = { :host => $redisConnectionUri.host, :port => $redisConnectionUri.port, :password => $redisConnectionUri.password }
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
end

If I try adding the commented line from above: #require 'rack-mini-profiler' then i get this following error: 'no such file to load -- rack-mini-profiler'

Any help or suggestions are appreciated. Thanks.

Does not work on Rails 3.0 when setting DB options

Hi,

This may not be a high priority anymore, but miniprofiler doesn't work with Rails 3.0. There's a conflict between sql_patches and rack-mount near the #instance_variable_set:

  class Mysql2::Client
    alias_method :query_without_profiling, :query
    def query(*args,&blk)
      current = ::Rack::MiniProfiler.current
      return query_without_profiling(*args,&blk) unless current

      start = Time.now
      result = query_without_profiling(*args,&blk)
      elapsed_time = ((Time.now - start).to_f * 1000).round(1)
      result.instance_variable_set("@miniprofiler_sql_id", ::Rack::MiniProfiler.record_sql(args[0], elapsed_time))

      result

    end
  end

The Mysql2 adapter configures each connection by sending a SET statement to the DB. The code for that is here:

        def configure_connection
          @connection.query_options.merge!(:as => :array)

          # By default, MySQL 'where id is null' selects the last inserted id.
          # Turn this off. http://dev.rubyonrails.org/ticket/6778
          variable_assignments = ['SQL_AUTO_IS_NULL=0']
          encoding = @config[:encoding]

          # make sure we set the encoding
          variable_assignments << "NAMES '#{encoding}'" if encoding

          # increase timeout so mysql server doesn't disconnect us
          wait_timeout = @config[:wait_timeout]
          wait_timeout = 2147483 unless wait_timeout.is_a?(Fixnum)
          variable_assignments << "@@wait_timeout = #{wait_timeout}"

          execute("SET #{variable_assignments.join(', ')}", :skip_logging)
        end

This returns nil as the result (not an empty array). You normally would be able to get away with defining instance variables on the nil singleton object, but unfortunately, rack-mount (for Rails 3.0) has also decided to have its way with nil.

    def initialize(app, prefix = nil)
      @app, @prefix = app, prefix.freeze
      freeze
    end

So you get the inevitable cannot modify a frozen object error. Seems this pull-request https://github.com/josh/rack-mount/pull/30 fixes it on the Rack side.

This is FYI. I will attempt a Rails 3.1 upgrade now.

rack-mini-profile documentation needs to be clearer about what it does to requests & cookies

Reading through profiler.rb I see lots of magic in there to manipulate caching & set cookies , mainly for good reasons (as detailed in the comments).

I think that this stuff needs to be added to the default documentation so that developers are aware that it will change the caching semantics of the request significantly if enabled in production. I can imagine a frustrated developer wondering why caching & ETags are behaving weirdly in production for them but not for those without miniprofiler enabled.

Furthermore, if my reading of the source is accurate, if a user is authorized to view MiniProfiler, and then that authorization is removed, they will still be able to view MiniProfiler as they'll have a client-side MiniProfiler session cookie. This caused me some confusion as I was debugging another issue and trying to work out why I was seeing performance degredation even though I'd removed MiniProfiler access for all users.

Automatically wire up middleware for rails apps

When the gem is included in the Gemfile it should automatically wire up middleware so people don't need to muck with config, it should set it up so MP is enabled in debug but totally dormant in prd (unless a hook it added)

[Rails] Three SQL queries always shown unnecessarily

The SELECT 1 query has always been appearing and probably doesn't need to.

Besides this, Rails (in development) now checks for new available schema migrations on every request. Having these queries show results in a lot of extra noise.

profilerschema

NullReferenceException in SqlServerStorage.LoadInBatch() function due to client timings

I'm getting the following exception when I click on the share link for an individual profile. I'm using the latest version from NuGet, 2.0.1. I originally created this on StackOverflow

The Exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at StackExchange.Profiling.Storage.SqlServerStorage.LoadInBatch(DbConnection conn, Object idParameter) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 348    
   at StackExchange.Profiling.Storage.SqlServerStorage.Load(Guid id) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 297 
   at StackExchange.Profiling.UI.MiniProfilerHandler.Results(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 314 
   at StackExchange.Profiling.UI.MiniProfilerHandler.ProcessRequest(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 188 
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The code:

I found what I think is the source of the null reference in the code here:

ClientTimings clientTimings = null;
if (clientTimingList.Count > 0)
{
    clientTimings.Timings = clientTimingList;
}

Am I missing something, or is that always going to throw an exception when there are entries in the clientTimingList?

Workarounds:

  • I thought maybe if I disabled batching, I wouldn't run the LoadInBatch function, but LoadIndividually has the same issue.
  • I looked for a way to disable client timings, but couldn't find a setting for it.
  • Maybe I could set a trigger in the database to delete the rows, but that seems a little extreme.

MiniProfiler HTML widget very slow in Chrome on Retina Macbook (includes workaround!)

Writing this up as this was a biig problem for me when using MiniProfiler.

MiniProfiler's use of a position: fixed widget causes extreme slowdown when trying to scroll certain pages on Chrome on a Retina display Macbook.

The workaround is as follows:

  1. Enter about:flags in your chrome browser bar
  2. Set "Fixed position elements create stacking contexts. " to "Enabled"
  3. Set "Compositing for fixed position elements." to "Enabled"

Once again enjoy smooth(-ish) scrolling!

Sample.Wcf

Hi,

Trying to run the sample.Wcf, but getting the following error

An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'wcfMiniProfilerBehavior' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.

Thanks
Sal

Step method to return the yield call returned data?

Would it be possible that the step method returns the data returned by the yield call? It would make the calling code cleaner when the block don't just modify objects, but also returns data.

It seems quite straightforward to fix in the codebase, but i'm not sure of the potential consequences of such a behavioral change.

Rack::MiniProfiler.config

No option to set #start_hidden am I missing something? According to the docs in the README its an example. I'll fix the README if the README is incorrect.

[5] pry(#<Rack::MiniProfiler::Config>):1> ls
Rack::MiniProfiler::Config#methods: 
  authorization_mode   backtrace_ignores=   base_url_path   pre_authorize_cb     skip_schema_queries=  storage_options       user_provider=
  authorization_mode=  backtrace_includes   base_url_path=  pre_authorize_cb=    storage               storage_options=    
  auto_inject          backtrace_includes=  merge!          skip_paths           storage=              use_existing_jquery 
  auto_inject=         backtrace_remove     position        skip_paths=          storage_instance      use_existing_jquery=
  backtrace_ignores    backtrace_remove=    position=       skip_schema_queries  storage_instance=     user_provider       
self.methods: __pry__
instance variables: 
  @authorization_mode  @backtrace_includes  @base_url_path  @pre_authorize_cb  @skip_schema_queries  @storage_options
  @auto_inject         @backtrace_remove    @position       @skip_paths        @storage              @user_provider  
locals: _  __  _dir_  _ex_  _file_  _in_  _out_  _pry_
[6] pry(#<Rack::MiniProfiler::Config>):1> 

deauthorize Rack-mini-profiler for non admin users

Hi,
I am trying to install Rack-mini-profiler on my ROR application. I installed the gem and the profiler works great in development but I can't deauthorize specific requests for non admin users. I placed the following code in my ApplicationController before_filter

def authorize_mini_profiler
if current_user.nil?
Rack::MiniProfiler.deauthorize_request
return
elsif is_admin_user
Rack::MiniProfiler.authorize_request
return
end
Rack::MiniProfiler.deauthorize_request
end
In debug I saw that the deauthorize method is called but the profiler is still displayed.

I even tried using this code

def authorize_mini_profiler
Rack::MiniProfiler.deauthorize_request
end
but still, every request by any user displays the profiler.

Does anyone knows what might be the problem?
Thanks

Seeing extra requests stack up from another window

Ran into an strange issue lately where when we reload a page, additional requests stack up on the left from other pages, showing eight of them (the max I believe).

It's almost like we have pages open in another window, and the miniprofiler requests are all being sent to this one window. Or redis is not clearing old ones?

I tried closing all other admin views I had open, and they still seem to appear there on each page load. Haven't been able to see a consistent pattern to which show up. The request are from all different pages though, not just the current one I'm reloading.

Do you have any idea what could be causing this? It worked correctly for some time, then slowly started doing more of this, and I don't think we've changed anything in our MiniProfiler settings. Thanks!

No support of jQuery 2

When using jQuery 2.0, MiniProfiler overrides jQuery by its 1.7 version and it causes some troubles with other librairies previously loaded
capture

code cleanup

Hi,

I have contributed before (rest support).

I would like to cleanup the code, and make it all stylecop compliant. Would you guys be happy to accept a pull request for all the necessary fixes and comments?

I don't want to do the work if you guys aren't keen to pull it. It will involve mostly cosmetic changes, but there will be quite a lot of them and it will perhaps make comparing prior versions a little trickier.

Cheers
Craig.

inserting Rack middleware at position 0 can cause problems with other middleware like Rack::Deflater

On Heroku, Rack::Deflater is required to enable gzip compression on responses. Injecting the profiler before this doesn't work. It might be useful to be able to specify a position at which the middleware should be inserted.

When using the heroku-deflater gem, the actual error is:

Unexpected error while processing request: incompatible character encodings: ASCII-8BIT and UTF-8

This fixes it when run in an initializer:

config.middleware.delete(Rack::MiniProfiler)
config.middleware.insert_after(HerokuDeflater::SkipBinary, Rack::MiniProfiler)

rack-mini-profile slowing down mysql transactions (or measurement?)

Did a big deploy earlier in this week and was surprised to see our average response time jump from 100ms to 200ms. The deploy did not include any major database work. Part of that deploy was pushing rack-mini-profiler to production.

screen shot 2013-05-15 at 4 31 31 pm

Surprisingly, removing rack-mini-profiler restored our application to its previous performance levels.

screen shot 2013-05-15 at 4 31 52 pm

I am not certain yet whether this is an actual regression caused by rack-mini-profiler or merely a NewRelic measurement problem. If it is an actual regression, I suspect that miniprofiler is adding 3-4ms to each database call.

MiniProfiler requires JQuery

This is cheeky, I know. Bloody cheeky. I'm not gonna be offended if this gets closed as WONTFIX.

This is an exploratory feature request more than anything else: can we make a version of MiniProfiler that doesn't need JQuery to do its rendering?

Asking as we're phasing out our JQuery / Rails-UJS stuff in favour of Angular, and MiniProfiler is the only thing left that uses JQuery.

MiniProfiler OnDeserialized method missing the StreamingContext parameter.

The OnDeserialized method used to have a StreamingContext parameter passed to it, which is required by the WCF profiler.

It appears to have been removed when adding the MongoDbStorage support.

To fix it, the MongoDbStorage class needs to call:

profiler.OnDeserialized(new System.Runtime.Serialization.StreamingContext());

and the MiniProfiler needs to get its StreamingContext parameter back.

data-start-hidden wrong evaluated in .net

includes.js:

// boolean tostring in .net renders to "True", so the result was always false
// added toLowerCase

if (script.getAttribute('data-trivial').toLowerCase() == 'true') var trivial = true;
if (script.getAttribute('data-children').toLowerCase() == 'true') var children = true;
if (script.getAttribute('data-controls').toLowerCase() == 'true') var controls = true;
if (script.getAttribute('data-authorized').toLowerCase() == 'true') var authorized = true;
if (script.getAttribute('data-start-hidden').toLowerCase() == 'true') var startHidden = true;

rack-mini-profiler: RedisStore and redis connection factories

We have a redis connection factory which we use for a couple things:

  1. Select between Redis and RedisFailover.
  2. Reconnect Redis connections after a fork for e.g. resque and app server process pools.
  3. Re-use redis connections.

I'd like to use it with MiniProfiler, but the current RedisStore doesn't allow for it.

I'm inclined to enable this by patching RedisStore rather than making a new storage class. I was thinking to allow a connection to be passed into RedisStore via storage_options. Is this a patch you'd be likely to accept?

DbSpacial support

My problem looks identical to this one on SO but it doesn't look like the OP ever reported the problem or got it fixed. We are using MiniProfiler on a system with spacial data and sometimes when loading something with spacials it fails with a ProviderIncompatibleException with the message "The provider did not return a DbSpatialServices instance". @SamSaffron pointed to it being a bug in MiniProfiler and indeed disabling MP stops the error while I'm working on spacial stuff. I don't have steps to repro at the moment but I'll see what I can do when I have a free stretch.

rails + memcached store + unicorn fail to start in production

Hello and thanks for awesome gem, it really helps those who believe performance is a feature.

I'm trying to include MiniProfiler into my rails 3.2 project, the setup is quite default:
rack-mini-profiler (0.1.23)
rails (3.2.8)
dalli (2.2.1)
unicorn (4.3.1)

When I try to use

# config/initializers/mini_profiler.rb
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemcacheStore

I get NoMethod error saying that Hash has no method 'add'. This seems to deal with FileStore defaults, so I do

Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::MemcacheStore.new

and then everything's ok in development, but in production I got a very confusing deadlock error. Futher investigation showed that this was because the default Dalli::Client is initialized with localhost:11211, which is not the same as 127.0.0.1:11211 (the Dalli default).

So adding

Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::MemcacheStore.new(Dalli::Client.new)

fixed the problem. Unfortunately I don't have time to fork and submit PR, but I propose to just delete the offending parameter ['localhost:11211'] from Dalli::Client default initialization leaving dealing with defaults to Dalli itself. HTH

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.