newrelic / newrelic-telemetry-sdk-java

Java library for sending telemetry data to New Relic
Apache License 2.0
40 stars 38 forks source link

Impossible to provide executor for scheduler for TelemetryClient #298

Open clayly opened 1 year ago

clayly commented 1 year ago

User can provide Dispatcher(ExecutorService) to OkHttpClient, but TelemetryClient forcibly creates another one with Executors.newSingleThreadScheduledExecutor in constructor.

(Migrate to Jira)

kford-newrelic commented 1 year ago

@clayly thanks for letting us know about this issue but can you provide a bit more detail? What's the impact of the issue for you (eg: are you not able to generate telemetry for your application, etc?

Any chance you have a sample app/code that demonstrates the problem you're encountering?

clayly commented 1 year ago

Hi! Issue is performance and predictability / uniformity:

  1. Performance: if it's possible better reuse threads via thread pool, especially in something like k8s and reactive applications. If for example all you want in your library is tasks scheduling then there is no reason to own a whole thread.
  2. Predictability / uniformity: user already can provide ExecutorService to client, but third-party threads are created anyway, which is unpredictable by itself.
clayly commented 1 year ago

@kford-newrelic mention just in case!

kford-newrelic commented 1 year ago

@clayly thanks for this additional information - we can't commit on if/when we would act on this but our engineers will definitely discuss it (and if you want to submit a PR for this, it certainly wouldn't hurt!)

workato-integration[bot] commented 1 year ago

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