Skip to content

Commit ce491a0

Browse files
committed
add support for StackExchange.Redis.StrongName (DataDog#286)
* add assembly name "StackExchange.Redis.StrongName" as synonym for "StackExchange.Redis"
1 parent 6a713a2 commit ce491a0

File tree

4 files changed

+69
-6
lines changed

4 files changed

+69
-6
lines changed

integrations.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,22 @@
324324
"signature": "10 01 04 1E 00 1C 1C 1C 1C"
325325
}
326326
},
327+
{
328+
"caller": {
329+
"assembly": "StackExchange.Redis.StrongName"
330+
},
331+
"target": {
332+
"assembly": "StackExchange.Redis.StrongName",
333+
"type": "StackExchange.Redis.ConnectionMultiplexer",
334+
"method": "ExecuteSyncImpl"
335+
},
336+
"wrapper": {
337+
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.8.1.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
338+
"type": "Datadog.Trace.ClrProfiler.Integrations.StackExchange.Redis.ConnectionMultiplexer",
339+
"method": "ExecuteSyncImpl",
340+
"signature": "10 01 04 1E 00 1C 1C 1C 1C"
341+
}
342+
},
327343
{
328344
"caller": {
329345
"assembly": "StackExchange.Redis"
@@ -340,6 +356,22 @@
340356
"signature": "10 01 05 1C 1C 1C 1C 1C 1C"
341357
}
342358
},
359+
{
360+
"caller": {
361+
"assembly": "StackExchange.Redis.StrongName"
362+
},
363+
"target": {
364+
"assembly": "StackExchange.Redis.StrongName",
365+
"type": "StackExchange.Redis.ConnectionMultiplexer",
366+
"method": "ExecuteAsyncImpl"
367+
},
368+
"wrapper": {
369+
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.8.1.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
370+
"type": "Datadog.Trace.ClrProfiler.Integrations.StackExchange.Redis.ConnectionMultiplexer",
371+
"method": "ExecuteAsyncImpl",
372+
"signature": "10 01 05 1C 1C 1C 1C 1C 1C"
373+
}
374+
},
343375
{
344376
"caller": {
345377
"assembly": "StackExchange.Redis"
@@ -355,6 +387,22 @@
355387
"method": "ExecuteAsync",
356388
"signature": "10 01 04 1C 1C 1C 1C 1C"
357389
}
390+
},
391+
{
392+
"caller": {
393+
"assembly": "StackExchange.Redis.StrongName"
394+
},
395+
"target": {
396+
"assembly": "StackExchange.Redis.StrongName",
397+
"type": "StackExchange.Redis.RedisBase",
398+
"method": "ExecuteAsync"
399+
},
400+
"wrapper": {
401+
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.8.1.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
402+
"type": "Datadog.Trace.ClrProfiler.Integrations.StackExchange.Redis.RedisBatch",
403+
"method": "ExecuteAsync",
404+
"signature": "10 01 04 1C 1C 1C 1C 1C"
405+
}
358406
}
359407
]
360408
},

