newrelic-ruby-agent icon indicating copy to clipboard operation
newrelic-ruby-agent copied to clipboard

Record data collected by Server-Timing Middleware

Open kaylareopelle opened this issue 3 years ago • 2 comments

Rails' Changelog Text

Server-Timing specification defines how the server can communicate to browsers performance metrics about the request it is responding to. The ServerTiming middleware is enabled by default on the development environment by default using the config.server_timing setting and set the relevant duration metrics in the Server-Timing header. The full specification for Server-Timing header can be found in: https://www.w3.org/TR/server-timing/#dfn-server-timing-header-field Sebastian Sogamoso, Guillermo Iguaran

Questions

  • Can this benefit our agent’s recording abilities?
  • Is this within the purview of the Ruby Agent, or is it covered by a different agent?

Ideas

  • Add as an attribute on a metric that’s already getting recorded
  • Could be behind a feature flag/configuration option that runs only when the setting is enabled within Rails

kaylareopelle avatar Jan 20 '22 19:01 kaylareopelle

Tabling to do more internal research to determine whether this is recorded by another Agent.

kaylareopelle avatar Jan 24 '22 23:01 kaylareopelle

https://issues.newrelic.com/browse/NEWRELIC-3412

Notes:

hannahramadan avatar Nov 22 '22 23:11 hannahramadan

Further investigation w/ @kaylareopelle

  • We are reporting 3 HTTP response headers: http.statusCode, contentLength, and contentType. These headers are added as transaction attributes in transaction.rb, and discovered in middleware_tracing.rb. We are not currently set up to report on additional/custom headers, however, we do receive them through as the second item in the results array variable when calling MiddlewareTracing#call.
  • Server-Timing is a header key with a string value. For example:

"Server-Timing"=> "sql.active_record;dur=13.86, start_processing.action_controller;dur=0.20, instantiation.active_record;dur=21.80, render_partial.action_view;dur=1.77, render_template.action_view;dur=37.60, render_layout.action_view;dur=130.13, process_action.action_controller;dur=174.32"

Because we provide much of the same information as server-timing, I don't see much value in adding. Recording server-timing data would give customers this information as a part of a transaction attribute(s), which in the UI could be of value. It would be nice to know if this, or the ability to track custom/additional headers, is of interest to customers.

hannahramadan avatar Nov 23 '22 22:11 hannahramadan

Closing this issue as "Won't do" since we already report on most of the information in the Server-Timing Middleware header.

kaylareopelle avatar Jan 21 '23 00:01 kaylareopelle