Skip to content

404 when getting live metrics over HTTP #879

Closed

Description

@Eskibear

When the query contains space, it throws exception. E.g. below endpoint should work.
https://hostname/actuator/metrics/jvm.memory.used?tag=area:heap,id:Eden%20Space

https://github.com/spring-projects/sts4/blob/d70425d71e12bcee834d615316f733440331490b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/HttpActuatorConnection.java#L86-L87

query is tag=area:heap,id:Eden Space, in L86, encode() will encode whitespace as %20. And in L87, impl of restTemplate.getForObject, it encodes the url again, making it %2520, causing the 404.

callstack

20:51:24.396 [pool-6-thread-3] ERROR o.s.i.v.b.j.l.v.SpringProcessLiveDataExtractorOverJMX - Error parsing beans
org.springframework.web.client.HttpClientErrorException$NotFound: 404 : [no body]
	at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:113)
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:168)
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
	at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
	at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:819)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:777)
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)
	at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:334)
	at org.springframework.ide.vscode.boot.java.livehover.v2.HttpActuatorConnection.getLiveMetrics(HttpActuatorConnection.java:94)
	at org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataExtractorOverHttp.getLiveMetrics(SpringProcessLiveDataExtractorOverHttp.java:388)
	at org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataExtractorOverHttp.retrieveLiveMemoryMetricsData(SpringProcessLiveDataExtractorOverHttp.java:145)
	at org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessConnectorOverHttp.refreshMemoryMetrics(SpringProcessConnectorOverHttp.java:142)
	at org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessConnectorService.lambda$4(SpringProcessConnectorService.java:240)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

BTW, the error message is misleading:

20:51:24.396 [pool-6-thread-3] ERROR o.s.i.v.b.j.l.v.SpringProcessLiveDataExtractorOverJMX - Error parsing beans

https://github.com/spring-projects/sts4/blob/d70425d71e12bcee834d615316f733440331490b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessLiveDataExtractorOverHttp.java#L399

Activity

  1. BoykoAlex commented on Nov 9, 2022

    @BoykoAlex
    Contributor

    @Eskibear Can you please re-try this? I suspect that this a411663 might have fixed it...

  2. Eskibear commented on Nov 10, 2022

    @Eskibear
    ContributorAuthor

    I verified with latest CI build vscode-spring-boot-1.41.0-202211080047.vsix, the error is gone. (because you removed the encode() part.

    But I the memory plot is not correctly rendered. I suspect maybe we need microsoft/vscode-spring-boot-dashboard#239 to get it right, as in latest CI internal build, you already include 4864c95 to fetch heap/non-heap mem data together.

    I'm closing this.

  3. BoykoAlex commented on Nov 10, 2022

    @BoykoAlex
    Contributor

    I think what @Eskibear states above is correct. @vudayani-vmw please let us know if it is not.

  4. vudayani commented on Nov 10, 2022

    @vudayani
    Collaborator

    @Eskibear @BoykoAlex
    Yes, the #239 PR includes the necessary changes to fetch heap/non-heap metrics together to render the memory graph (with 4864c95 commit)

  5. added this to the 4.17.0.RELEASE milestone on Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions