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

404 when getting live metrics over HTTP #879

Closed
Eskibear opened this issue Nov 9, 2022 · 4 comments
Closed

404 when getting live metrics over HTTP #879

Eskibear opened this issue Nov 9, 2022 · 4 comments

Comments

@Eskibear
Copy link
Contributor

Eskibear commented Nov 9, 2022

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

String url = uriBuilder.encode().toUriString();
return restTemplate.getForObject(url, String.class);

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

@BoykoAlex
Copy link
Contributor

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

@Eskibear
Copy link
Contributor Author

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.

@BoykoAlex
Copy link
Contributor

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

@vudayani
Copy link
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)

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

No branches or pull requests

4 participants