To use pushgateway instead:
new PushGateway("localhost:9091").pushAdd(registry.getPrometheusRegistry(), "samples");

@return A prometheus registry.
337994
public static PrometheusMeterRegistry prometheus() {
        PrometheusMeterRegistry prometheusRegistry = new PrometheusMeterRegistry(new PrometheusConfig() {
            @Override
            public Duration step() {
                return Duration.ofSeconds(10);
            }

            @Override
            @Nullable
            public String get(String k) {
                return null;
            }
        });

        try {
            HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
            server.createContext("/prometheus", httpExchange -> {
                String response = prometheusRegistry.scrape();
                httpExchange.sendResponseHeaders(200, response.length());
                OutputStream os = httpExchange.getResponseBody();
                os.write(response.getBytes());
                os.close();
            });

            new Thread(server::start).run();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return prometheusRegistry;
    }
403069
public static Map<String, Object> getRegistry(String registryName) {
		if (StringUtils.isBlank(registryName)) {
			return null;
		}
		Sysprop registryObject = readRegistryObject(registryName);
		return registryObject == null ? null : registryObject.getProperties();
	}
336792
@Override
    public com.ibm.websphere.security.UserRegistry getExternalUserRegistry(UserRegistry userRegistry) {
        if (userRegistry instanceof ExternalUserRegistryWrapper) {
            return ((ExternalUserRegistryWrapper) userRegistry).getExternalUserRegistry();
        }
        return new UserRegistryWrapper(userRegistry);
    }
1335657
public AwsServiceClient withCodecRegistry(@Nonnull final CodecRegistry codecRegistry) {
    return new AwsServiceClientImpl(proxy.withCodecRegistry(codecRegistry), dispatcher);
  }
178366
public String getAbsoluteSelfRegistrationPath() {
    if (selfRegistrationPath == null) {
      return null;
    }
    String root = registryOperations.getConfig().getTrimmed(
        RegistryConstants.KEY_REGISTRY_ZK_ROOT,
        RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
    return RegistryPathUtils.join(root, selfRegistrationPath);
  }
678249
private static ServiceRegistrarFactory createFactory() {
    final ServiceRegistrarFactory factory;
    final ServiceRegistrarFactory installed;
    try {
      installed = ServiceRegistrarLoader.load();
    } catch (ServiceRegistrarLoadingException e) {
      throw new RuntimeException("Unable to load service registrar", e);
    }
    if (installed == null) {
      log.debug("No service registrar plugin configured");
      factory = new NopServiceRegistrarFactory();
    } else {
      factory = installed;
      final String name = factory.getClass().getName();
      log.info("Loaded installed service registrar: {}", name);
    }
    return factory;
  }
1336701
public static GridRegistry newInstance(Hub hub) {
    DefaultGridRegistry registry = new DefaultGridRegistry(hub);
    registry.start();
    return registry;
  }
905322
protected ApiRegistryBean getApiRegistry(String organizationId, String clientId, String version,
            boolean hasPermission) throws ClientNotFoundException, NotAuthorizedException {
        // Try to get the client first - will throw a ClientNotFoundException if not found.
        ClientVersionBean clientVersion = getClientVersionInternal(organizationId, clientId, version, hasPermission);

        Map<String, IGatewayLink> gatewayLinks = new HashMap<>();
        Map<String, GatewayBean> gateways = new HashMap<>();
        boolean txStarted = false;
        try {
            ApiRegistryBean apiRegistry = query.getApiRegistry(organizationId, clientId, version);

            // Hide some stuff if the user doesn't have the clientView permission
            if (hasPermission) {
                apiRegistry.setApiKey(clientVersion.getApikey());
            }

            List<ApiEntryBean> apis = apiRegistry.getApis();

            storage.beginTx();
            txStarted = true;
            for (ApiEntryBean api : apis) {
                String gatewayId = api.getGatewayId();
                // Don't return the gateway id.
                api.setGatewayId(null);
                GatewayBean gateway = gateways.get(gatewayId);
                if (gateway == null) {
                    gateway = storage.getGateway(gatewayId);
                    gateways.put(gatewayId, gateway);
                }
                IGatewayLink link = gatewayLinks.get(gatewayId);
                if (link == null) {
                    link = gatewayLinkFactory.create(gateway);
                    gatewayLinks.put(gatewayId, link);
                }

                ApiEndpoint se = link.getApiEndpoint(api.getApiOrgId(), api.getApiId(), api.getApiVersion());
                String apiEndpoint = se.getEndpoint();
                api.setHttpEndpoint(apiEndpoint);
            }

            return apiRegistry;
        } catch (StorageException|GatewayAuthenticationException e) {
            throw new SystemErrorException(e);
        } finally {
            if (txStarted) {
                storage.rollbackTx();
            }
            for (IGatewayLink link : gatewayLinks.values()) {
                link.close();
            }
        }
    }
136166
public Registry getRegistry() throws RemoteException {
        if (registry == null) {
            if (StringUtils.hasText(host)) {
                registry = LocateRegistry.getRegistry(host, port);
            } else {
                registry = LocateRegistry.getRegistry(port);
            }
        }

        return registry;
    }
393191
public final J4pClientBuilder useProxyFromEnvironment(){
        Map<String, String> env = System.getenv();
        for (String key : env.keySet()) {
            if (key.equalsIgnoreCase("http_proxy")){
                httpProxy = parseProxySettings(env.get(key));
                break;
            }
        }
        return this;
    }
581830
public static Stream<PrometheusMetric> filteredMetrics(PullProcessorPipeline registry) throws Exception {
        Stream <PrometheusMetric> m = registry.get().stream()
                .flatMap((TimeSeriesValue i) -> {
                    Map<MetricName, MetricValue> metrics = i.getMetrics();
                    GroupName group = i.getGroup();
                    return metrics.entrySet().stream()
                            .filter((kv) -> kv.getValue().value().isPresent())
                            .map((kv) -> {
                                final String metric_group = toPrometheusString_(group.getPath().getPath());
                                final Map<String, String> tags = group.getTags().stream()
                                        .filter(tag -> tag.getValue().asString().isPresent())
                                        .collect(Collectors.toMap(
                                                tag -> escapeprometheus(tag.getKey()),
                                                tag -> escapeLabelValue_(tag.getValue().asString().get())));
                                final String metric_name = toPrometheusString_(kv.getKey().getPath());
                                final Number metric_value = kv.getValue().value().get();
                                return new PrometheusMetric(metric_group, tags, metric_name, metric_value);
                            });
                }
1087149
static TokenLifeCycleManager getInstance(final String iamEndpoint,
            final String apiKey) {
        if (iamEndpoint == null || iamEndpoint.isEmpty()) {
            throw new IllegalArgumentException(
                    "Cannot initialize with null or empty IAM endpoint.");
        }
        if (apiKey == null || apiKey.isEmpty()) {
            throw new IllegalArgumentException(
                    "Cannot initialize with null or empty IAM apiKey.");
        }
        return getInstanceUnchecked(iamEndpoint, apiKey);
    }
954538
public static Gateway createGateway() {
        Gateway gateway = null;
        for (GatewayCreator factory : loader) {
            gateway = factory.createGateway(gateway);
            factory.configureGateway(gateway);
        }

        if (gateway == null) {
            throw new RuntimeException("Failed to load GatewayCreator implementation class.");
        }

        return gateway;
    }
759370
@Override
    public SibRaEndpointInvoker getEndpointInvoker()
                    throws ResourceAdapterInternalException {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
            SibTr.entry(this, TRACE, "getEndpointInvoker");

        // Create a Map of properties to pass into the new endpoint invoker. These are admin props that are
        // relevant in other classes so need to be passed through... NOTE: 'forwarder does not modify...'
        // is synonymous with 'producer does not modify...', so translate the forwarder property here to make
        // payload handling for incoming messages simpler
        Map<String, String> passThruProps = new HashMap<String, String>();
        passThruProps.put(JmsraConstants.CONSUMER_DOES_NOT_MODIFY_PAYLOAD_AFTER_GET, getConsumerDoesNotModifyPayloadAfterGet());
        passThruProps.put(JmsraConstants.PRODUCER_DOES_NOT_MODIFY_PAYLOAD_AFTER_SET, getForwarderDoesNotModifyPayloadAfterSet());

        // Create a new endpoint invoker, passing in the pass thru props
        JmsJcaEndpointInvokerImpl epInvoker = new JmsJcaEndpointInvokerImpl(passThruProps);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
            SibTr.exit(this, TRACE, "getEndpointInvoker", epInvoker);

        return epInvoker;
    }
158113
protected CuratorFramework createZKClient() {
        val serviceConfig = getServiceConfig();
        CuratorFramework zkClient = CuratorFrameworkFactory
                .builder()
                .connectString(serviceConfig.getZkURL())
                .namespace("pravega/" + serviceConfig.getClusterName())
                .retryPolicy(new ExponentialBackoffRetry(serviceConfig.getZkRetrySleepMs(), serviceConfig.getZkRetryCount()))
                .sessionTimeoutMs(serviceConfig.getZkSessionTimeoutMs())
                .build();
        zkClient.start();
        return zkClient;
    }
232304
public synchronized MD5Digest register(Schema schema, PostMethod post) throws SchemaRegistryException {

    // Change namespace if override specified
    if (this.namespaceOverride.isPresent()) {
      schema = AvroUtils.switchNamespace(schema, this.namespaceOverride.get());
    }

    LOG.info("Registering schema " + schema.toString());

    post.addParameter("schema", schema.toString());

    HttpClient httpClient = this.borrowClient();
    try {
      LOG.debug("Loading: " + post.getURI());
      int statusCode = httpClient.executeMethod(post);
      if (statusCode != HttpStatus.SC_CREATED) {
        throw new SchemaRegistryException("Error occurred while trying to register schema: " + statusCode);
      }

      String response;
      response = post.getResponseBodyAsString();
      if (response != null) {
        LOG.info("Received response " + response);
      }

      String schemaKey;
      Header[] headers = post.getResponseHeaders(SCHEMA_ID_HEADER_NAME);
      if (headers.length != 1) {
        throw new SchemaRegistryException(
            "Error reading schema id returned by registerSchema call: headers.length = " + headers.length);
      } else if (!headers[0].getValue().startsWith(SCHEMA_ID_HEADER_PREFIX)) {
        throw new SchemaRegistryException(
            "Error parsing schema id returned by registerSchema call: header = " + headers[0].getValue());
      } else {
        LOG.info("Registered schema successfully");
        schemaKey = headers[0].getValue().substring(SCHEMA_ID_HEADER_PREFIX.length());
      }
      MD5Digest schemaId = MD5Digest.fromString(schemaKey);
      return schemaId;
    } catch (Throwable t) {
      throw new SchemaRegistryException(t);
    } finally {
      post.releaseConnection();
      this.httpClientPool.returnObject(httpClient);
    }
  }
280910
RegistryEntry getRegistryEntry(String pid) {
        if (pid == null) {
            return null;
        }
        return entryMap.get(pid);
    }