Skip to content

Commit

Permalink
[HWKMETRICS-317] Fix method names to match purpose.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Negrea committed Oct 22, 2015
1 parent 1756659 commit 0ebf0e8
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 11 deletions.
54 changes: 49 additions & 5 deletions api/diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,11 @@ diff -r '--exclude-from=api/diff-excludes' api/metrics-api-jaxrs/src/main/java/o
< @ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
< response = ApiError.class)
< })
< public void findGuageMetrics(
< public void findAvailabilityMetrics(
< @Suspended AsyncResponse asyncResponse,
< @ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {
---
> public Response findMetrics(
> public Response findAvailabilityMetrics(
> @QueryParam("tags") Tags tags) {
138,148c117,128
< metricObservable
Expand Down Expand Up @@ -867,11 +867,11 @@ diff -r '--exclude-from=api/diff-excludes' api/metrics-api-jaxrs/src/main/java/o
< @ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
< response = ApiError.class)
< })
< public void findGuageMetrics(
< public void findCounterMetrics(
< @Suspended AsyncResponse asyncResponse,
< @ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {
---
> public <T> Response findMetrics(
> public Response findCounterMetrics(
> @QueryParam("tags") Tags tags) {
145,155c118,129
< metricObservable
Expand Down Expand Up @@ -1431,7 +1431,51 @@ diff -r '--exclude-from=api/diff-excludes' api/metrics-api-jaxrs/src/main/java/o
> } catch (Exception e) {
> return serverError(e);
> }
121,128c110,112
123,135c112,113
< @ApiOperation(value = "Find tenant's metric definitions.",
< notes = "Does not include any metric values. ",
< response = MetricDefinition.class, responseContainer = "List")
< @ApiResponses(value = {
< @ApiResponse(code = 200, message = "Successfully retrieved at least one metric definition."),
< @ApiResponse(code = 204, message = "No metrics found."),
< @ApiResponse(code = 400, message = "Invalid type parameter type.", response = ApiError.class),
< @ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
< response = ApiError.class)
< })
< public void findGaugeMetrics(
< @Suspended AsyncResponse asyncResponse,
< @ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {
---
> public Response findGaugeMetrics(
> @QueryParam("tags") Tags tags) {
141,151c119,130
< metricObservable
< .map(MetricDefinition::new)
< .toList()
< .map(ApiUtils::collectionToResponse)
< .subscribe(asyncResponse::resume, t -> {
< if (t instanceof PatternSyntaxException) {
< asyncResponse.resume(badRequest(t));
< } else {
< asyncResponse.resume(serverError(t));
< }
< });
---
> try {
> return metricObservable
> .map(MetricDefinition::new)
> .toList()
> .map(ApiUtils::collectionToResponse)
> .toBlocking()
> .lastOrDefault(null);
> } catch (PatternSyntaxException e) {
> return badRequest(e);
> } catch (Exception e) {
> return serverError(e);
> }
154a134
> @Produces(APPLICATION_JSON)
156,163c136,138
< @ApiOperation(value = "Retrieve single metric definition.", response = MetricDefinition.class)
< @ApiResponses(value = {
< @ApiResponse(code = 200, message = "Metric's definition was successfully retrieved."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Response createAvailabilityMetric(

@GET
@Path("/")
public Response findMetrics(
public Response findAvailabilityMetrics(
@QueryParam("tags") Tags tags) {

Observable<Metric<AvailabilityType>> metricObservable = (tags == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Response createCounter(

@GET
@Path("/")
public <T> Response findMetrics(
public Response findCounterMetrics(
@QueryParam("tags") Tags tags) {

Observable<Metric<Long>> metricObservable = (tags == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Response createGaugeMetric(

@GET
@Path("/")
public Response findMetrics(
public Response findGaugeMetrics(
@QueryParam("tags") Tags tags) {

Observable<Metric<Double>> metricObservable = (tags == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void createAvailabilityMetric(
@ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
response = ApiError.class)
})
public void findGuageMetrics(
public void findAvailabilityMetrics(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void createCounter(
@ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
response = ApiError.class)
})
public void findGuageMetrics(
public void findCounterMetrics(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void createGaugeMetric(
@ApiResponse(code = 500, message = "Failed to retrieve metrics due to unexpected error.",
response = ApiError.class)
})
public void findGuageMetrics(
public void findGaugeMetrics(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "List of tags filters", required = false) @QueryParam("tags") Tags tags) {

Expand Down

0 comments on commit 0ebf0e8

Please sign in to comment.