Skip to content

Commit

Permalink
ripped out the old tracing behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Aug 26, 2015
1 parent 3763b2a commit 4633906
Show file tree
Hide file tree
Showing 52 changed files with 172 additions and 2,209 deletions.
4 changes: 2 additions & 2 deletions src/FubuMVC.Core/Diagnostics/BehaviorChainExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using FubuMVC.Core.Diagnostics.Runtime;
using FubuMVC.Core.Diagnostics.Instrumentation;
using FubuMVC.Core.Registration.Nodes;

namespace FubuMVC.Core.Diagnostics
Expand All @@ -14,7 +14,7 @@ public static IEnumerable<BehaviorNode> NonDiagnosticNodes(this BehaviorChain ch

public static bool NonDiagnosticNodes(BehaviorNode node)
{
if (node is DiagnosticNode || node is BehaviorTracerNode) return false;
if (node is BehaviorTracerNode) return false;

return true;
}
Expand Down
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));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using FubuMVC.Core.Behaviors;
using FubuMVC.Core.Diagnostics.Runtime.Tracing;
using FubuMVC.Core.Registration.Nodes;

namespace FubuMVC.Core.Diagnostics.Instrumentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public ChainExecutionLog()
_activityStack.Push(_activity);
}

public readonly DateTime Time = DateTime.UtcNow;

public Activity Activity
{
get { return _activity; }
Expand Down
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;
}
}
}
}
Loading

0 comments on commit 4633906

Please sign in to comment.