-
Notifications
You must be signed in to change notification settings - Fork 801
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
Rails instrumentation does not work with persistence model #238
Comments
Can you provide more information and code, please? I don't have the bandwith to decipher what "get rails timing to work" can mean and try it on my own. |
I added require 'elasticsearch/rails/lograge' to application.rb, |
I think this is because I am not using MyModel.search method. I think I need to record the timing at the transport level. https://github.com/elasticsearch/elasticsearch-ruby/blob/master/elasticsearch-transport/lib/elasticsearch/transport/transport/base.rb#L228 |
Well, the persistence doesn't work with the "elasticsearch-persistence" gem, that would have to be added ... UPDATE: the instrumentation of course... |
It looks like there's a difference between the way the persistence gem builds a query in the search method and the one used in elasticsearch-model . The Instrumentation::Publishers chains to the execute! method, which the persistence-gem does not have. In the persistence gem, the search method does a client.search call, while the elasticsearch-model creates a SearchRequest object. |
I think we should instrument the timing at the lowest level possible, so both elasticsearch-model and persistence gems can share them. |
I'll have a look into that. I don't think we can re-use the searching code between model and persistence, but it would have been nice to have the instrumentation support for persistence of course. |
@karmi awesome! |
…est class Extracted the `gateway.search` call into a specific class, `SearchRequest`, primarily to allow hooking into the `SearchRequest#execute!` method in Rails instrumentation. Updated unit tests, this change should be totally opaque to the user. Related: #238
@trungpham I've spent hours debugging the weird ways Rails calls initializers :), but the instrumentation should be working now. Verified in my own application using There's a slight incovenience with Lograge, since it probably ignores any In the meantime, just copy&paste that code into your |
Hi, I suppose I could make it work by overloading the |
I can't seem to get rails timing to work the standalone persistence model. Is it because I'm not using ActiveModel?
The text was updated successfully, but these errors were encountered: