Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
HAWKULAR-284 Adapt pinger, avail creator and e2e test to metrics 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jun 22, 2015
1 parent d48aea1 commit f16c289
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class AvailPublisher {
static {
String host = System.getProperty("jboss.bind.address", "localhost");
String port = System.getProperty("jboss.http.port", "8080");
METRICS_BASE_URI = "http://"+ host + ":"+ port + "/hawkular-metrics";
METRICS_BASE_URI = "http://"+ host + ":"+ port + "/hawkular/metrics";
}

// Avoid concurrent Asynchronous calls to REST services. There seems to be a serious issue with undertow and
Expand All @@ -71,8 +71,8 @@ public void sendToMetricsViaRest(List<SingleAvail> availabilities) {
String rid = avr.id;
String tenantId = avr.tenantId;

HttpPost request = new HttpPost(METRICS_BASE_URI + "/" + tenantId +
"/metrics/availability/" + rid + "/data");
HttpPost request = new HttpPost(METRICS_BASE_URI + "/availability/" + rid + "/data");
request.addHeader("Hawkular-Tenant", tenantId);

Availability availability = new Availability(avr.timestamp, avr.avail.toLowerCase());
List<Availability> list = new ArrayList<>(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ class Scenario1ITest extends AbstractTestBase {
/* Get values for a chart - last 4h data */
def end = System.currentTimeMillis()
def start = end - 4 * 3600 * 1000 // 4h earlier
response = client.get(path: "/hawkular-metrics/$tenantId/metrics/numeric/${resourceId}.$statusCodeId/data",
query: [start: start, end: end])
response = client.get(path: "/hawkular/metrics/gauges/${resourceId}.$statusCodeId/data",
query: [start: start, end: end], headers: ["Hawkular-Tenant": tenantId])
assertEquals(31, response.data.size());

response = client.get(path: "/hawkular-metrics/$tenantId/metrics/numeric/${resourceId}.$durationId/data",
query: [start: start, end: end])
response = client.get(path: "/hawkular/metrics/gauges/${resourceId}.$durationId/data",
query: [start: start, end: end], headers: ["Hawkular-Tenant": tenantId])
assertEquals(27, response.data.size());

/* TODO: define an alert */
Expand All @@ -156,10 +156,11 @@ class Scenario1ITest extends AbstractTestBase {

long time = now + (timeSkewMinutes * 60 * 1000)

response = client.post(path: "/hawkular-metrics/$tenantId/metrics/numeric/$tmp/data",
body: [
[timestamp: time, value: value]
])
response = client.post(path: "/hawkular/metrics/gauges/$tmp/data",
headers: ["Hawkular-Tenant": tenantId],
body: [
[timestamp: time, value: value]
])
assertResponseOk(response.status)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,8 @@ public void sendToMetricsViaRest(PingStatus status) {
String payload = new Gson().toJson(mMetrics);
HttpClient client = HttpClientBuilder.create().build();

// TODO replace for metrics 0.3.3
HttpPost request = new HttpPost(configuration.getMetricsBaseUri() + "/" + status.getDestination().getTenantId()
+ "/metrics/numeric/data");
// HttpPost request = new HttpPost(configuration.getMetricsBaseUri() + "/metrics/numeric/data");
// request.addHeader("tenantId", status.getDestination().getTenantId());
// TODO end replace for metrics 0.3.3
HttpPost request = new HttpPost(configuration.getMetricsBaseUri() + "/gauges/data");
request.addHeader("Hawkular-Tenant", status.getDestination().getTenantId());

request.setEntity(new StringEntity(payload, ContentType.APPLICATION_JSON));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class PingerConfiguration {
static {
String host = System.getProperty("jboss.bind.address", "localhost");
String port = System.getProperty("jboss.http.port", "8080");
INSTANCE = new PingerConfiguration("http://"+ host + ":"+ port + "/hawkular-metrics");
INSTANCE = new PingerConfiguration("http://"+ host + ":"+ port + "/hawkular/metrics");
}

/**
Expand Down

0 comments on commit f16c289

Please sign in to comment.