-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for OTEL_DOTNET_AUTO_ORACLEMDA_SET_DBSTATEMENT_FOR_TEXT
- Loading branch information
Showing
9 changed files
with
105 additions
and
15 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
41 changes: 41 additions & 0 deletions
41
src/OpenTelemetry.AutoInstrumentation/Loading/Initializers/OracleMdaInitializer.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,41 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Reflection; | ||
using OpenTelemetry.AutoInstrumentation.Configurations; | ||
|
||
namespace OpenTelemetry.AutoInstrumentation.Loading.Initializers; | ||
|
||
internal class OracleMdaInitializer : InstrumentationInitializer | ||
{ | ||
private readonly TracerSettings _tracerSettings; | ||
|
||
public OracleMdaInitializer(TracerSettings tracerSettings) | ||
: base("Oracle.ManagedDataAccess") | ||
{ | ||
_tracerSettings = tracerSettings; | ||
} | ||
|
||
public override void Initialize(ILifespanManager lifespanManager) | ||
{ | ||
var oracleCommandType = Type.GetType("Oracle.ManagedDataAccess.Client.OracleCommand, Oracle.ManagedDataAccess"); | ||
var oracleActivitySourceType = Type.GetType("Oracle.ManagedDataAccess.OpenTelemetry.OracleActivitySource, Oracle.ManagedDataAccess"); | ||
|
||
if (oracleCommandType == null || oracleActivitySourceType == null) | ||
{ | ||
return; | ||
} | ||
|
||
var oracleActivitySourceFieldInfo = oracleCommandType.GetField("OracleActivitySource", BindingFlags.Static | BindingFlags.NonPublic); | ||
var oracleActivitySourceField = oracleActivitySourceFieldInfo?.GetValue(null); | ||
|
||
if (oracleActivitySourceField == null) | ||
{ | ||
return; | ||
} | ||
|
||
var setDbStatementForTextPropertyInfo = oracleActivitySourceType.GetProperty("SetDbStatementForText", BindingFlags.Instance | BindingFlags.NonPublic); | ||
|
||
setDbStatementForTextPropertyInfo?.SetValue(oracleActivitySourceField, _tracerSettings.InstrumentationOptions.OracleMdaSetDbStatementForText); | ||
} | ||
} |
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