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

Instrument async Elasticsearch methods #1535

Conversation

nr-ahemsath
Copy link
Member

Description

Adds instrumentation points for RequestAsync in Elasticsearch 7.x and 8.x clients. URI capture from async response is working, but still not being used. All of the new elasticsearch integration tests are passing except the ones for the low-level Elasticsearch.net client (7.x) because the operation name isn't being captured as expected.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (feature/elasticsearch-instrumentation@57a82fe). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@                           Coverage Diff                            @@
##             feature/elasticsearch-instrumentation    #1535   +/-   ##
========================================================================
  Coverage                                         ?   73.07%           
========================================================================
  Files                                            ?      408           
  Lines                                            ?    25578           
  Branches                                         ?        0           
========================================================================
  Hits                                             ?    18690           
  Misses                                           ?     6888           
  Partials                                         ?        0           

//Elasticsearch.Net.HttpMethod,System.String,Elasticsearch.Net.PostData,Elasticsearch.Net.IRequestParameters
var indexOfRequestParams = 3; // unless it's Elasticsearch.Net/NEST and async

if (instrumentedMethodCall.IsAsync)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to do some bounds checking, just in case they make some drastic change in a future release, but that can be done later.

Copy link
Member

@chynesNR chynesNR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@nr-ahemsath nr-ahemsath merged commit 573b0ed into feature/elasticsearch-instrumentation Apr 12, 2023
@nr-ahemsath nr-ahemsath deleted the nr-ahemsath/elasticsearch-async-instrumentation branch April 12, 2023 17:42
nr-ahemsath added a commit that referenced this pull request Apr 26, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants