-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add monitorType JMX #472
base: main
Are you sure you want to change the base?
Add monitorType JMX #472
Conversation
I am not very experienced with Java and Testing in Java. Please feel free to add tests. |
512ce06
to
82cf53d
Compare
82cf53d
to
40cb273
Compare
@@ -18,5 +18,6 @@ public enum ClusterStatsMonitorType | |||
NOOP, | |||
INFO_API, | |||
UI_API, | |||
JDBC | |||
JDBC, | |||
JMX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why existing monitor types don't work well in your environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using oauth for web-ui
on trino and QueryCountBasedRouter
on Trino Gateway, which requires ClusterStats regarding running and queued queries.
UI_API
does not work because of the OauthJDBC
works but often ClusterStats queries go into queue and they time out if it takes longer than 10 secs. This makes Trino Gateway throw 500 erros if it happens on adhoc clusterJMX
is working flawlessly now, I implemented it. This could be the temporary solution, until Trino exposes required stats behind /v1/api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your explanation.
I don't think we want to document it if it's the temporary solution. Please revret changes in docs/installation.md
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
40cb273
to
5389a0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just skimmed.
@@ -0,0 +1,153 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add tests even if this is a temporary solution.
@@ -26,6 +26,7 @@ public class QueryIdCachingProxyHandler | |||
public static final String OAUTH_PATH = "/oauth2"; | |||
public static final String AUTHORIZATION = "Authorization"; | |||
public static final String USER_HEADER = "X-Trino-User"; | |||
public static final String JMX_PATH = "/v1/jmx/mbean"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to ClusterStatsJmxMonitor
class.
{ | ||
String jmxUrl = backend.getProxyTo() + JMX_PATH + "/" + mbeanName; | ||
log.debug("Querying JMX at URL: %s", jmxUrl); | ||
OkHttpClient client = new OkHttpClient.Builder().build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use airlift HTTP client?
|
||
Call call = client.newCall(request); | ||
|
||
try (Response res = call.execute()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid abbreviations. https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#avoid-abbreviations
Call call = client.newCall(request); | ||
|
||
try (Response res = call.execute()) { | ||
if (fromStatusCode(res.code()) == io.airlift.http.client.HttpStatus.OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be more concise if we can import io.airlift.http.client.HttpStatus
Thanks for the reviews. I was on vacation and didn't have time to implement the requested changes yet. I will take care of them in the next days. I might need some support to activate the /v1/jmx/mbean endpoint in the test environment for testing. |
@alaturqua please ping me when this is ready for another look |
Description
This pull request introduces a new
monitorType
for JMX-based monitoring in Trino Gateway. It includes documentation and configuration details for retrieving cluster information using specific JMX metrics.Details
Component: JMX Monitoring in Trino Gateway
New Feature: Added support for
monitorType: JMX
to enable cluster monitoring via JMX metrics.Metrics Used:
trino.execution:name=QueryManager
trino.metadata:name=DiscoveryNodeManager
Configuration Instructions:
backendState
.read
rights onsystem_information
.Example Configuration:
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
(x) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:
*