The Wayback Machine - https://web.archive.org/web/20201020084935/https://github.com/prometheus/jmx_exporter/pull/162
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

Use simple HTTP Server #162

Merged
merged 6 commits into from Jul 17, 2017
Merged

Use simple HTTP Server #162

merged 6 commits into from Jul 17, 2017

Conversation

@leogomes
Copy link
Contributor

@leogomes leogomes commented Jul 10, 2017

Motivation:
#155

Modifications:
Changed the code of both the agent and external HTTP process to use the simple HTTP server provided on prometheus/client_java#73

Result:
JMX exporter works with the simple HTTP Server.

Copy link
Member

@brian-brazil brian-brazil left a comment

Thanks, we'll need to wait until the change over in client_java is in and released. I'm just doing a release for another issue right now.


if (hostnamePort.length == 2) {
port = Integer.parseInt(hostnamePort[1]);
socket = new InetSocketAddress(hostnamePort[0], port);

This comment has been minimized.

@brian-brazil

brian-brazil Jul 10, 2017
Member

We'll want to keep the existing host support around.

This comment has been minimized.

@leogomes

leogomes Jul 10, 2017
Author Contributor

Sure, I will put it back once HTTP server is able to take a host and port. I can do the modification and test, if you want.

new JmxCollector(new File(args[1])).register();
final HTTPServer server = new HTTPServer(socket, CollectorRegistry.defaultRegistry);

Runtime.getRuntime().addShutdownHook(new Thread() {

This comment has been minimized.

@brian-brazil

brian-brazil Jul 13, 2017
Member

We don't need this, the httpserver should keep going until the process dies.

There could be a long time between the TERM and the process actually dying.

@@ -22,12 +22,12 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_servlet</artifactId>
<version>0.0.21</version>
<version>0.0.26-SNAPSHOT</version>

This comment has been minimized.

@brian-brazil

brian-brazil Jul 13, 2017
Member

0.0.25. We don't use snapshot releases in production.

server.start();
server.join();
new JmxCollector(new File(args[1])).register();
new HTTPServer(socket, CollectorRegistry.defaultRegistry);

This comment has been minimized.

@brian-brazil

brian-brazil Jul 13, 2017
Member

There're nothing here to wait, this will shutdown immediately.

This comment has been minimized.

@leogomes

leogomes Jul 14, 2017
Author Contributor

Not really, HTTPServer creates threads that will keep running, even if the main thread exits, c.f. termination of main thread exit.

You can run the PR locally as well.

@@ -23,12 +22,12 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_servlet</artifactId>

This comment has been minimized.

@brian-brazil

brian-brazil Jul 14, 2017
Member

You don't need this any more

@brian-brazil brian-brazil merged commit 5b180af into prometheus:master Jul 17, 2017
@brian-brazil
Copy link
Member

@brian-brazil brian-brazil commented Jul 17, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.