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

Fix Elasticsearch integration #211

Merged
merged 9 commits into from
Nov 15, 2018
11 changes: 11 additions & 0 deletions samples/Samples.Elasticsearch/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
"profiles": {
"Samples.Elasticsearch": {
"commandName": "Project",
"environmentVariables": {
"COR_ENABLE_PROFILING": "1",
"COR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}",
"COR_PROFILER_PATH": "%UserProfile%\\source\\repos\\dd-trace-csharp\\src\\Datadog.Trace.ClrProfiler.Native\\bin\\Debug\\x64\\Datadog.Trace.ClrProfiler.Native.dll",

"CORECLR_ENABLE_PROFILING": "1",
"CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}",
"CORECLR_PROFILER_PATH": "%UserProfile%\\source\\repos\\dd-trace-csharp\\src\\Datadog.Trace.ClrProfiler.Native\\bin\\Debug\\x64\\Datadog.Trace.ClrProfiler.Native.dll",

"DD_INTEGRATIONS": "%UserProfile%\\source\\repos\\dd-trace-csharp\\integrations.json"
},
"nativeDebugging": true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.ClrProfiler.Integrations.Elasticsearch.Net
{
Expand Down Expand Up @@ -59,7 +60,7 @@ public static object CallElasticsearchAsync<TResponse>(object pipeline, object r

var cancellationToken = (cancellationTokenSource as CancellationTokenSource)?.Token ?? CancellationToken.None;

var originalMethod = DynamicMethodBuilder<Func<object, object, CancellationToken, TResponse>>.
var originalMethod = DynamicMethodBuilder<Func<object, object, CancellationToken, Task<TResponse>>>.
GetOrCreateMethodCallDelegate(
pipeline.GetType(),
"CallElasticsearchAsync",
Expand Down Expand Up @@ -99,7 +100,7 @@ private static Scope CreateScope(dynamic pipeline, dynamic requestData)
string method = null;
try
{
method = requestData?.Method;
method = requestData?.Method?.ToString();
bmermet marked this conversation as resolved.
Show resolved Hide resolved
}
catch
{
Expand Down