src/Datadog.Trace.ClrProfiler.Managed/Integrations/StackExchange.Redis/ConnectionMultiplexer.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public static class ConnectionMultiplexer
2222
CallerAssembly = "StackExchange.Redis",
2323
TargetAssembly = "StackExchange.Redis",
2424
TargetType = "StackExchange.Redis.ConnectionMultiplexer")]
25+
[InterceptMethod(
26+
Integration = "StackExchangeRedis",
27+
CallerAssembly = "StackExchange.Redis.StrongName",
28+
TargetAssembly = "StackExchange.Redis.StrongName",
29+
TargetType = "StackExchange.Redis.ConnectionMultiplexer")]
2530
public static T ExecuteSyncImpl<T>(object multiplexer, object message, object processor, object server)
2631
{
2732
var resultType = typeof(T);
@@ -67,6 +72,11 @@ public static T ExecuteSyncImpl<T>(object multiplexer, object message, object pr
6772
CallerAssembly = "StackExchange.Redis",
6873
TargetAssembly = "StackExchange.Redis",
6974
TargetType = "StackExchange.Redis.ConnectionMultiplexer")]
75+
[InterceptMethod(
76+
Integration = "StackExchangeRedis",
77+
CallerAssembly = "StackExchange.Redis.StrongName",
78+
TargetAssembly = "StackExchange.Redis.StrongName",
79+
TargetType = "StackExchange.Redis.ConnectionMultiplexer")]
7080
public static object ExecuteAsyncImpl<T>(object multiplexer, object message, object processor, object state, object server)
7181
{
7282
return ExecuteAsyncImplInternal<T>(multiplexer, message, processor, state, server);

src/Datadog.Trace.ClrProfiler.Managed/Integrations/StackExchange.Redis/RedisBatch.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public static class RedisBatch
2222
CallerAssembly = "StackExchange.Redis",
2323
TargetAssembly = "StackExchange.Redis",
2424
TargetType = "StackExchange.Redis.RedisBase")]
25+
[InterceptMethod(
26+
Integration = "StackExchangeRedis",
27+
CallerAssembly = "StackExchange.Redis.StrongName",
28+
TargetAssembly = "StackExchange.Redis.StrongName",
29+
TargetType = "StackExchange.Redis.RedisBase")]
2530
public static object ExecuteAsync<T>(object redisBase, object message, object processor, object server)
2631
{
2732
return ExecuteAsyncInternal<T>(redisBase, message, processor, server);

test/Datadog.Trace.ClrProfiler.IntegrationTests/StackExchangeRedisTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace Datadog.Trace.ClrProfiler.IntegrationTests
1010
{
1111
public class StackExchangeRedisTests : TestHelper
1212
{
13-
private const int AgentPort = 9003;
14-
1513
public StackExchangeRedisTests(ITestOutputHelper output)
1614
: base("RedisCore", output)
1715
{
@@ -21,9 +19,11 @@ public StackExchangeRedisTests(ITestOutputHelper output)
2119
[Trait("Category", "EndToEnd")]
2220
public void SubmitsTraces()
2321
{
22+
int agentPort = TcpPortProvider.GetOpenPort();
2423
var prefix = $"{BuildParameters.Configuration}.{BuildParameters.TargetFramework}.";
25-
using (var agent = new MockTracerAgent(AgentPort))
26-
using (var processResult = RunSampleAndWaitForExit(AgentPort, arguments: $"StackExchange {prefix}"))
24+
25+
using (var agent = new MockTracerAgent(agentPort))
26+
using (var processResult = RunSampleAndWaitForExit(agentPort, arguments: $"StackExchange {prefix}"))
2727
{
2828
Assert.True(processResult.ExitCode >= 0, $"Process exited with code {processResult.ExitCode}");
2929

@@ -64,7 +64,7 @@ public void SubmitsTraces()
6464
{ "PFCOUNT", $"PFCOUNT {batchPrefix}HyperLogLogLengthAsync" },
6565
{ "PFMERGE", $"PFMERGE {batchPrefix}HyperLogLogMergeAsync" },
6666
{ "PING", $"PING" },
67-
{ "DEL", $"DEL key" },
67+
// { "DEL", $"DEL key" },
6868
{ "DUMP", $"DUMP key" },
6969
{ "EXISTS", $"EXISTS key" },
7070
{ "PEXPIREAT", $"PEXPIREAT key" },
@@ -161,7 +161,7 @@ public void SubmitsTraces()
161161
{ "PFADD", $"PFADD {dbPrefix}HyperLogLog" },
162162
{ "PFCOUNT", $"PFCOUNT {dbPrefix}HyperLogLog" },
163163
{ "PFMERGE", $"PFMERGE {dbPrefix}HyperLogLog2" },
164-
{ "DEL", $"DEL {dbPrefix}Key" },
164+
// { "DEL", $"DEL {dbPrefix}Key" },
165165
{ "DUMP", $"DUMP {dbPrefix}Key" },
166166
{ "EXISTS", $"EXISTS {dbPrefix}Key" },
167167
{ "PEXPIREAT", $"PEXPIREAT {dbPrefix}Key" },

0 commit comments

Comments
 (0)