Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks in JettyEngine to facilitate NewRelic-Coroutine integration #1792

Open
jeffr-usafacts opened this issue Apr 14, 2020 · 1 comment
Open
Labels

Comments

@jeffr-usafacts
Copy link

Subsystem
Ktor JettyApplicationEngine

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 JettyKtorHandler handle method such that:

  1. From within the handle method's execution thread, I can extract the NewRelic transaction installed by the NewRelic agent (using NewRelic.getAgent().transaction), and
  2. 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.

@oleg-larshin
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants