codeconsole opened a new pull request, #15718:
URL: https://github.com/apache/grails-core/pull/15718

   ## What
   
   Adds Micrometer Observation instrumentation for GSP view rendering. Each GSP 
page render runs inside a `gsp.view` Observation, so it produces a timer metric 
and — under a tracing bridge — a span nested in the request trace, answering 
"how much of a request is spent rendering the GSP".
   
   ## Why
   
   GSP rendering (and SiteMesh layout) is often a large, currently-invisible 
slice of request latency. Spring instruments the HTTP request 
(`http.server.requests`) but nothing surfaces the view-render portion. This 
adds it at the framework level.
   
   ## How
   
   Follows the Micrometer/Spring instrumentation pattern (mirrors 
`ServerHttpObservation*`):
   - `GroovyPageObservationContext` — carries the view URI
   - `GroovyPageObservationDocumentation` — documents the `gsp.view` 
observation + low-cardinality keys (`gsp.view`, `error`)
   - `GroovyPageObservationConvention` + 
`DefaultGroovyPageObservationConvention` — name / contextualName / KeyValues, 
overridable via a custom bean
   - `GroovyPageView.renderTemplate` wraps rendering via 
`GSP_VIEW.observation(...)` with an `ObservationRegistry.isNoop()` fast-path
   - `GroovyPageViewResolver` resolves the `ObservationRegistry` from the 
application context (NOOP fallback) and sets it on each view
   
   ## Notes
   
   - **No new runtime dependency** — `micrometer-observation` is already on the 
classpath (Spring 6). Zero overhead when no `ObservationRegistry` bean is 
present (NOOP fast-path).
   - View URIs are bounded, so they are used as a low-cardinality key.
   - Covered by `GroovyPageViewObservationSpec` (recorded name/tags, NOOP no-op 
path, error key on a failed render).
   
   ## Follow-ups (same pattern, not in this PR)
   
   `gsp.template` (`GroovyPagesTemplateRenderer`), `gsp.layout` 
(`GrailsLayoutView`), and `gsp.compile` + template-cache hit/miss 
(`GroovyPagesTemplateEngine`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to