diff --git a/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/ConnectionTab.cs b/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/ConnectionTab.cs new file mode 100644 index 00000000..de15381a --- /dev/null +++ b/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/ConnectionTab.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNet.Http; +using Glimpse.Agent; + +namespace Glimpse.AgentServer.Dnx.Mvc.Sample.Framework +{ + public class ConnectionTab : Tab + { + public override string Name => "Connection"; + + public override object GetData(HttpContext context) + { + var connection = context.Connection; + return new + { + ClientCertificate = connection.ClientCertificate?.ToString(), + connection.IsLocal, + LocalIpAddress = connection.LocalIpAddress.ToString(), + connection.LocalPort, + RemoteIpAddress = connection.RemoteIpAddress.ToString(), + connection.RemotePort + }; + } + + public override TabExecute TabExecuteWhen => TabExecute.BeforeResponse; + } +} diff --git a/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/HeadersTab.cs b/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/HeadersTab.cs new file mode 100644 index 00000000..d797737d --- /dev/null +++ b/sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/HeadersTab.cs @@ -0,0 +1,20 @@ +using Glimpse.Agent; +using Microsoft.AspNet.Http; + +namespace Glimpse.AgentServer.Dnx.Mvc.Sample.Framework +{ + // TODO: Delete me. This tab isn't intended to stick around, it's just a sample of a Tab. + public class HeadersTab : Tab + { + public override string Name => "Headers"; + + public override object GetData(HttpContext context) + { + return new + { + Request = context.Request.Headers, + Response = context.Response.Headers + }; + } + } +} diff --git a/src/Glimpse.Agent.Core/DependencyInjection/AgentRegisterServices.cs b/src/Glimpse.Agent.Core/DependencyInjection/AgentRegisterServices.cs index 21af5947..2a1b031b 100644 --- a/src/Glimpse.Agent.Core/DependencyInjection/AgentRegisterServices.cs +++ b/src/Glimpse.Agent.Core/DependencyInjection/AgentRegisterServices.cs @@ -4,11 +4,11 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.OptionsModel; using Glimpse.Agent; -using Glimpse.Agent.Internal.Messaging; using Glimpse.Agent.Configuration; using Glimpse.Agent.Inspectors; using Glimpse.Initialization; using System.Linq; +using Glimpse.Agent.Messaging; using Glimpse.Configuration; using Glimpse.Platform; diff --git a/src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs b/src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs deleted file mode 100644 index 1083ffdc..00000000 --- a/src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs +++ /dev/null @@ -1,27 +0,0 @@ -//using Glimpse.Agent.Inspectors; -//using Microsoft.AspNet.Http; - -//namespace Glimpse.Agent.AspNet.Internal.Tabs -//{ -// // TODO: Delete me. This tab isn't intended to stick around, it's just a sample of a Tab. -// public class ConnectionTab : Tab -// { -// public override string Name => "Connection"; - -// public override object GetData(HttpContext context) -// { -// var connection = context.Connection; -// return new -// { -// ClientCertificate = connection.ClientCertificate?.ToString(), -// connection.IsLocal, -// LocalIpAddress = connection.LocalIpAddress.ToString(), -// connection.LocalPort, -// RemoteIpAddress = connection.RemoteIpAddress.ToString(), -// connection.RemotePort -// }; -// } - -// public override TabExecute TabExecuteWhen => TabExecute.BeforeResponse; -// } -//} diff --git a/src/Glimpse.Agent.Core/Internal/Tabs/HeadersTab.cs b/src/Glimpse.Agent.Core/Internal/Tabs/HeadersTab.cs deleted file mode 100644 index a363f727..00000000 --- a/src/Glimpse.Agent.Core/Internal/Tabs/HeadersTab.cs +++ /dev/null @@ -1,20 +0,0 @@ -//using Glimpse.Agent.Inspectors; -//using Microsoft.AspNet.Http; - -//namespace Glimpse.Agent.AspNet.Internal.Tabs -//{ -// // TODO: Delete me. This tab isn't intended to stick around, it's just a sample of a Tab. -// public class HeadersTab : Tab -// { -// public override string Name => "Headers"; - -// public override object GetData(HttpContext context) -// { -// return new -// { -// Request = context.Request.Headers, -// Response = context.Response.Headers -// }; -// } -// } -//} diff --git a/src/Glimpse.Agent.Core/Messages/UserIdentificationMessage.cs b/src/Glimpse.Agent.Core/Messages/UserIdentificationMessage.cs index aa624e29..772c5a46 100644 --- a/src/Glimpse.Agent.Core/Messages/UserIdentificationMessage.cs +++ b/src/Glimpse.Agent.Core/Messages/UserIdentificationMessage.cs @@ -1,4 +1,3 @@ -using Glimpse.Agent.Internal.Messaging; using Glimpse.Internal; namespace Glimpse.Agent.Messages diff --git a/src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs b/src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs index 5aacd59b..77ddf026 100644 --- a/src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs +++ b/src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs @@ -3,7 +3,7 @@ using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; -using Glimpse.Agent.Internal.Messaging; +using Glimpse.Agent.Messaging; using Glimpse.Internal; using Glimpse.Platform; diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageConverter.cs b/src/Glimpse.Agent.Core/Messaging/DefaultMessageConverter.cs similarity index 86% rename from src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageConverter.cs rename to src/Glimpse.Agent.Core/Messaging/DefaultMessageConverter.cs index 9fd10391..d9c8c41b 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageConverter.cs +++ b/src/Glimpse.Agent.Core/Messaging/DefaultMessageConverter.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { - // Glimpse servers & clients depend on this behavior. - // As such, this type is marked internal to prevent tampering - internal class DefaultMessageConverter : IMessageConverter + public class DefaultMessageConverter : IMessageConverter { public DefaultMessageConverter(IMessagePayloadFormatter payloadFormatter, IMessageIndexProcessor indexProcessor, IMessageTypeProcessor typeProcessor) { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageIndexProcessor.cs b/src/Glimpse.Agent.Core/Messaging/DefaultMessageIndexProcessor.cs similarity index 89% rename from src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageIndexProcessor.cs rename to src/Glimpse.Agent.Core/Messaging/DefaultMessageIndexProcessor.cs index 29842a14..035e8cbe 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageIndexProcessor.cs +++ b/src/Glimpse.Agent.Core/Messaging/DefaultMessageIndexProcessor.cs @@ -6,15 +6,15 @@ using System.Linq.Expressions; using System.Reflection; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public class DefaultMessageIndexProcessor : IMessageIndexProcessor { - private readonly static Type _objectType = typeof(object); - private readonly static Type _dictionaryType = typeof(Dictionary); - private readonly static MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) }); - private readonly static ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary).GetConstructor(new[] { _dictionaryType }); - private readonly static ConcurrentDictionary>> _methodCache = new ConcurrentDictionary>>(); + private static readonly Type _objectType = typeof(object); + private static readonly Type _dictionaryType = typeof(Dictionary); + private static readonly MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) }); + private static readonly ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary).GetConstructor(new[] { _dictionaryType }); + private static readonly ConcurrentDictionary>> _methodCache = new ConcurrentDictionary>>(); public virtual IReadOnlyDictionary Derive(object payload) { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessagePayloadFormatter.cs b/src/Glimpse.Agent.Core/Messaging/DefaultMessagePayloadFormatter.cs similarity index 96% rename from src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessagePayloadFormatter.cs rename to src/Glimpse.Agent.Core/Messaging/DefaultMessagePayloadFormatter.cs index 0a9472c6..6f33a19d 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessagePayloadFormatter.cs +++ b/src/Glimpse.Agent.Core/Messaging/DefaultMessagePayloadFormatter.cs @@ -3,7 +3,7 @@ using Glimpse.Internal.Serialization; using Newtonsoft.Json; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public class DefaultMessagePayloadFormatter : IMessagePayloadFormatter { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageTypeProcessor.cs b/src/Glimpse.Agent.Core/Messaging/DefaultMessageTypeProcessor.cs similarity index 96% rename from src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageTypeProcessor.cs rename to src/Glimpse.Agent.Core/Messaging/DefaultMessageTypeProcessor.cs index c351adff..d14f9298 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageTypeProcessor.cs +++ b/src/Glimpse.Agent.Core/Messaging/DefaultMessageTypeProcessor.cs @@ -5,7 +5,7 @@ using Glimpse.Internal.Extensions; using Glimpse.Messaging; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public class DefaultMessageTypeProcessor : IMessageTypeProcessor { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageConverter.cs b/src/Glimpse.Agent.Core/Messaging/IMessageConverter.cs similarity index 75% rename from src/Glimpse.Agent.Core/Internal/Messaging/IMessageConverter.cs rename to src/Glimpse.Agent.Core/Messaging/IMessageConverter.cs index 7d29586d..aabd7dc1 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageConverter.cs +++ b/src/Glimpse.Agent.Core/Messaging/IMessageConverter.cs @@ -1,4 +1,4 @@ -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public interface IMessageConverter { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageIndexProcessor.cs b/src/Glimpse.Agent.Core/Messaging/IMessageIndexProcessor.cs similarity index 79% rename from src/Glimpse.Agent.Core/Internal/Messaging/IMessageIndexProcessor.cs rename to src/Glimpse.Agent.Core/Messaging/IMessageIndexProcessor.cs index f1515c8f..0ff8c8fe 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageIndexProcessor.cs +++ b/src/Glimpse.Agent.Core/Messaging/IMessageIndexProcessor.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public interface IMessageIndexProcessor { diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/IMessagePayloadFormatter.cs b/src/Glimpse.Agent.Core/Messaging/IMessagePayloadFormatter.cs similarity index 86% rename from src/Glimpse.Agent.Core/Internal/Messaging/IMessagePayloadFormatter.cs rename to src/Glimpse.Agent.Core/Messaging/IMessagePayloadFormatter.cs index c2037380..7031ec8b 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/IMessagePayloadFormatter.cs +++ b/src/Glimpse.Agent.Core/Messaging/IMessagePayloadFormatter.cs @@ -1,4 +1,4 @@ -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { // TODO: Review as I don't love passing IMessage into this, but // not sure if there is a better way of doing it. diff --git a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageTypeProcessor.cs b/src/Glimpse.Agent.Core/Messaging/IMessageTypeProcessor.cs similarity index 77% rename from src/Glimpse.Agent.Core/Internal/Messaging/IMessageTypeProcessor.cs rename to src/Glimpse.Agent.Core/Messaging/IMessageTypeProcessor.cs index 0d73d9ac..acb7aa0a 100644 --- a/src/Glimpse.Agent.Core/Internal/Messaging/IMessageTypeProcessor.cs +++ b/src/Glimpse.Agent.Core/Messaging/IMessageTypeProcessor.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Glimpse.Agent.Internal.Messaging +namespace Glimpse.Agent.Messaging { public interface IMessageTypeProcessor {