Commit 1608bf81 authored by Matteo Melli's avatar Matteo Melli
Browse files

Merge branch 'fix-prometheus-service' into 'master'

Version 1.0.3

See merge request ongresinc/pgio!10
parents 592f1e38 96fc2b37
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
  <parent>
    <artifactId>pgio-parent</artifactId>
    <groupId>com.ongres.pgio</groupId>
    <version>1.0.1</version>
    <version>1.0.3</version>
  </parent>

  <artifactId>main</artifactId>
+7 −4
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import com.ongres.pgio.main.stats.serializer.StatSerializer;
import com.ongres.pgio.main.version.Version;

import fi.iki.elonen.NanoHTTPD;

import joptsimple.OptionException;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -48,6 +47,7 @@ import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;

@@ -138,9 +138,12 @@ public class Main {
    return message;
  }
  
  private static void runPrometheusService(Config config) throws IOException {
  private static void runPrometheusService(Config config) throws Exception {
    PrometheusService service = new PrometheusService(config);
    service.start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
    while (true) {
      TimeUnit.MICROSECONDS.sleep(20);
    }
  }

  private static void runCollector(Config config) throws Exception, InterruptedException {
@@ -191,11 +194,11 @@ public class Main {
        "Run as a prometheus service (advanced option)")
      .availableIf("advanced");
    parser.acceptsAll(Lists.newArrayList("prometheus-bind"), 
        "The bind address of prometheus service (advanced option)")
        "The bind address of prometheus service, default is localhost (advanced option)")
      .availableIf("advanced")
      .withRequiredArg();
    parser.acceptsAll(Lists.newArrayList("prometheus-port"), 
        "The port of prometheus service (advanced option)")
        "The port of prometheus service, default is 9544 (advanced option)")
      .availableIf("advanced")
      .withRequiredArg();
    parser.acceptsAll(Lists.newArrayList("ppid"), 
+2 −2
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class Config {
    private Optional<Integer> ppid = Optional.empty();
    private boolean prometheusService;
    private InetAddress prometheusBind;
    private int prometheusPort = 8000;
    private int prometheusPort = 9544;
    private boolean noPrintHeader;
    private boolean showSystem;
    private boolean showOther;
@@ -122,7 +122,7 @@ public class Config {
    
    public Builder() {
      try {
        prometheusBind = InetAddress.getLocalHost();
        prometheusBind = InetAddress.getByName("localhost");
      } catch (UnknownHostException ex) {
        throw new RuntimeException(ex);
      }
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@

  <groupId>com.ongres.pgio</groupId>
  <artifactId>pgio-parent</artifactId>
  <version>1.0.1</version>
  <version>1.0.3</version>
  <packaging>pom</packaging>

  <prerequisites>