-
Notifications
You must be signed in to change notification settings - Fork 19
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
OTel instrumentation #54
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
OpenTelemetry
class that encapsulates everything having to do with otel instrumentation in the transport layerOpenTelemetry
namespace is defined and creates a@otel
object on the clientopentelemetry-sdk
to the GemfileTEST_WITH_OTEL
that should be set totrue
if theopentelemetry-sdk
gem should be required and the otel tests should be runToDo:
TEST_OTEL=true
TEST_OTEL=true