You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using the Rack::Deflater rack middleware and we can't figure out how to order it to occur after the newrelic rack middleware. Rack::Deflater deletes the Content-Length header so that its no longer available in capture_response_content_length.
We are currently on newrelic_rpm version 9.1.0
The text was updated successfully, but these errors were encountered:
Hi @mbarany! Unfortunately, what you're looking to do isn't possible with the agent's default behavior. When the New Relic ruby agent instruments middleware, it doesn't insert its own middleware into the Rack middleware stack, but instead wraps the request as a whole. Since this is the agent's intended behavior, I'm going to remove the bug label.
That said, we've come up with two potential options that could work for you.
Manually setting the content length yourself. If you have the content length available (perhaps in your own custom middleware), you can set it manually on the transaction using:
As mentioned, the default behavior of the agent is to wrap requests. But if disable_middleware_instrumentation is set to true, the agent will instead insert its own middleware. However, the agent middleware will always be inserted at the end of the Rack middleware stack. This is because the intent of this middleware is to capture the final state of the request. Due to the way the agent works, agent code may have to be altered to reorder the middlewares. If you're interested, we can try to help create a workaround that may give you what you're looking for. Disabling middleware instrumentation can limit the functionality of the agent, and a workaround we considered is outside the scope of our public API (and therefore potentially unstable if changes are made to this part of the agent in the future). So this might not be an ideal choice.
We're using the
Rack::Deflater
rack middleware and we can't figure out how to order it to occur after the newrelic rack middleware.Rack::Deflater
deletes theContent-Length
header so that its no longer available incapture_response_content_length
.We are currently on newrelic_rpm version 9.1.0
The text was updated successfully, but these errors were encountered: