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

Commit a062780

Browse files
committed
Next round of moves in agent
1 parent 7b5cf60 commit a062780

15 files changed

Lines changed: 62 additions & 66 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.AspNet.Http;
2+
using Glimpse.Agent;
3+
4+
namespace Glimpse.AgentServer.Dnx.Mvc.Sample.Framework
5+
{
6+
public class ConnectionTab : Tab
7+
{
8+
public override string Name => "Connection";
9+
10+
public override object GetData(HttpContext context)
11+
{
12+
var connection = context.Connection;
13+
return new
14+
{
15+
ClientCertificate = connection.ClientCertificate?.ToString(),
16+
connection.IsLocal,
17+
LocalIpAddress = connection.LocalIpAddress.ToString(),
18+
connection.LocalPort,
19+
RemoteIpAddress = connection.RemoteIpAddress.ToString(),
20+
connection.RemotePort
21+
};
22+
}
23+
24+
public override TabExecute TabExecuteWhen => TabExecute.BeforeResponse;
25+
}
26+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Glimpse.Agent;
2+
using Microsoft.AspNet.Http;
3+
4+
namespace Glimpse.AgentServer.Dnx.Mvc.Sample.Framework
5+
{
6+
// TODO: Delete me. This tab isn't intended to stick around, it's just a sample of a Tab.
7+
public class HeadersTab : Tab
8+
{
9+
public override string Name => "Headers";
10+
11+
public override object GetData(HttpContext context)
12+
{
13+
return new
14+
{
15+
Request = context.Request.Headers,
16+
Response = context.Response.Headers
17+
};
18+
}
19+
}
20+
}

src/Glimpse.Agent.Core/DependencyInjection/AgentRegisterServices.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
using Microsoft.Extensions.DependencyInjection.Extensions;
55
using Microsoft.Extensions.OptionsModel;
66
using Glimpse.Agent;
7-
using Glimpse.Agent.Internal.Messaging;
87
using Glimpse.Agent.Configuration;
98
using Glimpse.Agent.Inspectors;
109
using Glimpse.Initialization;
1110
using System.Linq;
11+
using Glimpse.Agent.Messaging;
1212
using Glimpse.Configuration;
1313
using Glimpse.Platform;
1414

src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Glimpse.Agent.Core/Internal/Tabs/HeadersTab.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Glimpse.Agent.Core/Messages/UserIdentificationMessage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Glimpse.Agent.Internal.Messaging;
21
using Glimpse.Internal;
32

43
namespace Glimpse.Agent.Messages

src/Glimpse.Agent.Core/Messaging/DefaultAgentBroker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Reactive.Linq;
44
using System.Reactive.Subjects;
55
using System.Threading;
6-
using Glimpse.Agent.Internal.Messaging;
6+
using Glimpse.Agent.Messaging;
77
using Glimpse.Internal;
88
using Glimpse.Platform;
99

src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageConverter.cs renamed to src/Glimpse.Agent.Core/Messaging/DefaultMessageConverter.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System;
22
using System.Collections.Generic;
33

4-
namespace Glimpse.Agent.Internal.Messaging
4+
namespace Glimpse.Agent.Messaging
55
{
6-
// Glimpse servers & clients depend on this behavior.
7-
// As such, this type is marked internal to prevent tampering
8-
internal class DefaultMessageConverter : IMessageConverter
6+
public class DefaultMessageConverter : IMessageConverter
97
{
108
public DefaultMessageConverter(IMessagePayloadFormatter payloadFormatter, IMessageIndexProcessor indexProcessor, IMessageTypeProcessor typeProcessor)
119
{

src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessageIndexProcessor.cs renamed to src/Glimpse.Agent.Core/Messaging/DefaultMessageIndexProcessor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
using System.Linq.Expressions;
77
using System.Reflection;
88

9-
namespace Glimpse.Agent.Internal.Messaging
9+
namespace Glimpse.Agent.Messaging
1010
{
1111
public class DefaultMessageIndexProcessor : IMessageIndexProcessor
1212
{
13-
private readonly static Type _objectType = typeof(object);
14-
private readonly static Type _dictionaryType = typeof(Dictionary<string, object>);
15-
private readonly static MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) });
16-
private readonly static ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary<string, object>).GetConstructor(new[] { _dictionaryType });
17-
private readonly static ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>> _methodCache = new ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>>();
13+
private static readonly Type _objectType = typeof(object);
14+
private static readonly Type _dictionaryType = typeof(Dictionary<string, object>);
15+
private static readonly MethodInfo _addMethodInfo = _dictionaryType.GetMethod("Add", new[] { typeof(string), typeof(object) });
16+
private static readonly ConstructorInfo _constructorInfo = typeof(ReadOnlyDictionary<string, object>).GetConstructor(new[] { _dictionaryType });
17+
private static readonly ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>> _methodCache = new ConcurrentDictionary<Type, Func<object, IReadOnlyDictionary<string, object>>>();
1818

1919
public virtual IReadOnlyDictionary<string, object> Derive(object payload)
2020
{

src/Glimpse.Agent.Core/Internal/Messaging/DefaultMessagePayloadFormatter.cs renamed to src/Glimpse.Agent.Core/Messaging/DefaultMessagePayloadFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Glimpse.Internal.Serialization;
44
using Newtonsoft.Json;
55

6-
namespace Glimpse.Agent.Internal.Messaging
6+
namespace Glimpse.Agent.Messaging
77
{
88
public class DefaultMessagePayloadFormatter : IMessagePayloadFormatter
99
{

0 commit comments

Comments
 (0)