-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StackExchange.Redis instrumentation for .NET Core 3.1+ (#979)
* Cleanup conditional references * StackExchange.Redis intrumentation * code review feedback * Support from 2.0.405 * GraphQL - typo fixes in defined integrations * remove launch settings * typo fix in tests * cleanup file header Co-authored-by: Chris Ventura <[email protected]>
- Loading branch information
1 parent
7d0c440
commit 076306d
Showing
20 changed files
with
688 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ry.AutoInstrumentation/Instrumentations/StackExchangeRedis/StackExchangeRedisConstants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// <copyright file="StackExchangeRedisConstants.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
#if NETCOREAPP3_1_OR_GREATER | ||
|
||
namespace OpenTelemetry.AutoInstrumentation.Instrumentations.StackExchangeRedis; | ||
|
||
internal static class StackExchangeRedisConstants | ||
{ | ||
public const string AssemblyName = "StackExchange.Redis"; | ||
|
||
public const string MinimumVersion = "2.0.0"; // this is AssemblyVersion, all 2.* versions are released with this value | ||
public const string MaximumVersion = "2.65535.65535"; | ||
public const string IntegrationName = "StackExchangeRedis"; | ||
|
||
public const string ConnectionMultiplexerTypeName = "StackExchange.Redis.ConnectionMultiplexer"; | ||
public const string ConfigurationOptionsTypeName = "StackExchange.Redis.ConfigurationOptions"; | ||
public const string TextWriterTypeName = "System.IO.TextWriter"; | ||
public const string TaskConnectionMultiplexerTypeName = $"System.Threading.Tasks.Task`1[{ConnectionMultiplexerTypeName}]"; | ||
public const string NullableServerType = $"System.Nullable`1[{ServerTypeTypeName}]"; | ||
|
||
public const string ConnectImplMethodName = "ConnectImpl"; | ||
public const string ConnectImplAsyncMethodName = "ConnectImplAsync"; | ||
|
||
private const string ServerTypeTypeName = "StackExchange.Redis.ServerType"; | ||
} | ||
#endif |
40 changes: 40 additions & 0 deletions
40
....AutoInstrumentation/Instrumentations/StackExchangeRedis/StackExchangeRedisInitializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// <copyright file="StackExchangeRedisInitializer.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
#if NETCOREAPP3_1_OR_GREATER | ||
|
||
using System; | ||
using OpenTelemetry.AutoInstrumentation.Configuration; | ||
|
||
namespace OpenTelemetry.AutoInstrumentation.Instrumentations.StackExchangeRedis; | ||
|
||
internal static class StackExchangeRedisInitializer | ||
{ | ||
public static void Initialize(object connection) | ||
{ | ||
if (connection != null && Instrumentation.TracerSettings.EnabledInstrumentations.Contains(TracerInstrumentation.StackExchangeRedis)) | ||
{ | ||
var instrumentationType = Type.GetType("OpenTelemetry.Instrumentation.StackExchangeRedis.StackExchangeRedisCallsInstrumentation, OpenTelemetry.Instrumentation.StackExchangeRedis"); | ||
var optionsInstrumentationType = Type.GetType("OpenTelemetry.Instrumentation.StackExchangeRedis.StackExchangeRedisCallsInstrumentationOptions, OpenTelemetry.Instrumentation.StackExchangeRedis"); | ||
|
||
var options = Activator.CreateInstance(optionsInstrumentationType); | ||
var instrumentation = Activator.CreateInstance(instrumentationType, connection, options); | ||
|
||
Instrumentation.LifespanManager.Track(instrumentation); | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.