Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Next round of moves in agent
Browse files Browse the repository at this point in the history
  • Loading branch information
avanderhoorn committed Dec 16, 2015
1 parent 7b5cf60 commit a062780
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}
20 changes: 20 additions & 0 deletions sample/Glimpse.AgentServer.Dnx.Mvc.Sample/Framework/HeadersTab.cs
Original file line number Diff line number Diff line change
@@ -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
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
27 changes: 0 additions & 27 deletions src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs

This file was deleted.

20 changes: 0 additions & 20 deletions src/Glimpse.Agent.Core/Internal/Tabs/HeadersTab.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Glimpse.Agent.Internal.Messaging;
using Glimpse.Internal;

namespace Glimpse.Agent.Messages
Expand Down
2 changes: 1 addition & 1 deletion src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object>);
private readonly static MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) });
private readonly static ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary<string, object>).GetConstructor(new[] { _dictionaryType });
private readonly static ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>> _methodCache = new ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>>();
private static readonly Type _objectType = typeof(object);
private static readonly Type _dictionaryType = typeof(Dictionary<string, object>);
private static readonly MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) });
private static readonly ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary<string, object>).GetConstructor(new[] { _dictionaryType });
private static readonly ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>> _methodCache = new ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>>();

public virtual IReadOnlyDictionary<string, object> Derive(object payload)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Glimpse.Internal.Serialization;
using Newtonsoft.Json;

namespace Glimpse.Agent.Internal.Messaging
namespace Glimpse.Agent.Messaging
{
public class DefaultMessagePayloadFormatter : IMessagePayloadFormatter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Glimpse.Internal.Extensions;
using Glimpse.Messaging;

namespace Glimpse.Agent.Internal.Messaging
namespace Glimpse.Agent.Messaging
{
public class DefaultMessageTypeProcessor : IMessageTypeProcessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Glimpse.Agent.Internal.Messaging
namespace Glimpse.Agent.Messaging
{
public interface IMessageConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Glimpse.Agent.Internal.Messaging
namespace Glimpse.Agent.Messaging
{
public interface IMessageIndexProcessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Glimpse.Agent.Internal.Messaging
namespace Glimpse.Agent.Messaging
{
public interface IMessageTypeProcessor
{
Expand Down

0 comments on commit a062780

Please sign in to comment.