Skip to content

Commit e6af07c

Browse files
asafstsergey-shandar
authored andcommitted
[Monitor] Add Public Preview APIs of Metric Baseline (#2049)
* [Monitor] Add Public Preview APIs of Metric Baseline These APIs include: 1. Getting the pre-calculated baseline of a metric 2. Calculating the baseline of a metric given the metric values * Fixed comments on swagger structure * Fixed Sensitivity enum name * Fixed sensitivity enum name
1 parent 33fa176 commit e6af07c

File tree

6 files changed

+740
-0
lines changed

6 files changed

+740
-0
lines changed
Lines changed: 358 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,358 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "MonitorManagementClient",
5+
"x-ms-code-generation-settings": {
6+
"name": "MonitorManagementClient"
7+
},
8+
"version": "2017-11-01-preview"
9+
},
10+
"host": "management.azure.com",
11+
"schemes": [
12+
"https"
13+
],
14+
"consumes": [
15+
"application/json"
16+
],
17+
"produces": [
18+
"application/json"
19+
],
20+
"security": [
21+
{
22+
"azure_auth": [
23+
"user_impersonation"
24+
]
25+
}
26+
],
27+
"securityDefinitions": {
28+
"azure_auth": {
29+
"type": "oauth2",
30+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
31+
"flow": "implicit",
32+
"description": "Azure Active Directory OAuth2 Flow",
33+
"scopes": {
34+
"user_impersonation": "impersonate your user account"
35+
}
36+
}
37+
},
38+
"paths": {
39+
"/{resourceUri}/providers/microsoft.insights/baseline/{metricName}": {
40+
"get": {
41+
"tags": [
42+
"Baseline"
43+
],
44+
"operationId": "MetricBaseline_Get",
45+
"description": "**Gets the baseline values for a specific metric**.",
46+
"parameters": [
47+
{
48+
"$ref": "#/parameters/ExtendedResourceUriParameter"
49+
},
50+
{
51+
"$ref": "#/parameters/MetricNameParameter"
52+
},
53+
{
54+
"$ref": "#/parameters/TimespanParameter"
55+
},
56+
{
57+
"$ref": "#/parameters/IntervalParameter"
58+
},
59+
{
60+
"$ref": "#/parameters/AggregationParameter"
61+
},
62+
{
63+
"$ref": "#/parameters/SensitivitiesParameter"
64+
},
65+
{
66+
"$ref": "#/parameters/BaselineResultTypeParameter"
67+
},
68+
{
69+
"$ref": "#/parameters/ApiVersionParameter"
70+
}
71+
],
72+
"responses": {
73+
"default": {
74+
"description": "Error response describing why the operation failed.",
75+
"schema": {
76+
"$ref": "#/definitions/ErrorResponse"
77+
}
78+
},
79+
"200": {
80+
"description": "Successful request to get the list of metric values.",
81+
"schema": {
82+
"$ref": "#/definitions/BaselineResponse"
83+
},
84+
"examples": {
85+
"application/json": {
86+
"id": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Insights/baseline/PercentageCpu",
87+
"type": "Microsoft.Insights/baseline",
88+
"name": {
89+
"value": "PercentageCpu"
90+
},
91+
"properties": {
92+
"timespan": "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z",
93+
"aggregation": "Average",
94+
"interval": "PT1H",
95+
"timestamps": [
96+
"2017-04-14T02:20:00Z",
97+
"2017-04-14T03:20:00Z"
98+
],
99+
"baseline": [
100+
{
101+
"sensitivity": "Low",
102+
"lowThresholds": [
103+
30.0,
104+
31.1
105+
],
106+
"highThresholds": [
107+
90.3453,
108+
91.3453
109+
]
110+
},
111+
{
112+
"sensitivity": "Medium",
113+
"lowThresholds": [
114+
50.0,
115+
51.1
116+
],
117+
"highThresholds": [
118+
70.3453,
119+
71.3453
120+
]
121+
}
122+
]
123+
}
124+
}
125+
}
126+
}
127+
},
128+
"x-ms-examples": {
129+
"Get Metric for data": { "$ref": "./examples/GetBaseline.json" },
130+
"Get Metric for metadata": { "$ref": "./examples/GetBaselineMetadata.json" }
131+
}
132+
}
133+
}
134+
},
135+
"definitions": {
136+
"LocalizableString": {
137+
"required": [ "value" ],
138+
"properties": {
139+
"value": {
140+
"type": "string",
141+
"description": "the invariant value."
142+
},
143+
"localizedValue": {
144+
"type": "string",
145+
"description": "the locale specific value."
146+
}
147+
},
148+
"description": "The localizable string class."
149+
},
150+
"BaselineMetadataValue": {
151+
"properties": {
152+
"name": {
153+
"$ref": "#/definitions/LocalizableString",
154+
"description": "the name of the metadata."
155+
},
156+
"value": {
157+
"type": "string",
158+
"description": "the value of the metadata."
159+
}
160+
},
161+
"description": "Represents a baseline metadata value."
162+
},
163+
"ErrorResponse": {
164+
"description": "Describes the format of Error response.",
165+
"type": "object",
166+
"properties": {
167+
"code": {
168+
"description": "Error code",
169+
"type": "string"
170+
},
171+
"message": {
172+
"description": "Error message indicating why the operation failed.",
173+
"type": "string"
174+
}
175+
}
176+
},
177+
"BaselineResponse": {
178+
"type": "object",
179+
"properties": {
180+
"id": {
181+
"type": "string",
182+
"readOnly": true,
183+
"description": "the metric baseline Id."
184+
},
185+
"type": {
186+
"type": "string",
187+
"readOnly": true,
188+
"description": "the resource type of the baseline resource."
189+
},
190+
"name": {
191+
"$ref": "#/definitions/LocalizableString",
192+
"readOnly": true,
193+
"description": "the name and the display name of the metric, i.e. it is localizable string."
194+
},
195+
"properties": {
196+
"x-ms-client-flatten": true,
197+
"$ref": "#/definitions/BaselineProperties",
198+
"description": "the properties of the baseline."
199+
}
200+
},
201+
"description": "The response to a baseline query."
202+
},
203+
"BaselineProperties": {
204+
"properties": {
205+
"timespan": {
206+
"type": "string",
207+
"description": "The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested."
208+
},
209+
"interval": {
210+
"type": "string",
211+
"format": "duration",
212+
"description": "The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made."
213+
},
214+
"aggregation": {
215+
"type": "string",
216+
"description": "The aggregation type of the metric."
217+
},
218+
"timestamps": {
219+
"type": "array",
220+
"items": {
221+
"type": "string",
222+
"format": "date-time",
223+
"description": "the timestamp for the baseline value in ISO 8601 format."
224+
},
225+
"description": "the array of timestamps of the baselines."
226+
},
227+
"baseline": {
228+
"type": "array",
229+
"items": {
230+
"$ref": "#/definitions/Baseline"
231+
},
232+
"description": "the baseline values for each sensitivity."
233+
},
234+
"metadata": {
235+
"type": "array",
236+
"items": {
237+
"$ref": "#/definitions/BaselineMetadataValue"
238+
},
239+
"description": "the baseline metadata values."
240+
}
241+
},
242+
"description": "The baseline properties class."
243+
},
244+
"Baseline": {
245+
"type": "object",
246+
"properties": {
247+
"sensitivity": {
248+
"type": "string",
249+
"enum": [
250+
"Low",
251+
"Medium",
252+
"High"
253+
],
254+
"x-ms-enum": {
255+
"name": "Sensitivity",
256+
"modelAsString": false
257+
},
258+
"description": "the sensitivity of the baseline."
259+
},
260+
"lowThresholds": {
261+
"type": "array",
262+
"items": {
263+
"type": "number",
264+
"format": "double",
265+
"description": "A single low threshold value."
266+
},
267+
"description": "The low thresholds of the baseline."
268+
},
269+
"highThresholds": {
270+
"type": "array",
271+
"items": {
272+
"type": "number",
273+
"format": "double",
274+
"description": "A single high threshold value."
275+
},
276+
"description": "The high thresholds of the baseline."
277+
}
278+
},
279+
"required": [ "sensitivity", "lowThresholds", "highThresholds" ],
280+
"description": "The baseline values for a single sensitivity value."
281+
}
282+
},
283+
"parameters": {
284+
"ExtendedResourceUriParameter": {
285+
"name": "resourceUri",
286+
"in": "path",
287+
"required": true,
288+
"type": "string",
289+
"description": "The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1",
290+
"x-ms-parameter-location": "method",
291+
"x-ms-skip-url-encoding": true
292+
},
293+
"MetricNameParameter": {
294+
"name": "metricName",
295+
"in": "path",
296+
"required": true,
297+
"type": "string",
298+
"description": "The name of the metric to retrieve the baseline for.",
299+
"x-ms-parameter-location": "method"
300+
},
301+
"TimespanParameter": {
302+
"name": "timespan",
303+
"in": "query",
304+
"required": false,
305+
"type": "string",
306+
"description": "The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.",
307+
"x-ms-parameter-location": "method"
308+
},
309+
"IntervalParameter": {
310+
"name": "interval",
311+
"in": "query",
312+
"required": false,
313+
"type": "string",
314+
"format": "duration",
315+
"description": "The interval (i.e. timegrain) of the query.",
316+
"x-ms-parameter-location": "method"
317+
},
318+
"AggregationParameter": {
319+
"name": "aggregation",
320+
"in": "query",
321+
"required": false,
322+
"type": "string",
323+
"description": "The aggregation type of the metric to retrieve the baseline for.",
324+
"x-ms-parameter-location": "method"
325+
},
326+
"SensitivitiesParameter": {
327+
"name": "sensitivities",
328+
"in": "query",
329+
"required": false,
330+
"type": "string",
331+
"description": "The list of sensitivities (comma separated) to retrieve.",
332+
"x-ms-parameter-location": "method"
333+
},
334+
"BaselineResultTypeParameter": {
335+
"name": "resultType",
336+
"in": "query",
337+
"type": "string",
338+
"enum": [
339+
"Data",
340+
"Metadata"
341+
],
342+
"x-ms-enum": {
343+
"name": "ResultType",
344+
"modelAsString": false
345+
},
346+
"description": "Allows retrieving only metadata of the baseline. On data request all information is retrieved.",
347+
"x-ms-parameter-location": "method",
348+
"required": false
349+
},
350+
"ApiVersionParameter": {
351+
"name": "api-version",
352+
"in": "query",
353+
"required": true,
354+
"type": "string",
355+
"description": "Client Api Version."
356+
}
357+
}
358+
}

0 commit comments

Comments
 (0)