reidmorrison / rails_semantic_logger

Rails Semantic Logger replaces the Rails default logger with Semantic Logger
https://logger.rocketjob.io/rails
Apache License 2.0
320 stars 114 forks source link

Use finish_with_state inside RailsSemanticLogger::Rack::Logger #178

Closed ahmedmagdy711 closed 1 year ago

ahmedmagdy711 commented 1 year ago

Issue # (if available)

An issue where in a threaded environment the dynamic subscriptions from ActionDispatch::ServerTiming would cause a mismatch in the number of subscriptions to a topic, which would pop too many values off of the thread-local stacks, leading to invalid events being sent to subscribers which leads to nil value for time in Event object which throws an exception.

Description of changes

Use finish_with_state inside RailsSemanticLogger::Rack::Logger. This ensures that the finished instrumenter is sent to the same subscribers that the initial request was sent to.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.