Is your feature request related to a problem? Please describe.
The core issue is that the JettyKtorHandler invoked by the JettyApplicationEngine loses the NewRelic Transaction when it launches the pipeline execution coroutine thread. This causes a loss of monitoring/timing/metrics in the NewRelic RPM UI, leading to opaque timing values only at the Jetty level (which is instrumented by the NewRelic Agent java agent).
Describe the solution you'd like
In the specific case of the NewRelic Jetty Problem, I could use a way to hook into the JettyKtorHandlerhandle method such that:
From within the handle method's execution thread, I can extract the NewRelic transaction installed by the NewRelic agent (using NewRelic.getAgent().transaction), and
Have a way to wrap the pipeline execution thread (which results from a launch call) such that such that I can get a token off the transaction and link() it before the pipeline is executed, and expire() it after it has completed.
There are a number of ways I can think to accomplish this (e.g. having a way to register with the JettyApplicationEngine a code block where I can modify the CoroutineContext that the pipeline runs in); however, it is my hope that a Ktor engineer would have a more holistic proposal to give this functionality across many engines.
Motivation to include to ktor
NewRelic is one of the premier suites for application monitoring, with many service developers across the industry using NewRelic to monitor their apps.
When enterprises select service frameworks, the ability to clearly and easily monitor them is often a key factor in decision making; the introduction of support for NewRelic transaction monitoring in Ktor would remove a hurdle for Ktor's selection as a primary production service framework in the tech stack of many businesses.
Subsystem Ktor JettyApplicationEngine
Is your feature request related to a problem? Please describe. The core issue is that the
JettyKtorHandler
invoked by theJettyApplicationEngine
loses the NewRelic Transaction when it launches the pipeline execution coroutine thread. This causes a loss of monitoring/timing/metrics in the NewRelic RPM UI, leading to opaque timing values only at the Jetty level (which is instrumented by the NewRelic Agent java agent).Describe the solution you'd like
In the specific case of the NewRelic Jetty Problem, I could use a way to hook into the
JettyKtorHandler
handle
method such that:handle
method's execution thread, I can extract the NewRelic transaction installed by the NewRelic agent (usingNewRelic.getAgent().transaction
), andlaunch
call) such that such that I can get a token off the transaction andlink()
it before the pipeline is executed, andexpire()
it after it has completed.There are a number of ways I can think to accomplish this (e.g. having a way to register with the
JettyApplicationEngine
a code block where I can modify theCoroutineContext
that the pipeline runs in); however, it is my hope that a Ktor engineer would have a more holistic proposal to give this functionality across many engines.Motivation to include to ktor NewRelic is one of the premier suites for application monitoring, with many service developers across the industry using NewRelic to monitor their apps.
When enterprises select service frameworks, the ability to clearly and easily monitor them is often a key factor in decision making; the introduction of support for NewRelic transaction monitoring in Ktor would remove a hurdle for Ktor's selection as a primary production service framework in the tech stack of many businesses.