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

[BUG] LogAnalytics Batch Queries - MaxServerTimeOut is always null #29339

Closed
pelayolartategui opened this issue Jun 9, 2022 · 1 comment · Fixed by #29347
Closed

[BUG] LogAnalytics Batch Queries - MaxServerTimeOut is always null #29339

pelayolartategui opened this issue Jun 9, 2022 · 1 comment · Fixed by #29347
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query

Comments

@pelayolartategui
Copy link

pelayolartategui commented Jun 9, 2022

Describe the bug
When creating LogAnalytics batch queries with QueryOptions setting serverTimeOut, a comparison over null value is performed in:

if (logsQueryOptions.getServerTimeout().compareTo(this.maxServerTimeout) > 0) {

maxServerTimeout is not previously set, so always null.

Exception or Stack Trace
java.lang.NullPointerException: null at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603) at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678) at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:737) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159) at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.evaluateParallel(ForEachOps.java:188) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) at java.base/java.util.stream.IntPipeline.forEach(IntPipeline.java:439) at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:596) at com.nexthink.LogAnalyticsDataProcessor.startProcessing(LogAnalyticsDataProcessor.java:37) at com.nexthink.Application.onApplicationEvent(Application.java:32) at com.nexthink.Application.onApplicationEvent(Application.java:13) at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262) at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60) at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229) at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:479) at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:303) at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:110) at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78) at java.base/java.util.Optional.ifPresent(Optional.java:176) at io.micronaut.runtime.Micronaut.start(Micronaut.java:76) at io.micronaut.runtime.Micronaut.run(Micronaut.java:320) at io.micronaut.runtime.Micronaut.run(Micronaut.java:306) at com.nexthink.Application.main(Application.java:25) Caused by: java.lang.NullPointerException: Cannot read field "seconds" because "otherDuration" is null at java.base/java.time.Duration.compareTo(Duration.java:1410) at com.azure.monitor.query.models.LogsBatchQuery.addWorkspaceQuery(LogsBatchQuery.java:75) at com.nexthink.logAnalytics.LogAnalyticsQueryService.nxSourceEventQuery(LogAnalyticsQueryService.java:60) at com.nexthink.LogAnalyticsDataProcessor.lambda$startProcessing$0(LogAnalyticsDataProcessor.java:40) at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.accept(ForEachOps.java:204) at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

To Reproduce
Steps to reproduce the behavior:

Code Snippet
LogsBatchQuery logsBatchQuery = new LogsBatchQuery(); String query1 = logsBatchQuery.addWorkspaceQuery("{workspace-id}", "{query-1}", new QueryTimeInterval(Duration.ofDays(2)), new LogsQueryOptions().setServerTimeout(Duration.ofSeconds(60)));

Expected behavior
Max query duration properly set.

Screenshots
imagen

Setup (please complete the following information):

  • OS: Mac
  • IDE: IntelliJ
  • Library/Libraries: 'com.azure:azure-monitor-query:1.0.6'
  • Java version: 17
  • Frameworks:Micronaut

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x] Bug Description Added
  • [x ] Repro Steps Added
  • [x ] Setup information Added
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 9, 2022
@joshfree joshfree added Client This issue points to a problem in the data-plane of the library. Monitor - Log Analytics labels Jun 9, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 9, 2022
@joshfree joshfree added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Jun 9, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 9, 2022
@joshfree
Copy link
Member

joshfree commented Jun 9, 2022

Thank you for reporting this issue with the monitor query sdk, @pelayolartategui. @srnagar can you please follow up?

/cc @scottaddie

@joshfree joshfree removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jun 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
@srnagar srnagar added Monitor Monitor, Monitor Ingestion, Monitor Query and removed Monitor - Log Analytics labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants