Skip to content

Commit

Permalink
[HWKMETRICS-185] Force response media type for the Gauge handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Negrea committed Aug 13, 2015
1 parent 07322df commit 102c225
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class GaugeHandler {
private String tenantId;

@POST
@Produces(APPLICATION_JSON)
@Path("/")
@ApiOperation(value = "Create gauge metric definition.", notes = "Clients are not required to explicitly create "
+ "a metric before storing data. Doing so however allows clients to prevent naming collisions and to "
Expand Down Expand Up @@ -119,6 +120,7 @@ public Response createGaugeMetric(
}

@GET
@Produces(APPLICATION_JSON)
@Path("/{id}")
@ApiOperation(value = "Retrieve single metric definition.", response = MetricDefinition.class)
@ApiResponses(value = {
Expand All @@ -139,6 +141,7 @@ public Response getGaugeMetric(@PathParam("id") String id) {
}

@GET
@Produces(APPLICATION_JSON)
@Path("/{id}/tags")
@ApiOperation(value = "Retrieve tags associated with the metric definition.", response = String.class,
responseContainer = "Map")
Expand All @@ -157,6 +160,7 @@ public Response getGaugeMetricTags(@PathParam("id") String id) {
}

@PUT
@Produces(APPLICATION_JSON)
@Path("/{id}/tags")
@ApiOperation(value = "Update tags associated with the metric definition.")
@ApiResponses(value = {
Expand All @@ -176,6 +180,7 @@ public Response updateGaugeMetricTags(
}

@DELETE
@Produces(APPLICATION_JSON)
@Path("/{id}/tags/{tags}")
@ApiOperation(value = "Delete tags associated with the metric definition.")
@ApiResponses(value = {
Expand All @@ -197,6 +202,7 @@ public Response deleteGaugeMetricTags(
}

@POST
@Produces(APPLICATION_JSON)
@Path("/{id}/data")
@ApiOperation(value = "Add data for a single gauge metric.")
@ApiResponses(value = {
Expand All @@ -220,6 +226,7 @@ public Response addDataForMetric(
}

@POST
@Produces(APPLICATION_JSON)
@Path("/data")
@ApiOperation(value = "Add data for multiple gauge metrics in a single call.")
@ApiResponses(value = {
Expand All @@ -241,6 +248,7 @@ public Response addGaugeData(@ApiParam(value = "List of metrics", required = tru
}

@GET
@Produces(APPLICATION_JSON)
@Path("/")
@ApiOperation(value = "Find gauge metrics data by their tags.", response = Map.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully fetched data."),
Expand All @@ -267,6 +275,7 @@ public Response findGaugeDataByTags(@ApiParam(value = "Tag list", required = tru

@GET
@Path("/{id}/data")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve gauge data. When buckets or bucketDuration query parameter is used, the time "
+ "range between start and end will be divided in buckets of equal duration, and metric "
+ "statistics will be computed for each bucket.", response = List.class)
Expand Down Expand Up @@ -327,6 +336,7 @@ public Response findGaugeData(
}

@GET
@Produces(APPLICATION_JSON)
@Path("/{id}/periods")
@ApiOperation(value = "Retrieve periods for which the condition holds true for each consecutive data point.",
response = List.class)
Expand Down Expand Up @@ -383,8 +393,7 @@ public Response findPeriods(
new ApiError("Invalid value for op parameter. Supported values are lt, lte, eq, gt, gte."));
} else {
try {
return metricsService
.getPeriods(new MetricId(tenantId, GAUGE, id), predicate, startTime, endTime)
return metricsService.getPeriods(new MetricId(tenantId, GAUGE, id), predicate, startTime, endTime)
.map(ApiUtils::collectionToResponse).toBlocking().last();
} catch (Exception e) {
return ApiUtils.serverError(e);
Expand All @@ -393,6 +402,7 @@ public Response findPeriods(
}

@GET
@Produces(APPLICATION_JSON)
@Path("/tags/{tags}")
@ApiOperation(value = "Find metric data with given tags.", response = Map.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Me values fetched successfully"),
Expand All @@ -417,6 +427,7 @@ public Response findTaggedGaugeData(@ApiParam("Tag list") @PathParam("tags") Tag
}

@POST
@Produces(APPLICATION_JSON)
@Path("/{id}/tag")
@ApiOperation(value = "Add or update gauge metric's tags.")
@ApiResponses(value = {
Expand Down

0 comments on commit 102c225

Please sign in to comment.