aserafin / grape_logging

Request logging for Grape!
MIT License
147 stars 76 forks source link

Use AS:N in a threadsafe manner #18

Closed johnthethird closed 8 years ago

johnthethird commented 8 years ago

This PR sets up the AS:N subscription once during app init and then uses thread local variables to track the durations. Subscribing and unsubscribing on each request is not the right way to handle this. I'd love to write some tests for this as well but for now this will have to do.

I also threw in the view time a la Rails where they take the total time and subtract out the db time to get the view time.

rngtng commented 8 years ago

nice :+1:

aserafin commented 8 years ago

@johnthethird thanks for contributing - merged with #16