# Ruby transactions - workers and grape

**URL:** <https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907>\
**Category:** APM\
**Created:** [January 27, 2019, 1:57pm UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907 "2019-01-27T13:57:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leyb\_weg](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@leyb\_weg](https://discuss.elastic.co/u/leyb_weg)\
**Post date:** [January 27, 2019, 1:57pm UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907/1 "2019-01-27T13:57:33Z")

</div>

Hello,

I'm trying to apply configure APM transactions on 2 places:

1. On workers, I try to apply the ElasticAPM.transaction {} and it doenst send any new data
2. On Grape (gem) endpoints: all endpoints shows as Rack instead of the correct path/controller

Any help on the issues is more than welcome.

---

<div class="post-metadata">

**Author:** ![mikker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikker/32/22118_2.png) [@mikker](https://discuss.elastic.co/u/mikker)\
**Post date:** [January 28, 2019, 10:20am UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907/2 "2019-01-28T10:20:47Z")

</div>

Hi!

1. What worker library are you using? The gem should automatically instrument DelayedJob and Sidekiq so if one of them, then no need to add your own transactions.

2. There's no official Grape support yet. A user submitted their custom Grape middleware which you can find here: [https://github.com/kressh/apm-agent-ruby/blob/e1d8a6d3396021c16c0ca46f2f31c3d0362ac1f3/lib/elastic\_apm/middlewares/grape.rb#L37-L54](https://github.com/kressh/apm-agent-ruby/blob/e1d8a6d3396021c16c0ca46f2f31c3d0362ac1f3/lib/elastic_apm/middlewares/grape.rb#L37-L54)

---

<div class="post-metadata">

**Author:** ![leyb\_weg](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@leyb\_weg](https://discuss.elastic.co/u/leyb_weg)\
**Post date:** [January 29, 2019, 9:41am UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907/3 "2019-01-29T09:41:00Z")

</div>

Thanks for the response.

1. Custom workers. I was able to make it work wrapping a ElasticAPM.transaction  
ElasticAPM.with\_transaction / ElasticAPM.start\_transaction / ElasticAPM.end\_transaction dont exist even though it appears [on the doc](https://www.elastic.co/guide/en/apm/agent/ruby/current/api.html#api-agent-start_transaction).

2. I tried that but it didnt work. After [improvements](https://github.com/elastic/apm-agent-ruby/pull/119#issuecomment-411991347), it stopped throwing errors but doesnt split the Rack on APM into requests.  
Do you intend to merge it soon?

---

<div class="post-metadata">

**Author:** ![mikker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikker/32/22118_2.png) [@mikker](https://discuss.elastic.co/u/mikker)\
**Post date:** [January 29, 2019, 1:06pm UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907/4 "2019-01-29T13:06:29Z")

</div>

1. Sounds like you are using a version of the agent \< 2.0? The APIs changed in 2.0 from `transaction` to the ones in the docs. (Docs for 1.x are also available)

2. Grape support is on the todo although I can't give you any dates. I think I want to do it through ActiveSupport::Notifications instead though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 19, 2019, 9:06am UTC](https://discuss.elastic.co/t/ruby-transactions-workers-and-grape/165907/5 "2019-02-19T09:06:35Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
