Skip to content

Commit

Permalink
Add Npgsql 7.x support to profiler (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Jun 9, 2023
1 parent 9ebec16 commit 235468d
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 96 deletions.
8 changes: 4 additions & 4 deletions build/scripts/Targets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ module Main =

Targets.Target("build", ["restore"; "clean"; "version"], Build.Build)

Targets.Target("build-profiler", ["build"; "clean-profiler"], Build.BuildProfiler)

Targets.Target("profiler-integrations", ["build-profiler"], Build.ProfilerIntegrations)
Targets.Target("profiler-integrations", Build.ProfilerIntegrations)

Targets.Target("profiler-zip", ["profiler-integrations"], fun _ ->
Targets.Target("build-profiler", ["build"; "profiler-integrations"; "clean-profiler" ], Build.BuildProfiler)

Targets.Target("profiler-zip", ["build-profiler"], fun _ ->

printfn "Running profiler-zip..."
let projs = !! (Paths.ProfilerProjFile "Elastic.Apm.Profiler.Managed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public InstrumentNpgsqlAttribute()
Assembly = "Npgsql";
Type = "Npgsql.NpgsqlCommand";
MinimumVersion = "4.0.0";
MaximumVersion = "6.*.*";
MaximumVersion = "7.*.*";
Group = "NpgsqlCommand";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ namespace Elastic.Apm.Profiler.Managed.Integrations.AdoNet
/// </summary>
[InstrumentMySqlAttribute(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32,
ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32,
ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlite(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSql(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlClient(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32,
ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentSystemData(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentSystemDataCommon(Method = ExecuteNonQueryAsync, ReturnType = TaskInt32, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
public class CommandExecuteNonQueryAsyncIntegration
Expand Down Expand Up @@ -67,3 +64,4 @@ public static CallTargetState OnMethodBegin<TTarget>(TTarget instance, Cancellat
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@ namespace Elastic.Apm.Profiler.Managed.Integrations.AdoNet
/// int [Command].ExecuteNonQuery(CommandBehavior)
/// </summary>
[InstrumentMySqlAttribute(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentNpgsql(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccess(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentSystemDataSqlite(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccess(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentSystemDataSqlite(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentSystemDataSql(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentSystemDataSqlClient(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentSystemDataSqlClient(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteNonQuery, ReturnType = ClrTypeNames.Int32, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
public class CommandExecuteNonQueryWithBehaviorIntegration
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace Elastic.Apm.Profiler.Managed.Integrations.AdoNet
/// [*]DataReader [Command].ExecuteReader()
/// </summary>
[InstrumentMySqlAttribute(Method = ExecuteReader, ReturnType = MySql.DataReader)]
[InstrumentNpgsql(Method = ExecuteReader, ReturnType = Npgsql.DataReader)]
[InstrumentOracleManagedDataAccess(Method = ExecuteReader, ReturnType = OracleManagedDataAccess.DataReader)]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteReader, ReturnType = OracleManagedDataAccess.DataReader)]
[InstrumentMicrosoftDataSqlite(Method = ExecuteReader, ReturnType = MicrosoftDataSqlite.DataReader)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,26 @@ namespace Elastic.Apm.Profiler.Managed.Integrations.AdoNet
/// Task[*DataReader] [Command].ExecuteReaderAsync(CommandBehavior, CancellationToken)
/// Task[DbDataReader] [Command].ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)
/// </summary>
[InstrumentMySqlAttribute(Method = ExecuteReaderAsync, ReturnType = MySql.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteReaderAsync, ReturnType = Npgsql.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteReaderAsync, ReturnType = OracleManagedDataAccess.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteReaderAsync, ReturnType = OracleManagedDataAccess.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteReaderAsync, ReturnType = MicrosoftDataSqlite.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlite(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlite.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSql(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlServer.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlClient(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlServer.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteReaderAsync, ReturnType = MicrosoftDataSqlServer.TaskDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMySqlAttribute(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSql(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlClient(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemData(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataCommon(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMySqlAttribute(Method = ExecuteReaderAsync, ReturnType = MySql.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteReaderAsync, ReturnType = Npgsql.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteReaderAsync, ReturnType = Npgsql.TaskDataReader, ParameterTypes = new[] { ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteReaderAsync, ReturnType = OracleManagedDataAccess.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteReaderAsync, ReturnType = OracleManagedDataAccess.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteReaderAsync, ReturnType = MicrosoftDataSqlite.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlite(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlite.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSql(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlServer.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlClient(Method = ExecuteReaderAsync, ReturnType = SystemDataSqlServer.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteReaderAsync, ReturnType = MicrosoftDataSqlServer.TaskDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMySqlAttribute(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentNpgsql(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccess(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlite(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSql(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataSqlClient(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentMicrosoftDataSqlClient(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemData(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
[InstrumentSystemDataCommon(Method = ExecuteDbDataReaderAsync, ReturnType = TaskDbDataReader, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior, ClrTypeNames.CancellationToken })]
public class CommandExecuteReaderWithBehaviorAsyncIntegration
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace Elastic.Apm.Profiler.Managed.Integrations.AdoNet
/// object [Command].ExecuteScalar(CommandBehavior)
/// </summary>
[InstrumentMySqlAttribute(Method = ExecuteScalar, ReturnType = ClrTypeNames.Object, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentNpgsql(Method = ExecuteScalar, ReturnType = ClrTypeNames.Object, ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccess(Method = ExecuteScalar, ReturnType = ClrTypeNames.Object,
ParameterTypes = new[] { AdoNetTypeNames.CommandBehavior })]
[InstrumentOracleManagedDataAccessCore(Method = ExecuteScalar, ReturnType = ClrTypeNames.Object,
Expand Down
Loading

0 comments on commit 235468d

Please sign in to comment.