Conversation
|
@picandocodigo How do you suggest running these tests with the OTel instrumentation? The client is instrumented if the |
Sounds good! We can definitely add a new set of tests on GitHub Actions with the env variable 👍 |
abebd1c to
b393ff7
Compare
d4ddf3c to
3dcd313
Compare
| span['db.statement'] = body_as_json | ||
| end | ||
| span['db.operation'] = opts[:endpoint] if opts[:endpoint] | ||
| transport.perform_request(method, path, params || {}, body, headers) |
There was a problem hiding this comment.
Since params is being passed with the default value of {} in the perform_request signature, I think we don't need || {} here and on line 197, right?.
There was a problem hiding this comment.
With my testing, there was sometimes a case when there were no params but there was a body so the perform_request method would be called with the params arg explicitly set to nil. So once it gets to this line you get an NoMethodError: undefined method delete' for nil:NilClass` error.
I think this scenario is already possible before these changes:
$ client.perform_request('POST', '/', nil, '{"foo":"bar"}', '{"Content-Type":"application/x-ndjson"}')
NoMethodError: undefined method `delete' for nil:NilClass
from ..../elastic-transport-ruby/fork/elastic-transport-ruby/lib/elastic/transport/transport/base.rb:283:in `perform_request'|
Hi @picandocodigo the outstanding questions I had were:
I have no other outstanding questions then that should block this PR :) |
|
Update on this since my last comment: |
f9fab0b to
779c83e
Compare
This PR complements a PR in the elasticsearch-ruby repo to extend the way the transport layer is called by including the endpoint id and path params for a given call to
perform_request. It also adds the creation of an OTel span for each request.The span attributes captured follow the semantic conventions proposed in this PR.
This PR does the following:
OpenTelemetryclass that encapsulates everything having to do with otel instrumentation in the transport layerOpenTelemetrynamespace is defined and creates a@otelobject on the clientopentelemetry-sdkto the GemfileTEST_WITH_OTELthat should be set totrueif theopentelemetry-sdkgem should be required and the otel tests should be runToDo:
TEST_OTEL=trueTEST_OTEL=true