diff --git a/simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/PushGateway.java b/simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/PushGateway.java index cde5071fc..88857fa84 100644 --- a/simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/PushGateway.java +++ b/simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/PushGateway.java @@ -94,8 +94,6 @@ public void setConnectionFactory(HttpConnectionFactory connectionFactory) { * Creates a URL instance from a String representation of a URL without throwing a checked exception. * Required because you can't wrap a call to another constructor in a try statement. * - * TODO: Remove this along with other deprecated methods before version 1.0 is released. - * * @param urlString the String representation of the URL. * @return The URL instance. */ @@ -216,66 +214,6 @@ public void delete(String job, Map groupingKey) throws IOExcepti doRequest(null, job, groupingKey, "DELETE"); } - - /** - * Pushes all metrics in a registry, replacing all those with the same job and instance. - *

- * This uses the PUT HTTP method. - * @deprecated use {@link #push(CollectorRegistry, String, Map)} - */ - @Deprecated - public void push(CollectorRegistry registry, String job, String instance) throws IOException { - push(registry, job, Collections.singletonMap("instance", instance)); - } - - /** - * Pushes all metrics in a Collector, replacing all those with the same job and instance. - *

- * This is useful for pushing a single Gauge. - *

- * This uses the PUT HTTP method. - * @deprecated use {@link #push(Collector, String, Map)} - */ - @Deprecated - public void push(Collector collector, String job, String instance) throws IOException { - push(collector, job, Collections.singletonMap("instance", instance)); - } - - /** - * Pushes all metrics in a registry, replacing only previously pushed metrics of the same name. - *

- * This uses the POST HTTP method. - * @deprecated use {@link #pushAdd(CollectorRegistry, String, Map)} - */ - @Deprecated - public void pushAdd(CollectorRegistry registry, String job, String instance) throws IOException { - pushAdd(registry, job, Collections.singletonMap("instance", instance)); - } - - /** - * Pushes all metrics in a Collector, replacing only previously pushed metrics of the same name. - *

- * This is useful for pushing a single Gauge. - *

- * This uses the POST HTTP method. - * @deprecated use {@link #pushAdd(Collector, String, Map)} - */ - @Deprecated - public void pushAdd(Collector collector, String job, String instance) throws IOException { - pushAdd(collector, job, Collections.singletonMap("instance", instance)); - } - - /** - * Deletes metrics from the Pushgateway. - *

- * This uses the DELETE HTTP method. - * @deprecated use {@link #delete(String, Map)} - */ - @Deprecated - public void delete(String job, String instance) throws IOException { - delete(job, Collections.singletonMap("instance", instance)); - } - void doRequest(CollectorRegistry registry, String job, Map groupingKey, String method) throws IOException { String url = gatewayBaseURL; if (job.contains("/")) { diff --git a/simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/PushGatewayTest.java b/simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/PushGatewayTest.java index 9e7cb71f3..874595b18 100644 --- a/simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/PushGatewayTest.java +++ b/simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/PushGatewayTest.java @@ -214,91 +214,6 @@ public void testDeleteWithGroupingKey() throws IOException { pg.delete("j", groupingKey); } - @Test - public void testOldPushWithoutInstance() throws IOException { - mockServerClient.when( - request() - .withMethod("PUT") - .withPath("/metrics/job/j/instance@base64/=") - ).respond(response().withStatusCode(202)); - pg.push(registry, "j", ""); - } - - @Test - public void testOldPushWithInstance() throws IOException { - mockServerClient.when( - request() - .withMethod("PUT") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(202)); - pg.push(registry, "j", "i"); - } - - @Test - public void testOldNon202ResponseThrows() throws IOException { - mockServerClient.when( - request() - .withMethod("PUT") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(500)); - thrown.expect(IOException.class); - thrown.expectMessage( - "Response code from http://localhost:" - + mockServerRule.getHttpPort() - + "/metrics/job/j/instance/i was 500"); - pg.push(registry,"j", "i"); - } - - @Test - public void testOldPushWithSlashes() throws IOException { - mockServerClient.when( - request() - .withMethod("PUT") - .withPath("/metrics/job@base64/YS9i/instance@base64/Yy9k") - ).respond(response().withStatusCode(202)); - pg.push(registry, "a/b", "c/d"); - } - - @Test - public void testOldPushCollector() throws IOException { - mockServerClient.when( - request() - .withMethod("PUT") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(202)); - pg.push(gauge, "j", "i"); - } - - @Test - public void testOldPushAdd() throws IOException { - mockServerClient.when( - request() - .withMethod("POST") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(202)); - pg.pushAdd(registry, "j", "i"); - } - - @Test - public void testOldPushAddCollector() throws IOException { - mockServerClient.when( - request() - .withMethod("POST") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(202)); - pg.pushAdd(gauge, "j", "i"); - } - - @Test - public void testOldDelete() throws IOException { - mockServerClient.when( - request() - .withMethod("DELETE") - .withPath("/metrics/job/j/instance/i") - ).respond(response().withStatusCode(202)); - pg.delete("j", "i"); - } - @Test public void testInstanceIPGroupingKey() throws IOException { groupingKey = PushGateway.instanceIPGroupingKey();