Skip to content

Commit

Permalink
Add support for relative timestamps.
Browse files Browse the repository at this point in the history
(cherry picked from commit 9d4a197)
Signed-off-by: Stefan Negrea <snegrea@redhat.com>
  • Loading branch information
Stefan Negrea committed Aug 9, 2016
1 parent c9ef05f commit fd08659
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ public void deprecatedAddAvailabilityData(
public void deprecatedFindAvailabilityData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Set to true to return only distinct, contiguous values")
Expand Down Expand Up @@ -388,8 +388,8 @@ public void deprecatedFindAvailabilityData(
public void getMetricData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Set to true to return only distinct, contiguous values")
@QueryParam("distinct") @DefaultValue("false") Boolean distinct,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
Expand Down Expand Up @@ -435,8 +435,8 @@ public void getMetricData(
public void getMetricStats(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ public void deprecatedAddData(
public void deprecatedFindCounterData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
Expand Down Expand Up @@ -459,8 +459,8 @@ public void deprecatedFindCounterData(
public void getMetricData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
Expand Down Expand Up @@ -504,8 +504,8 @@ public void getMetricData(
public void getMetricStats(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
Expand Down Expand Up @@ -599,8 +599,8 @@ public void getMetricStats(
public void getMetricRate(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
@ApiParam(value = "Data point sort order, based on timestamp") @QueryParam("order") Order order,
@Deprecated @ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
Expand Down Expand Up @@ -670,8 +670,8 @@ public void getMetricRate(
public void getMetricStatsRate(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles
Expand Down Expand Up @@ -723,8 +723,8 @@ public void getMetricStatsRate(
response = ApiError.class) })
public void getStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down Expand Up @@ -781,8 +781,8 @@ public void getStats(
response = NumericBucketPoint.class, responseContainer = "List")
public void deprecatedFindCounterDataStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down Expand Up @@ -810,8 +810,8 @@ public void deprecatedFindCounterDataStats(
response = ApiError.class) })
public void getRateStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down Expand Up @@ -868,8 +868,8 @@ public void getRateStats(
response = NumericBucketPoint.class, responseContainer = "List")
public void deprecatedFindCounterRateDataStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down Expand Up @@ -897,8 +897,8 @@ public void deprecatedFindCounterRateDataStats(
public void getMetricStatsByTags(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
@ApiParam(value = "Tags") @PathParam("tags") Tags tags
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ public void deprecatedAddGaugeData(
public void deprecatedFindGaugeData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
Expand Down Expand Up @@ -462,8 +462,8 @@ public void deprecatedFindGaugeData(
public void getMetricData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
Expand Down Expand Up @@ -507,8 +507,8 @@ public void getMetricData(
public void getMetricStats(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Use data from earliest received, subject to retention period")
@QueryParam("fromEarliest") Boolean fromEarliest,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
Expand Down Expand Up @@ -592,8 +592,8 @@ public void getMetricStats(
response = ApiError.class) })
public void getStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down Expand Up @@ -659,8 +659,8 @@ public void getStats(
public void getMetricStatsByTags(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
@ApiParam(value = "Tags") @PathParam("tags") Tags tags
) {
Expand All @@ -686,8 +686,8 @@ public void getMetricStatsByTags(
response = NumericBucketPoint.class, responseContainer = "List")
public void deprecatedFindData(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand All @@ -711,8 +711,8 @@ public void deprecatedFindData(
public void getMetricPeriods(
@Suspended final AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "A threshold against which values are compared", required = true)
@QueryParam("threshold") double threshold,
@ApiParam(value = "A comparison operation to perform between values and the threshold.", required = true,
Expand Down Expand Up @@ -777,8 +777,8 @@ public void getMetricPeriods(
public void getMetricRate(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
@ApiParam(value = "Data point sort order, based on timestamp") @QueryParam("order") Order order
) {
Expand Down Expand Up @@ -820,8 +820,8 @@ public void getMetricRate(
public void getMetricRateStats(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles
Expand Down Expand Up @@ -873,8 +873,8 @@ public void getMetricRateStats(
response = ApiError.class)})
public void getRateStats(
@Suspended AsyncResponse asyncResponse,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") final String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") final String end,
@ApiParam(value = "Total number of buckets") @QueryParam("buckets") Integer bucketsCount,
@ApiParam(value = "Bucket duration") @QueryParam("bucketDuration") Duration bucketDuration,
@ApiParam(value = "Percentiles to calculate") @QueryParam("percentiles") Percentiles percentiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ public void getData(
public void getMetricData(
@Suspended AsyncResponse asyncResponse,
@PathParam("id") String id,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") Long start,
@ApiParam(value = "Defaults to now") @QueryParam("end") Long end,
@ApiParam(value = "Defaults to now - 8 hours") @QueryParam("start") String start,
@ApiParam(value = "Defaults to now") @QueryParam("end") String end,
@ApiParam(value = "Set to true to return only distinct, contiguous values")
@QueryParam("distinct") @DefaultValue("false") Boolean distinct,
@ApiParam(value = "Limit the number of data points returned") @QueryParam("limit") Integer limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public interface IMetricsHandler<T> {

void addMetricData(AsyncResponse asyncResponse, String id, List<DataPoint<T>> data);

void getMetricData(AsyncResponse asyncResponse, String id, Long start, Long end, Boolean flag, Integer limit,
void getMetricData(AsyncResponse asyncResponse, String id, String start, String end, Boolean flag, Integer limit,
Order order);
}

0 comments on commit fd08659

Please sign in to comment.