Skip to content

Commit

Permalink
Add redis instrumentation (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
vreynolds authored Jul 16, 2021
1 parent 9966dd1 commit a745c8b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Honeycomb.OpenTelemetry/Honeycomb.OpenTelemetry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc6" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc6" />
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.0.0-rc6" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc6" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
8 changes: 7 additions & 1 deletion src/Honeycomb.OpenTelemetry/HoneycombOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration;
using OpenTelemetry.Trace;
using StackExchange.Redis;
using System.Reflection;
using System.Collections.Generic;

Expand Down Expand Up @@ -59,6 +60,11 @@ public class HoneycombOptions
/// </summary>
public string ServiceVersion { get; set; } = s_defaultServiceVersion;

/// <summary>
/// Redis connection to enable Redis instrumentation.
/// </summary>
public IConnectionMultiplexer RedisConnection { get; set; }

private static Dictionary<string, string> CommandLineSwitchMap = new Dictionary<string, string>
{
{"--honeycomb-apikey", "apikey"},
Expand Down Expand Up @@ -93,4 +99,4 @@ public static HoneycombOptions FromConfiguration(IConfiguration configuration)
.Get<HoneycombOptions>();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public static TracerProviderBuilder UseHoneycomb(this TracerProviderBuilder buil
.AddHttpClientInstrumentation()
.AddSqlClientInstrumentation();

if (options.RedisConnection != null)
{
builder.AddRedisInstrumentation(options.RedisConnection);
}

#if NETSTANDARD2_1
builder.AddGrpcClientInstrumentation();
#endif
Expand Down

0 comments on commit a745c8b

Please sign in to comment.