java.lang.Object
io.prometheus.metrics.exporter.pushgateway.PushGateway.Builder
Enclosing class:
PushGateway

public static class PushGateway.Builder extends Object
  • Method Details

    • format

      public PushGateway.Builder format(Format format)
    • address

      public PushGateway.Builder address(String address)
      Address of the Pushgateway in format host:port. Default is localhost:9091. Can be overwritten at runtime with the io.prometheus.exporter.pushgateway.address property.
    • basicAuth

      public PushGateway.Builder basicAuth(String user, String password)
      Username and password for HTTP basic auth when pushing to the Pushgateway.
    • bearerToken

      public PushGateway.Builder bearerToken(String token)
      Bearer token authorization when pushing to the Pushgateway.
    • scheme

      public PushGateway.Builder scheme(Scheme scheme)
      Specify if metrics should be pushed using HTTP or HTTPS. Default is HTTP. Can be overwritten at runtime with the io.prometheus.exporter.pushgateway.scheme property.
    • connectionFactory

      public PushGateway.Builder connectionFactory(HttpConnectionFactory connectionFactory)
      Custom connection factory. Default is DefaultHttpConnectionFactory.

      The PushGatewayTestApp in integration-tests/it-pushgateway/ has an example of a custom connection factory that skips SSL certificate validation for HTTPS connections.

    • job

      public PushGateway.Builder job(String job)
      The job label to be used when pushing metrics. If not provided, the name of the JAR file will be used by default. Can be overwritten at runtime with the io.prometheus.exporter.pushgateway.job property.
    • groupingKey

      public PushGateway.Builder groupingKey(String name, String value)
      Grouping keys to be used when pushing/deleting metrics. Call this method multiple times for adding multiple grouping keys.
    • instanceIpGroupingKey

      public PushGateway.Builder instanceIpGroupingKey() throws UnknownHostException
      Convenience method for adding the current IP address as an "instance" label.
      Throws:
      UnknownHostException
    • registry

      public PushGateway.Builder registry(io.prometheus.metrics.model.registry.PrometheusRegistry registry)
      Push metrics from this registry instead of PrometheusRegistry.defaultRegistry.
    • build

      public PushGateway build()