-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ripped out the old tracing behaviors
- Loading branch information
1 parent
3763b2a
commit 4633906
Showing
52 changed files
with
172 additions
and
2,209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 44 additions & 49 deletions
93
....Core/Diagnostics/Runtime/ApplyTracing.cs → ...agnostics/Instrumentation/ApplyTracing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,45 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using FubuMVC.Core.Registration; | ||
using FubuMVC.Core.Registration.Nodes; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Runtime | ||
{ | ||
[Description("Applies the runtime tracing behaviors to each chain")] | ||
public class ApplyTracing | ||
{ | ||
public static void Configure(BehaviorGraph graph) | ||
{ | ||
foreach (BehaviorChain chain in graph.Chains.Where(ShouldApply).ToArray()) | ||
{ | ||
ApplyToChain(chain); | ||
} | ||
} | ||
|
||
public static bool ShouldApply(BehaviorChain chain) | ||
{ | ||
if (chain is DiagnosticChain) return false; | ||
if (chain.Tags.Contains("Diagnostics")) return false; | ||
|
||
if (chain.IsTagged(BehaviorChain.NoTracing)) | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
if (chain.Calls.Any(x => x.HasAttribute<NoDiagnosticsAttribute>())) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public static void ApplyToChain(BehaviorChain chain) | ||
{ | ||
var nodes = chain.ToList(); | ||
nodes.Each(x => new BehaviorTracerNode(x)); | ||
|
||
if (!chain.IsPartialOnly) | ||
{ | ||
new DiagnosticNode(chain); | ||
} | ||
} | ||
} | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using FubuMVC.Core.Registration; | ||
using FubuMVC.Core.Registration.Nodes; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Instrumentation | ||
{ | ||
[Description("Applies the runtime tracing behaviors to each chain")] | ||
public class ApplyTracing | ||
{ | ||
public static void Configure(BehaviorGraph graph) | ||
{ | ||
foreach (BehaviorChain chain in graph.Chains.Where(ShouldApply).ToArray()) | ||
{ | ||
ApplyToChain(chain); | ||
} | ||
} | ||
|
||
public static bool ShouldApply(BehaviorChain chain) | ||
{ | ||
if (chain is DiagnosticChain) return false; | ||
if (chain.Tags.Contains("Diagnostics")) return false; | ||
|
||
if (chain.IsTagged(BehaviorChain.NoTracing)) | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
if (chain.Calls.Any(x => x.HasAttribute<NoDiagnosticsAttribute>())) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public static void ApplyToChain(BehaviorChain chain) | ||
{ | ||
var nodes = chain.ToList(); | ||
nodes.Each(x => new BehaviorTracerNode(x)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 64 additions & 65 deletions
129
...cs/Runtime/ProductionModeTraceListener.cs → ...umentation/ProductionModeTraceListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,65 @@ | ||
using System; | ||
using FubuCore.Logging; | ||
using FubuMVC.Core.Diagnostics.Runtime.Tracing; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Runtime | ||
{ | ||
public class ProductionModeTraceListener : ILogListener | ||
{ | ||
private readonly IRequestTrace _trace; | ||
|
||
public ProductionModeTraceListener(IRequestTrace trace) | ||
{ | ||
_trace = trace; | ||
} | ||
|
||
public void Error(string message, Exception ex) | ||
{ | ||
_trace.Log(new ExceptionReport(message, ex)); | ||
} | ||
|
||
public void Error(object correlationId, string message, Exception ex) | ||
{ | ||
_trace.Log(new ExceptionReport(message, ex) | ||
{ | ||
CorrelationId = correlationId | ||
}); | ||
} | ||
|
||
public bool ListensFor(Type type) | ||
{ | ||
return false; | ||
} | ||
|
||
public void DebugMessage(object message) | ||
{ | ||
} | ||
|
||
public void InfoMessage(object message) | ||
{ | ||
} | ||
|
||
public void Debug(string message) | ||
{ | ||
} | ||
|
||
public void Info(string message) | ||
{ | ||
} | ||
|
||
public bool IsDebugEnabled | ||
{ | ||
get | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public bool IsInfoEnabled | ||
{ | ||
get | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
using System; | ||
using FubuCore.Logging; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Instrumentation | ||
{ | ||
public class ProductionModeTraceListener : ILogListener | ||
{ | ||
private readonly IChainExecutionLog _trace; | ||
|
||
public ProductionModeTraceListener(IChainExecutionLog trace) | ||
{ | ||
_trace = trace; | ||
} | ||
|
||
public void Error(string message, Exception ex) | ||
{ | ||
_trace.Log(new ExceptionReport(message, ex)); | ||
} | ||
|
||
public void Error(object correlationId, string message, Exception ex) | ||
{ | ||
_trace.Log(new ExceptionReport(message, ex) | ||
{ | ||
CorrelationId = correlationId | ||
}); | ||
} | ||
|
||
public bool ListensFor(Type type) | ||
{ | ||
return false; | ||
} | ||
|
||
public void DebugMessage(object message) | ||
{ | ||
} | ||
|
||
public void InfoMessage(object message) | ||
{ | ||
} | ||
|
||
public void Debug(string message) | ||
{ | ||
} | ||
|
||
public void Info(string message) | ||
{ | ||
} | ||
|
||
public bool IsDebugEnabled | ||
{ | ||
get | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public bool IsInfoEnabled | ||
{ | ||
get | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.