From 4dee278035647ad766e77f4e290aa16610b3e9ef Mon Sep 17 00:00:00 2001 From: Prateek Jain Date: Tue, 13 Aug 2019 17:01:40 -0700 Subject: [PATCH 1/2] added support sample interpolation in swagger --- ...ggregateSeriesWithSampleInterpolation.json | 114 ++++++++++++++++++ .../timeseriesinsights.json | 39 +++++- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json diff --git a/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json new file mode 100644 index 000000000000..e8b9fc03e1b7 --- /dev/null +++ b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json @@ -0,0 +1,114 @@ +{ + "parameters": { + "api-version": "2018-11-01-preview", + "environmentFqdn": "10000000-0000-0000-0000-100000000109.env.timeseries.azure.com", + "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0=", + "parameters": { + "aggregateSeries": { + "timeSeriesId": [ + "006dfc2d-0324-4937-998c-d16f3b4f1952", + "T1" + ], + "searchSpan": { + "from": "2016-08-01T00:00:00Z", + "to": "2016-08-01T00:16:50Z" + }, + "interval": "PT1M", + "inlineVariables": { + "LinearSampleInterpolation": { + "kind": "numeric", + "value": { + "tsx": "$event.Temperature" + }, + "filter": null, + "interpolation": { + "kind": "linear", + "boundary": { + "span": "P1D" + } + }, + "aggregation": { + "tsx": "left($value)" + } + }, + "StepSampleInterpolation": { + "kind": "numeric", + "value": { + "tsx": "$event.Temperature" + }, + "filter": null, + "interpolation": { + "kind": "step", + "boundary": { + "span": "P1D" + } + }, + "aggregation": { + "tsx": "left($value)" + } + } + }, + "projectedVariables": [ + "LinearSampleInterpolation", + "StepSampleInterpolation" + ] + } + } + }, + "responses": { + "200": { + "body": { + "timestamps": [ + "2016-08-01T00:00:00Z", + "2016-08-01T00:01:00Z", + "2016-08-01T00:02:00Z", + "2016-08-01T00:03:00Z", + "2016-08-01T00:04:00Z", + "2016-08-01T00:05:00Z", + "2016-08-01T00:06:00Z", + "2016-08-01T00:07:00Z", + "2016-08-01T00:08:00Z", + "2016-08-01T00:09:00Z", + "2016-08-01T00:10:00Z" + ], + "properties": [ + { + "name": "LinearSampleInterpolation", + "type": "Double", + "values": [ + 50.0, + 60.0, + 60.0, + 60.0, + 60.0, + 60.0, + 60.0, + 60.0, + 60.0, + 60.0, + 62.0 + ] + }, + { + "name": "StepSampleInterpolation", + "type": "Double", + "values": [ + 71.25, + 85.0, + 82.5, + 80.0, + 89.166666666666671, + 75.0, + 90.0, + 75.833333333333329, + 85.0, + 82.5, + 84.0 + ] + } + ], + "progress": 100.0 + } + } + } +} \ No newline at end of file diff --git a/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/timeseriesinsights.json b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/timeseriesinsights.json index 1c5d2ae9a874..9172a5155e10 100644 --- a/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/timeseriesinsights.json +++ b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/timeseriesinsights.json @@ -291,6 +291,9 @@ "QueryAggregateSeriesPage2": { "$ref": "./examples/QueryAggregateSeriesPage2.json" }, + "QueryAggregateSeriesWithSampleInterpolation": { + "$ref": "./examples/QueryAggregateSeriesWithSampleInterpolation.json" + }, "QueryGetEventsPage1": { "$ref": "./examples/QueryGetEventsPage1.json" }, @@ -1158,6 +1161,34 @@ "tsx" ] }, + "Interpolation": { + "description": "The interpolation operation to be performed on the raw data points. Interpolation is only supported in \"numeric\" variables. Currently, only sampling of interpolated time series is allowed. Allowed aggregate function - eg: left($value). Can be null if no interpolation needs to be applied.", + "type": "object", + "properties": { + "kind": { + "description": "The type of interpolation technique : \"Linear\" or \"Step\".", + "type": "string", + "enum": [ + "Linear", + "Step" + ], + "x-ms-enum": { + "name": "InterpolationKind", + "modelAsString": true + } + }, + "boundary": { + "description": "The time range to the left and right of the search span to be used for Interpolation. This is helpful in scenarios where the data points are missing close to the start or end of the input search span. Can be null.", + "type": "object", + "properties": { + "span": { + "type": "string", + "format": "duration" + } + } + } + } + }, "DateTimeRange": { "description": "The range of time. Cannot be null or negative.", "type": "object", @@ -1192,6 +1223,9 @@ "description": "Value time series expression is used to represent the value of the signal that is going to be aggregated or interpolated. For example, temperature values from the event is represented like this: \"$event.Temperature.Double\".", "$ref": "#/definitions/Tsx" }, + "interpolation": { + "$ref": "#/definitions/Interpolation" + }, "aggregation": { "description": "Aggregation time series expression when kind is \"numeric\" is used to represent the aggregation that needs to be performed on the $value expression. This requires $value to be specified and can only use $value inside the aggregate functions. For example, aggregation for calculating minimum of the $value is written as: \"min($value)\".", "$ref": "#/definitions/Tsx" @@ -1206,7 +1240,7 @@ ] }, "AggregateVariable": { - "description": "Aggregate variable represents any aggregation calculation.", + "description": "Aggregate variable represents any aggregation calculation. Aggregate Variables does not support interpolation.", "x-ms-discriminator-value": "aggregate", "allOf": [ { @@ -1239,6 +1273,9 @@ "filter": { "description": "Filter over the events that restricts the number of events being considered for computation. Example: \"$event.Status.String='Good'\". Optional.", "$ref": "#/definitions/Tsx" + }, + "interpolation": { + "$ref": "#/definitions/Interpolation" } }, "required": [ From 70e7e382ca7526ccdadf634cab0c47843d4868dd Mon Sep 17 00:00:00 2001 From: Prateek Jain Date: Tue, 13 Aug 2019 17:35:46 -0700 Subject: [PATCH 2/2] Fixed the model validation failure --- .../examples/QueryAggregateSeriesWithSampleInterpolation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json index e8b9fc03e1b7..53871a08278a 100644 --- a/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json +++ b/specification/timeseriesinsights/data-plane/Microsoft.TimeSeriesInsights/preview/2018-11-01-preview/examples/QueryAggregateSeriesWithSampleInterpolation.json @@ -22,7 +22,7 @@ }, "filter": null, "interpolation": { - "kind": "linear", + "kind": "Linear", "boundary": { "span": "P1D" } @@ -38,7 +38,7 @@ }, "filter": null, "interpolation": { - "kind": "step", + "kind": "Step", "boundary": { "span": "P1D" }