azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[BUG] LogsIngestionClient does not use its ThreadPool for processing

Open FelixStumvollDT opened this issue 1 year ago • 5 comments

Describe the bug I was looking at the source code of the LogsIngestionClient, since i was wondering why it implements the AutoClosable interface. I noticed it creates an ExecutorService instances, that has to be shut down. However, upon closer inspection i saw that this ExecutorService is not used for any processing. Only here are tasks submitted to it, and the passed tasks immediately returns the Stream instance, which is essentially a no-op.

Code Snippet The relevant code is in the submit method of the LogsIngestionClient:

private Stream<UploadLogsResponseHolder> submit(Stream<UploadLogsResponseHolder> responseStream, int concurrency) {
    if (concurrency == 1) {
        return responseStream;
    }

    try {
        return threadPool.submit(() -> responseStream).get();
    } catch (InterruptedException | ExecutionException e) {
        throw LOGGER.logExceptionAsError(new RuntimeException(e));
    }
}

Setup (please complete the following information):

  • OS: -
  • IDE: -
  • Library/Libraries: com.azure:azure-monitor-ingestion:1.2.2
  • Java version: 21
  • App Server/Environment: -
  • Frameworks: -

FelixStumvollDT avatar Jul 10 '24 13:07 FelixStumvollDT

@anuchandy @conniey @lmolkova

github-actions[bot] avatar Jul 10 '24 13:07 github-actions[bot]

Thank you for your feedback. Tagging and routing to the team member best able to assist.

github-actions[bot] avatar Jul 10 '24 13:07 github-actions[bot]

@srnagar could you look into the above issue and close it if not applicable anymore.

samvaity avatar Dec 11 '25 00:12 samvaity

@FelixStumvollDT The implementation has changed a bit in the recent releases. Could you please check the latest version of this library and let us know if there's any issue with this? Also, can you please eloborate on what you mean by this being a no-op? This is only setting up the stream processing pipeline. The upload actually happens when a terminal method like collect() or forEach() is called triggering the stream processing pipeline to execute.

Could you also please let us know if there is any issue with logs ingestion or ExecutorService not being shutdown?

srnagar avatar Dec 11 '25 02:12 srnagar

Hi @FelixStumvollDT. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar Dec 11 '25 05:12 github-actions[bot]