-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add instrumentation for .NET Elasticsearch clients. (#1575)
* Port initial poc * Added elastic search and kibana to unbounded services (#1505) * Enabled authentication for ElasticSearch and Kibana (#1507) * Updated docker-compose to enable authentication for ElasticSearch and Kibana. * Added a configuration helper for use in integration tests for ElasticSearch. * Support Elastic.Clients.Elasticsearch (8.x) client (#1512) * Add new instrumentation files to build artifacts (#1529) * test: Elasticsearch integration tests framework (#1532) * Instrument async Elasticsearch methods (#1535) * Working async instrumentation * Get NEST async working, fix integration test * Set URI after datastore segment creation (#1538) * Initial plumbing, seems to work * Update integration tests * Remove stray using * Clean up comments * Build bug and review feedback * Handle https and improve async reliability Handle https as well as http in Elastic server url Fix async timing problem with a delay (ugh) * Incremental Elasticsearch integration test work (#1543) * Report Elasticsearch.net operations more accurately (#1559) * Improve Elasticsearch integration tests (#1563) * Fix solution build problem * Add search validation to async tests Also remove comments from wrapper Also reorder methods in sync tests * Initial coding of bulk insert and multisearch in exercisers * Added sync tests for indexmany and multisearch. Not passing. * Fix assertions * Add async operations to sync tests class * Combine sync and async test files * Get elastic.clients case to work * Elasticsearch.Net tests passing * Test range of versions but only test oldest and newest frameworks * Add client call success validation to Elasticsearch integration tests (#1566) * Bubble up the async await * Add API operation validation All tests passing locally * Elasticsearch error reporting (#1568) * Adding support for Elasticsearch error reporting * Safer way to set errors * Fixed unreliable integration tests; fixed potential path parsing crash * Missed replacing a call to InternalApi --------- Co-authored-by: Marty Tippin <120425148+tippmar-nr@users.noreply.github.com> Co-authored-by: Chris Hynes <111462425+chynesNR@users.noreply.github.com> Co-authored-by: chynesNR <chynes@newrelic.com>
- Loading branch information
1 parent
b65b117
commit 8e49d7b
Showing
29 changed files
with
1,751 additions
and
31 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
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
17 changes: 17 additions & 0 deletions
17
...elic/Agent/Extensions/NewRelic.Agent.Extensions/Api/Experimental/IDatastoreSegmentData.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,17 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using NewRelic.Agent.Extensions.Parsing; | ||
|
||
namespace NewRelic.Agent.Api.Experimental | ||
{ | ||
/// <summary> | ||
/// This interface contains methods we may eventually move out of the experimental namespace once they have been sufficiently vetted. | ||
/// Methods on this interface are subject to refactoring or removal in future versions of the API. | ||
/// </summary> | ||
public interface IDatastoreSegmentData : ISegmentData | ||
{ | ||
void SetConnectionInfo(ConnectionInfo connectionInfo); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ public enum DatastoreVendor | |
Redis, | ||
//SQLite, | ||
CosmosDB, | ||
Elasticsearch, | ||
Other | ||
} | ||
|
||
|
19 changes: 19 additions & 0 deletions
19
src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/Elasticsearch/Elasticsearch.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks> | ||
<AssemblyName>NewRelic.Providers.Wrapper.Elasticsearch</AssemblyName> | ||
<RootNamespace>NewRelic.Providers.Wrapper.Elasticsearch</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="Instrumentation.xml"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="$(RootProjectDirectory)\src\NewRelic.Core\NewRelic.Core.csproj" /> | ||
<ProjectReference Include="..\..\..\NewRelic.Agent.Extensions\NewRelic.Agent.Extensions.csproj" /> | ||
</ItemGroup> | ||
</Project> |
19 changes: 19 additions & 0 deletions
19
...ewRelic/Agent/Extensions/Providers/Wrapper/Elasticsearch/ElasticsearchRequestException.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,19 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
|
||
namespace NewRelic.Providers.Wrapper.Elasticsearch | ||
{ | ||
public class ElasticsearchRequestException : Exception | ||
{ | ||
public ElasticsearchRequestException(string message) | ||
: base(message) { } | ||
|
||
public ElasticsearchRequestException() | ||
: base() { } | ||
|
||
public ElasticsearchRequestException(string message, Exception innerException) | ||
: base(message, innerException) { } | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/Elasticsearch/Instrumentation.xml
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,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2020 New Relic Corporation. All rights reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
<extension xmlns="urn:newrelic-extension"> | ||
<instrumentation> | ||
|
||
<!--7.x NEST/Elasticsearch.Net --> | ||
<tracerFactory name="RequestWrapper"> | ||
<match assemblyName="Elasticsearch.Net" className="Elasticsearch.Net.Transport`1"> | ||
<exactMethodMatcher methodName="Request" parameters="Elasticsearch.Net.HttpMethod,System.String,Elasticsearch.Net.PostData,Elasticsearch.Net.IRequestParameters" /> | ||
</match> | ||
</tracerFactory> | ||
|
||
<tracerFactory name="RequestWrapper"> | ||
<match assemblyName="Elasticsearch.Net" className="Elasticsearch.Net.Transport`1"> | ||
<exactMethodMatcher methodName="RequestAsync" parameters="Elasticsearch.Net.HttpMethod,System.String,System.Threading.CancellationToken,Elasticsearch.Net.PostData,Elasticsearch.Net.IRequestParameters" /> | ||
</match> | ||
</tracerFactory> | ||
|
||
<!--8.x Elastic.Clients.Elasticsearch --> | ||
<tracerFactory name="RequestWrapper"> | ||
<match assemblyName="Elastic.Transport" className="Elastic.Transport.DefaultHttpTransport`1"> | ||
<exactMethodMatcher methodName="Request" parameters="Elastic.Transport.HttpMethod,System.String,Elastic.Transport.PostData,Elastic.Transport.RequestParameters" /> | ||
</match> | ||
</tracerFactory> | ||
|
||
<tracerFactory name="RequestWrapper"> | ||
<match assemblyName="Elastic.Transport" className="Elastic.Transport.DefaultHttpTransport`1"> | ||
<exactMethodMatcher methodName="RequestAsync" parameters="Elastic.Transport.HttpMethod,System.String,Elastic.Transport.PostData,Elastic.Transport.RequestParameters,System.Threading.CancellationToken" /> | ||
</match> | ||
</tracerFactory> | ||
|
||
</instrumentation> | ||
</extension> |
Oops, something went wrong.