Commit 476f8e2f authored by Marc Gravell's avatar Marc Gravell

more profiling clarifications

parent 6bf7acf9
......@@ -101,9 +101,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{153A10E4-E
docs\KeysScan.md = docs\KeysScan.md
docs\KeysValues.md = docs\KeysValues.md
docs\PipelinesMultiplexers.md = docs\PipelinesMultiplexers.md
docs\Profiling v1.md = docs\Profiling v1.md
docs\Profiling v2.md = docs\Profiling v2.md
docs\Profiling.md = docs\Profiling.md
docs\Profiling_v1.md = docs\Profiling_v1.md
docs\Profiling_v2.md = docs\Profiling_v2.md
docs\PubSubOrder.md = docs\PubSubOrder.md
docs\ReleaseNotes.md = docs\ReleaseNotes.md
docs\Scripting.md = docs\Scripting.md
......
......@@ -203,17 +203,17 @@ public class RedisProfiler
}
```
Then, add the following to your Global.asax.cs file:
Then, add the following to your Global.asax.cs file (where `_redisProfiler` is the *instance* of the profiler):
```C#
protected void Application_BeginRequest()
{
RedisProfiler.CreateSessionForCurrentRequest();
_redisProfiler.CreateSessionForCurrentRequest();
}
protected void Application_EndRequest()
{
var session = RedisProfiler.GetContext();
var session = _redisProfiler.GetSession();
if (session != null)
{
var timings = session.FinishProfiling();
......@@ -223,4 +223,10 @@ protected void Application_EndRequest()
}
```
and ensure that the connection has the profiler registered when the connection is created:
```C#
connection.RegisterProfiler(() => _redisProfiler.GetSession());
```
This implementation will group all redis commands, including `async/await`-ed ones, with the http request that initiated them.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment