Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autogenerate integrations.json #232

Merged
merged 23 commits into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d6175e5
add [InterceptMethodAttribute] and [InterceptTypeAttribute]
lucaspimentel Dec 11, 2018
992397c
add new project to generate integration definitions JSON from attributes
lucaspimentel Dec 11, 2018
7646d36
remove Samples.MongoDB project (that was meant for a different branch)
lucaspimentel Dec 11, 2018
8d13a54
reorder integrations alphabetically
lucaspimentel Dec 11, 2018
373e969
wip
lucaspimentel Dec 11, 2018
66222c5
add [InterceptMethod] to all integrations
lucaspimentel Dec 11, 2018
d1b72ee
rename RedisNativeClient to ServiceStackRedisIntegration and move up …
lucaspimentel Dec 11, 2018
68d46a0
rename Pipeline to ElasticsearchNetIntegration and move up to Integra…
lucaspimentel Dec 11, 2018
2b4cff7
rename Base to StackExchangeRedisHelper and make it a static class
lucaspimentel Dec 11, 2018
7f2bbbb
rename static class Redis to RedisHelper
lucaspimentel Dec 11, 2018
0a99b2d
target .NET Framework so we can export the ASP.NET integrations (MVC,…
lucaspimentel Dec 11, 2018
1196a7a
order integrations alphabetically (second attempt)
lucaspimentel Dec 12, 2018
c47c9c1
fix integration name
lucaspimentel Dec 12, 2018
5b4fc82
add missing integration attribute
lucaspimentel Dec 12, 2018
feb7da4
clean up code
lucaspimentel Dec 12, 2018
176ffff
clean up code
lucaspimentel Dec 12, 2018
4b03acb
revert method name because we look up by name and we don't use signat…
lucaspimentel Dec 12, 2018
2a976af
fix signature for generic methods
lucaspimentel Dec 12, 2018
d582b1b
replace generate integration.json
lucaspimentel Dec 12, 2018
603bc47
fix brace location (StyleCop)
lucaspimentel Dec 12, 2018
a782529
add missing xml-doc comments
lucaspimentel Dec 12, 2018
12f1690
add comments
lucaspimentel Dec 12, 2018
5d49840
add IMAGE_CEE_CS_CALLCONV_GENERIC constant
lucaspimentel Dec 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake binaries
tools/
# vscode
.vscode/
# Benchmark results
Expand Down
21 changes: 21 additions & 0 deletions Datadog.Trace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Elasticsearch", "sa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AspNetMvc4", "samples\Samples.AspNetMvc4\Samples.AspNetMvc4.csproj", "{6D86109F-B7C9-477D-86D7-45735A3A0818}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{5D8E1F81-B820-4736-B797-271B0FE787EE}"
ProjectSection(SolutionItems) = preProject
tools\Directory.Build.props = tools\Directory.Build.props
tools\GlobalSuppressions.cs = tools\GlobalSuppressions.cs
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateIntegrationDefinitions", "tools\GenerateIntegrationDefinitions\GenerateIntegrationDefinitions.csproj", "{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -399,6 +407,18 @@ Global
{6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x64.Build.0 = Release|Any CPU
{6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x86.ActiveCfg = Release|Any CPU
{6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x86.Build.0 = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x64.ActiveCfg = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x64.Build.0 = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x86.ActiveCfg = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x86.Build.0 = Debug|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|Any CPU.Build.0 = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x64.ActiveCfg = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x64.Build.0 = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x86.ActiveCfg = Release|Any CPU
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -427,6 +447,7 @@ Global
{F5B27CC4-1DF6-4ECD-A4FD-8200152F9A5A} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{C98950B1-DC4B-43DA-974F-EF2CF325EC2B} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{6D86109F-B7C9-477D-86D7-45735A3A0818} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3} = {5D8E1F81-B820-4736-B797-271B0FE787EE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
Expand Down
142 changes: 71 additions & 71 deletions integrations.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"name": "aspNetCoreMvc2",
"name": "AspNetCoreMvc2",
"method_replacements": [
{
"caller": {
Expand All @@ -15,7 +15,7 @@
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.AspNetCoreMvc2Integration",
"method": "BeforeAction",
"signature": [ 0, 4, 1, 28, 28, 28, 28 ]
"signature": "00 04 01 1C 1C 1C 1C"
}
},
{
Expand All @@ -31,13 +31,13 @@
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.AspNetCoreMvc2Integration",
"method": "AfterAction",
"signature": [ 0, 4, 1, 28, 28, 28, 28 ]
"signature": "00 04 01 1C 1C 1C 1C"
}
}
]
},
{
"name": "aspNetMvc",
"name": "AspNetMvc",
"method_replacements": [
{
"caller": {
Expand All @@ -52,7 +52,7 @@
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.AspNetMvcIntegration",
"method": "BeginInvokeAction",
"signature": [ 0, 5, 28, 28, 28, 28, 28, 28 ]
"signature": "00 05 1C 1C 1C 1C 1C 1C"
}
},
{
Expand All @@ -68,13 +68,13 @@
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.AspNetMvcIntegration",
"method": "EndInvokeAction",
"signature": [ 0, 2, 2, 28, 28 ]
"signature": "00 02 02 1C 1C"
}
}
]
},
{
"name": "aspNetWebApi2",
"name": "AspNetWebApi2",
"method_replacements": [
{
"caller": {},
Expand All @@ -87,7 +87,65 @@
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.AspNetWebApi2Integration",
"method": "ExecuteAsync",
"signature": [ 0, 3, 28, 28, 28, 28 ]
"signature": "00 03 1C 1C 1C 1C"
}
}
]
},
{
"name": "ElasticsearchNet",
"method_replacements": [
{
"caller": {
"assembly": "Elasticsearch.Net"
},
"target": {
"assembly": "Elasticsearch.Net",
"type": "Elasticsearch.Net.IRequestPipeline",
"method": "CallElasticsearch"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.ElasticsearchNetIntegration",
"method": "CallElasticsearch",
"signature": "10 01 02 1C 1C 1C"
}
},
{
"caller": {
"assembly": "Elasticsearch.Net"
},
"target": {
"assembly": "Elasticsearch.Net",
"type": "Elasticsearch.Net.IRequestPipeline",
"method": "CallElasticsearchAsync"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.ElasticsearchNetIntegration",
"method": "CallElasticsearchAsync",
"signature": "10 01 03 1C 1C 1C 1C"
}
}
]
},
{
"name": "ServiceStackRedis",
"method_replacements": [
{
"caller": {
"assembly": "ServiceStack.Redis"
},
"target": {
"assembly": "ServiceStack.Redis",
"type": "ServiceStack.Redis.RedisNativeClient",
"method": "SendReceive"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.ServiceStackRedisIntegration",
"method": "SendReceive",
"signature": "10 01 05 1E 00 1C 1D 1D 05 1C 1C 02"
}
}
]
Expand All @@ -104,13 +162,13 @@
"assembly": "System.Data",
"type": "System.Data.SqlClient.SqlCommand",
"method": "ExecuteReader",
"signature": [ 32, 2, 12, 82, 8, 11, 82, 91, 14 ]
"signature": "20 02 0C 52 08 0B 52 5B 0E"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.SqlServer",
"method": "ExecuteReaderWithMethod",
"signature": [ 0, 3, 28, 28, 8, 14 ]
"signature": "00 03 1C 1C 08 0E"
}
},
{
Expand All @@ -119,13 +177,13 @@
"assembly": "System.Data.SqlClient",
"type": "System.Data.SqlClient.SqlCommand",
"method": "ExecuteReader",
"signature": [ 32, 1, 12, 87, 12, 11, 92 ]
"signature": "20 01 0C 57 0C 0B 5C"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.SqlServer",
"method": "ExecuteReader",
"signature": [ 0, 2, 28, 28, 8 ]
"signature": "00 02 1C 1C 08"
}
}
]
Expand Down Expand Up @@ -182,63 +240,5 @@
}
}
]
},
{
"name": "ServiceStackRedis",
"method_replacements": [
{
"caller": {
"assembly": "ServiceStack.Redis"
},
"target": {
"assembly": "ServiceStack.Redis",
"type": "ServiceStack.Redis.RedisNativeClient",
"method": "SendReceive"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.ServiceStack.Redis.RedisNativeClient",
"method": "SendReceive",
"signature": "10 01 05 1E 00 1C 1D 1D 05 1C 1C 02"
}
}
]
},
{
"name": "Elasticsearch",
"method_replacements": [
{
"caller": {
"assembly": "Elasticsearch.Net"
},
"target": {
"assembly": "Elasticsearch.Net",
"type": "Elasticsearch.Net.IRequestPipeline",
"method": "CallElasticsearch"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.Elasticsearch.Net.Pipeline",
"method": "CallElasticsearch",
"signature": "10 01 02 1C 1C 1C"
}
},
{
"caller": {
"assembly": "Elasticsearch.Net"
},
"target": {
"assembly": "Elasticsearch.Net",
"type": "Elasticsearch.Net.IRequestPipeline",
"method": "CallElasticsearchAsync"
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=0.5.2.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.Elasticsearch.Net.Pipeline",
"method": "CallElasticsearchAsync",
"signature": "10 01 03 1C 1C 1C 1C"
}
}
]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public AspNetCoreMvc2Integration(object actionDescriptorObj, object httpContextO
/// <param name="actionDescriptor">An ActionDescriptor with information about the current action.</param>
/// <param name="httpContext">The HttpContext for the current request.</param>
/// <param name="routeData">A RouteData with information about the current route.</param>
[InterceptMethod(
CallerAssembly = "Microsoft.AspNetCore.Mvc.Core",
TargetAssembly = "Microsoft.AspNetCore.Mvc.Core",
TargetType = "Microsoft.AspNetCore.Mvc.Internal.MvcCoreDiagnosticSourceExtensions")]
public static void BeforeAction(
object diagnosticSource,
object actionDescriptor,
Expand Down Expand Up @@ -114,6 +118,10 @@ public static void BeforeAction(
/// <param name="actionDescriptor">An ActionDescriptor with information about the current action.</param>
/// <param name="httpContext">The HttpContext for the current request.</param>
/// <param name="routeData">A RouteData with information about the current route.</param>
[InterceptMethod(
CallerAssembly = "Microsoft.AspNetCore.Mvc.Core",
TargetAssembly = "Microsoft.AspNetCore.Mvc.Core",
TargetType = "Microsoft.AspNetCore.Mvc.Internal.MvcCoreDiagnosticSourceExtensions")]
public static void AfterAction(
object diagnosticSource,
object actionDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public AspNetMvcIntegration(object controllerContextObj)
/// <param name="callback">An <see cref="AsyncCallback"/> delegate.</param>
/// <param name="state">An object that holds the state of the async operation.</param>
/// <returns>Returns the <see cref="IAsyncResult "/> returned by the original BeginInvokeAction() that is later passed to <see cref="EndInvokeAction"/>.</returns>
[InterceptMethod(
CallerAssembly = "System.Web.Mvc",
TargetAssembly = "System.Web.Mvc",
TargetType = "System.Web.Mvc.Async.IAsyncActionInvoker")]
public static object BeginInvokeAction(
dynamic asyncControllerActionInvoker,
dynamic controllerContext,
Expand Down Expand Up @@ -142,6 +146,10 @@ public static object BeginInvokeAction(
/// <param name="asyncControllerActionInvoker">The AsyncControllerActionInvoker instance.</param>
/// <param name="asyncResult">The <see cref="IAsyncResult"/> returned by <see cref="BeginInvokeAction"/>.</param>
/// <returns>Returns the <see cref="bool"/> returned by the original EndInvokeAction().</returns>
[InterceptMethod(
CallerAssembly = "System.Web.Mvc",
TargetAssembly = "System.Web.Mvc",
TargetType = "System.Web.Mvc.Async.IAsyncActionInvoker")]
public static bool EndInvokeAction(dynamic asyncControllerActionInvoker, dynamic asyncResult)
{
AspNetMvcIntegration integration = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public static class AspNetWebApi2Integration
/// <param name="controllerContext">The controller context for the call</param>
/// <param name="cancellationTokenSource">The cancellation token source</param>
/// <returns>A task with the result</returns>
[InterceptMethod(
TargetAssembly = "System.Web.Http",
TargetType = "System.Web.Http.Controllers.IHttpController")]
public static object ExecuteAsync(object apiController, object controllerContext, object cancellationTokenSource)
{
var cancellationToken = ((CancellationTokenSource)cancellationTokenSource).Token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.ClrProfiler.Integrations.Elasticsearch.Net
namespace Datadog.Trace.ClrProfiler.Integrations
{
/// <summary>
/// Traces an Elasticsearch pipeline
/// </summary>
public static class Pipeline
public static class ElasticsearchNetIntegration
{
private const string OperationName = "elasticsearch.query";
private const string ServiceName = "elasticsearch";
Expand All @@ -32,13 +32,17 @@ public static class Pipeline
/// <param name="pipeline">The pipeline for the original method</param>
/// <param name="requestData">The request data</param>
/// <returns>The original result</returns>
[InterceptMethod(
CallerAssembly = "Elasticsearch.Net",
TargetAssembly = "Elasticsearch.Net",
TargetType = "Elasticsearch.Net.IRequestPipeline")]
public static object CallElasticsearch<TResponse>(object pipeline, object requestData)
{
var originalMethod = DynamicMethodBuilder<Func<object, object, TResponse>>
.GetOrCreateMethodCallDelegate(
pipeline.GetType(),
"CallElasticsearch",
methodGenericArguments: new Type[] { typeof(TResponse) });
methodGenericArguments: new[] { typeof(TResponse) });

using (var scope = CreateScope(pipeline, requestData))
{
Expand All @@ -62,6 +66,10 @@ public static object CallElasticsearch<TResponse>(object pipeline, object reques
/// <param name="requestData">The request data</param>
/// <param name="cancellationTokenSource">A cancellation token</param>
/// <returns>The original result</returns>
[InterceptMethod(
CallerAssembly = "Elasticsearch.Net",
TargetAssembly = "Elasticsearch.Net",
TargetType = "Elasticsearch.Net.IRequestPipeline")]
public static object CallElasticsearchAsync<TResponse>(object pipeline, object requestData, object cancellationTokenSource)
{
var cancellationToken = ((CancellationTokenSource)cancellationTokenSource)?.Token ?? CancellationToken.None;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Datadog.Trace.ClrProfiler.Integrations
{
internal static class Redis
internal static class RedisHelper
{
internal const string OperationName = "redis.command";
internal const string ServiceName = "redis";
Expand Down
Loading