Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metricsadvisor] live tests setup #14396

Merged
merged 4 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ def __init__(self, method_name):
self.http_request_post_url = self.get_settings_value("METRICS_ADVISOR_HTTP_POST_URL")
self.application_insights_api_key = self.get_settings_value("METRICS_ADVISOR_APPLICATION_INSIGHTS_API_KEY")
self.azure_data_explorer_connection_string = self.get_settings_value("METRICS_ADVISOR_AZURE_DATA_EXPLORER_CONNECTION_STRING")
self.influxdb_connection_string = self.get_settings_value("METRICS_ADVISOR_INFLUXDB_CONNECTION_STRING")
self.influxdb_password = self.get_settings_value("METRICS_ADVISOR_INFLUXDB_PASSWORD")
self.influxdb_connection_string = self.get_settings_value("METRICS_ADVISOR_INFLUX_DB_CONNECTION_STRING")
self.influxdb_password = self.get_settings_value("METRICS_ADVISOR_INFLUX_DB_PASSWORD")
self.azure_datalake_account_key = self.get_settings_value("METRICS_ADVISOR_AZURE_DATALAKE_ACCOUNT_KEY")
self.mongodb_connection_string = self.get_settings_value("METRICS_ADVISOR_AZURE_MONGODB_CONNECTION_STRING")
self.mongodb_connection_string = self.get_settings_value("METRICS_ADVISOR_AZURE_MONGO_DB_CONNECTION_STRING")
self.mysql_connection_string = self.get_settings_value("METRICS_ADVISOR_MYSQL_CONNECTION_STRING")
self.postgresql_connection_string = self.get_settings_value("METRICS_ADVISOR_POSTGRESQL_CONNECTION_STRING")
self.elasticsearch_auth_header = self.get_settings_value("METRICS_ADVISOR_ELASTICSEARCH_AUTH")
self.anomaly_detection_configuration_id = self.get_settings_value("ANOMALY_DETECTION_CONFIGURATION_ID")
self.elasticsearch_auth_header = self.get_settings_value("METRICS_ADVISOR_ELASTICSEARCH_AUTH_HEADER")
self.anomaly_detection_configuration_id = self.get_settings_value("METRICS_ADVISOR_ANOMALY_DETECTION_CONFIGURATION_ID")
self.data_feed_id = self.get_settings_value("METRICS_ADVISOR_DATA_FEED_ID")
self.metric_id = self.get_settings_value("METRICS_ADVISOR_METRIC_ID")
self.scrubber.register_name_pair(
Expand Down Expand Up @@ -428,13 +428,13 @@ def __init__(self, method_name):
service_endpoint = self.get_settings_value("METRICS_ADVISOR_ENDPOINT")
subscription_key = self.get_settings_value("METRICS_ADVISOR_SUBSCRIPTION_KEY")
api_key = self.get_settings_value("METRICS_ADVISOR_API_KEY")
self.anomaly_detection_configuration_id = self.get_settings_value("ANOMALY_DETECTION_CONFIGURATION_ID")
self.anomaly_alert_configuration_id = self.get_settings_value("ANOMALY_ALERT_CONFIGURATION_ID")
self.metric_id = self.get_settings_value("METRIC_ID")
self.incident_id = self.get_settings_value("INCIDENT_ID")
self.dimension_name = self.get_settings_value("DIMENSION_NAME")
self.feedback_id = self.get_settings_value("FEEDBACK_ID")
self.alert_id = self.get_settings_value("ALERT_ID")
self.anomaly_detection_configuration_id = self.get_settings_value("METRICS_ADVISOR_ANOMALY_DETECTION_CONFIGURATION_ID")
self.anomaly_alert_configuration_id = self.get_settings_value("METRICS_ADVISOR_ANOMALY_ALERT_CONFIGURATION_ID")
self.metric_id = self.get_settings_value("METRICS_ADVISOR_METRIC_ID")
self.incident_id = self.get_settings_value("METRICS_ADVISOR_INCIDENT_ID")
self.dimension_name = self.get_settings_value("METRICS_ADVISOR_DIMENSION_NAME")
self.feedback_id = self.get_settings_value("METRICS_ADVISOR_FEEDBACK_ID")
self.alert_id = self.get_settings_value("METRICS_ADVISOR_ALERT_ID")
self.scrubber.register_name_pair(
self.anomaly_detection_configuration_id,
"anomaly_detection_configuration_id"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
interactions:
- request:
body: '{"startTime": "2020-01-01T00:00:00.000Z", "endTime": "2020-09-09T00:00:00.000Z",
"series": [{"dimension": {"city": "city"}}]}'
"series": [{"dimension": {"dimension_name": "Common Lime"}}]}'
headers:
Accept:
- application/json
Content-Length:
- '125'
- '132'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-metricsadvisor/1.0.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-ai-metricsadvisor/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/anomaly_detection_configuration_id/series/query
response:
body:
string: '{"value":[{"series":{"dimension":{"city":"city"}},"timestampList":[],"valueList":[],"isAnomalyList":[],"periodList":[],"expectedValueList":[],"lowerBoundaryList":[],"upperBoundaryList":[]}]}'
string: '{"value":[{"series":{"dimension":{"dimension_name":"Common Lime"}},"timestampList":[],"valueList":[],"isAnomalyList":[],"periodList":[],"expectedValueList":[],"lowerBoundaryList":[],"upperBoundaryList":[]}]}'
headers:
apim-request-id: e38d671d-e46f-45cd-a755-02054d4bab34
content-length: '190'
apim-request-id: a6634fbd-31a3-4db2-b7b2-934f2fa4a127
content-length: '197'
content-type: application/json; charset=utf-8
date: Mon, 21 Sep 2020 16:55:13 GMT
date: Mon, 12 Oct 2020 19:26:30 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
x-envoy-upstream-service-time: '379'
x-request-id: e38d671d-e46f-45cd-a755-02054d4bab34
x-envoy-upstream-service-time: '5701'
x-request-id: a6634fbd-31a3-4db2-b7b2-934f2fa4a127
status:
code: 200
message: OK
url: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/c0f2539f-b804-4ab9-a70f-0da0c89c76d8/series/query
url: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com//metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/c0f2539f-b804-4ab9-a70f-0da0c89c76d8/series/query
version: 1
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
interactions:
- request:
body: '{"startTime": "2020-01-01T00:00:00.000Z", "endTime": "2020-09-09T00:00:00.000Z",
"series": [{"city": "Mumbai", "category": "Shoes Handbags & Sunglasses"}]}'
"series": [{"dimension_name": "Common Lime", "Dim2": "African buffalo"}]}'
headers:
Accept:
- application/json
Content-Length:
- '155'
- '144'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-metricsadvisor/1.0.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-ai-metricsadvisor/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/metrics/metric_id/data/query
response:
body:
string: '{"value":[{"id":{"metricId":"metric_id","dimension":{"city":"Mumbai","category":"Shoes
Handbags & Sunglasses"}},"timestampList":[],"valueList":[]}]}'
string: '{"value":[{"id":{"metricId":"metric_id","dimension":{"dimension_name":"Common
Lime","Dim2":"African buffalo"}},"timestampList":["2020-01-01T00:00:00Z","2020-01-02T00:00:00Z","2020-01-03T00:00:00Z","2020-01-04T00:00:00Z","2020-01-05T00:00:00Z","2020-01-06T00:00:00Z","2020-01-07T00:00:00Z","2020-01-08T00:00:00Z","2020-01-09T00:00:00Z","2020-01-10T00:00:00Z","2020-01-11T00:00:00Z","2020-01-12T00:00:00Z","2020-01-13T00:00:00Z","2020-01-14T00:00:00Z","2020-01-15T00:00:00Z","2020-01-16T00:00:00Z","2020-01-17T00:00:00Z","2020-01-18T00:00:00Z","2020-01-19T00:00:00Z","2020-01-20T00:00:00Z","2020-01-21T00:00:00Z","2020-01-22T00:00:00Z","2020-01-23T00:00:00Z","2020-01-24T00:00:00Z","2020-01-25T00:00:00Z","2020-01-26T00:00:00Z","2020-01-27T00:00:00Z","2020-01-28T00:00:00Z","2020-01-29T00:00:00Z","2020-01-30T00:00:00Z","2020-01-31T00:00:00Z","2020-02-01T00:00:00Z","2020-02-02T00:00:00Z","2020-02-03T00:00:00Z","2020-02-04T00:00:00Z","2020-02-05T00:00:00Z","2020-02-06T00:00:00Z","2020-02-07T00:00:00Z","2020-02-08T00:00:00Z","2020-02-09T00:00:00Z","2020-02-10T00:00:00Z","2020-02-11T00:00:00Z","2020-02-12T00:00:00Z","2020-02-13T00:00:00Z","2020-02-14T00:00:00Z","2020-02-15T00:00:00Z","2020-02-16T00:00:00Z","2020-02-17T00:00:00Z","2020-02-18T00:00:00Z","2020-02-19T00:00:00Z","2020-02-20T00:00:00Z","2020-02-21T00:00:00Z","2020-02-22T00:00:00Z","2020-02-23T00:00:00Z","2020-02-24T00:00:00Z","2020-02-25T00:00:00Z","2020-02-26T00:00:00Z","2020-02-27T00:00:00Z","2020-02-28T00:00:00Z","2020-02-29T00:00:00Z","2020-03-01T00:00:00Z","2020-03-02T00:00:00Z","2020-03-03T00:00:00Z","2020-03-04T00:00:00Z","2020-03-05T00:00:00Z","2020-03-06T00:00:00Z","2020-03-07T00:00:00Z","2020-03-08T00:00:00Z","2020-03-09T00:00:00Z","2020-03-10T00:00:00Z","2020-03-11T00:00:00Z","2020-03-12T00:00:00Z","2020-03-13T00:00:00Z","2020-03-14T00:00:00Z","2020-03-15T00:00:00Z","2020-03-16T00:00:00Z","2020-03-17T00:00:00Z","2020-03-18T00:00:00Z","2020-03-19T00:00:00Z","2020-03-20T00:00:00Z","2020-03-21T00:00:00Z","2020-03-22T00:00:00Z","2020-03-23T00:00:00Z","2020-03-24T00:00:00Z","2020-03-26T00:00:00Z","2020-03-27T00:00:00Z","2020-03-28T00:00:00Z","2020-03-29T00:00:00Z","2020-03-30T00:00:00Z","2020-03-31T00:00:00Z","2020-04-01T00:00:00Z","2020-04-02T00:00:00Z","2020-04-03T00:00:00Z","2020-04-04T00:00:00Z","2020-04-05T00:00:00Z","2020-04-06T00:00:00Z","2020-04-07T00:00:00Z","2020-04-08T00:00:00Z","2020-04-09T00:00:00Z","2020-04-10T00:00:00Z","2020-04-11T00:00:00Z","2020-04-12T00:00:00Z","2020-04-13T00:00:00Z","2020-04-14T00:00:00Z","2020-04-15T00:00:00Z","2020-04-16T00:00:00Z","2020-04-17T00:00:00Z","2020-04-18T00:00:00Z","2020-04-19T00:00:00Z","2020-04-20T00:00:00Z","2020-04-21T00:00:00Z","2020-04-22T00:00:00Z","2020-04-23T00:00:00Z","2020-04-24T00:00:00Z","2020-04-25T00:00:00Z","2020-04-26T00:00:00Z","2020-04-27T00:00:00Z","2020-04-28T00:00:00Z","2020-04-29T00:00:00Z","2020-04-30T00:00:00Z","2020-05-01T00:00:00Z","2020-05-02T00:00:00Z","2020-05-03T00:00:00Z","2020-05-04T00:00:00Z","2020-05-05T00:00:00Z","2020-05-06T00:00:00Z","2020-05-07T00:00:00Z","2020-05-08T00:00:00Z","2020-05-09T00:00:00Z","2020-05-10T00:00:00Z","2020-05-11T00:00:00Z","2020-05-12T00:00:00Z","2020-05-13T00:00:00Z","2020-05-14T00:00:00Z","2020-05-15T00:00:00Z","2020-05-16T00:00:00Z","2020-05-17T00:00:00Z","2020-05-18T00:00:00Z","2020-05-19T00:00:00Z","2020-05-20T00:00:00Z","2020-05-21T00:00:00Z","2020-05-22T00:00:00Z","2020-05-23T00:00:00Z","2020-05-24T00:00:00Z","2020-05-25T00:00:00Z","2020-05-26T00:00:00Z","2020-05-27T00:00:00Z","2020-05-28T00:00:00Z","2020-05-29T00:00:00Z","2020-05-30T00:00:00Z","2020-05-31T00:00:00Z","2020-06-01T00:00:00Z","2020-06-02T00:00:00Z","2020-06-03T00:00:00Z","2020-06-04T00:00:00Z","2020-06-05T00:00:00Z","2020-06-06T00:00:00Z","2020-06-07T00:00:00Z","2020-06-08T00:00:00Z","2020-06-09T00:00:00Z","2020-06-10T00:00:00Z","2020-06-11T00:00:00Z","2020-06-12T00:00:00Z","2020-06-13T00:00:00Z","2020-06-14T00:00:00Z","2020-06-15T00:00:00Z","2020-06-16T00:00:00Z","2020-06-17T00:00:00Z","2020-06-18T00:00:00Z","2020-06-19T00:00:00Z","2020-06-20T00:00:00Z","2020-06-21T00:00:00Z","2020-06-22T00:00:00Z","2020-06-23T00:00:00Z","2020-06-24T00:00:00Z","2020-06-25T00:00:00Z","2020-06-26T00:00:00Z","2020-06-27T00:00:00Z","2020-06-28T00:00:00Z","2020-06-29T00:00:00Z","2020-06-30T00:00:00Z","2020-07-01T00:00:00Z","2020-07-02T00:00:00Z","2020-07-03T00:00:00Z","2020-07-04T00:00:00Z","2020-07-05T00:00:00Z","2020-07-06T00:00:00Z","2020-07-07T00:00:00Z","2020-07-08T00:00:00Z","2020-07-09T00:00:00Z","2020-07-10T00:00:00Z","2020-07-11T00:00:00Z","2020-07-12T00:00:00Z","2020-07-13T00:00:00Z","2020-07-14T00:00:00Z","2020-07-15T00:00:00Z","2020-07-16T00:00:00Z","2020-07-17T00:00:00Z","2020-07-18T00:00:00Z","2020-07-19T00:00:00Z","2020-07-20T00:00:00Z","2020-07-21T00:00:00Z","2020-07-22T00:00:00Z","2020-07-23T00:00:00Z","2020-07-24T00:00:00Z","2020-07-25T00:00:00Z","2020-07-26T00:00:00Z","2020-07-28T00:00:00Z","2020-07-29T00:00:00Z","2020-07-30T00:00:00Z","2020-07-31T00:00:00Z","2020-08-01T00:00:00Z","2020-08-02T00:00:00Z","2020-08-03T00:00:00Z","2020-08-04T00:00:00Z","2020-08-05T00:00:00Z","2020-08-06T00:00:00Z","2020-08-07T00:00:00Z","2020-08-08T00:00:00Z","2020-08-09T00:00:00Z","2020-08-10T00:00:00Z","2020-08-11T00:00:00Z","2020-08-12T00:00:00Z","2020-08-13T00:00:00Z","2020-08-14T00:00:00Z","2020-08-15T00:00:00Z","2020-08-16T00:00:00Z","2020-08-17T00:00:00Z","2020-08-18T00:00:00Z","2020-08-19T00:00:00Z","2020-08-20T00:00:00Z","2020-08-21T00:00:00Z","2020-08-22T00:00:00Z","2020-08-23T00:00:00Z","2020-08-24T00:00:00Z","2020-08-25T00:00:00Z","2020-08-26T00:00:00Z","2020-08-27T00:00:00Z","2020-08-28T00:00:00Z","2020-08-29T00:00:00Z","2020-08-30T00:00:00Z","2020-08-31T00:00:00Z","2020-09-01T00:00:00Z","2020-09-02T00:00:00Z","2020-09-03T00:00:00Z","2020-09-04T00:00:00Z","2020-09-05T00:00:00Z","2020-09-06T00:00:00Z","2020-09-07T00:00:00Z","2020-09-08T00:00:00Z"],"valueList":[7854850.800000001,11851700.0,11284033.0,9402787.200000001,9478130.0,14726500.600000001,16313667.200000001,15318459.8,15704612.8,14138480.8,9565602.200000001,10473989.600000001,15341320.8,15731336.8,15977300.0,16195569.600000001,14259638.600000001,9610269.0,10373597.600000001,16009645.0,15317262.8,16282958.200000001,15910257.4,13633258.200000001,9512735.0,10650016.200000001,16320904.200000001,16184360.600000001,15444507.4,15153126.8,13929597.600000001,9196932.200000001,10311248.4,16239479.200000001,15557522.0,15747650.8,14025890.8,12542470.8,8919166.8,10933434.600000001,15147589.0,15293700.200000001,15714501.200000001,15020104.4,12291352.8,9646224.200000001,10035271.6,14147478.4,13696033.600000001,14264729.0,14965573.600000001,13129416.8,9217183.6,9976889.4,15302997.200000001,15277996.200000001,14831796.600000001,15884461.200000001,13753535.8,9714499.4,9913345.4,15754560.600000001,14926305.4,15380605.0,15441719.600000001,13679689.8,9108651.6,9689024.4,16250223.600000001,15457939.8,15431406.8,16016256.8,13374326.200000001,9554079.6,10007615.4,16322626.8,16918545.8,16437928.0,16900578.0,14866695.4,10092403.0,10569827.0,20898025.0,20860358.400000002,19595481.0,16765411.0,10932949.8,12312259.600000001,19595135.8,17490434.6,18341139.0,19246726.6,17228383.6,11288914.8,10857898.8,16741690.4,15487843.4,15309001.600000001,14572264.200000001,10675005.0,9937299.4,10677299.4,12320819.200000001,15472227.0,15887236.4,15634259.600000001,15071490.4,12184452.600000001,11410264.8,18611939.2,18900609.8,17973650.400000002,18115690.6,15743904.4,10895736.4,11118896.8,19481619.2,20217109.0,19874497.6,20249933.0,19140980.2,12534667.600000001,13178879.0,20035173.400000002,20459106.0,19607923.400000002,19040986.400000002,12894159.200000001,11512563.600000001,12889099.0,20255684.6,21143846.200000003,19408511.0,18813865.8,17616761.8,11994004.600000001,11763333.0,18478424.8,17803044.8,17695425.8,18191694.400000002,17529708.400000002,12188561.600000001,10779704.4,11148547.8,15109668.8,15281866.8,14601456.4,14463524.4,10327891.600000001,10889339.8,17417491.6,16884522.8,19740214.8,19605459.400000002,17485772.8,12034595.600000001,12351505.200000001,18642203.0,18140215.400000002,19904796.6,20266572.6,17652276.400000002,10769635.200000001,11391018.0,19210187.0,18373197.400000002,19113857.0,19472034.6,17320471.6,11290738.4,11572349.4,17919376.2,16919929.2,17328292.400000002,15879806.200000001,15447272.600000001,11692120.200000001,12082901.0,17925372.2,18508991.6,17327061.8,17918057.2,17023012.400000002,11408163.4,11509009.600000001,17390291.8,17105059.400000002,17857243.400000002,16910108.2,14251733.0,9868058.200000001,10095415.600000001,16437912.0,16088477.0,16329950.0,15289834.0,13389251.200000001,9835769.200000001,10338422.8,15295568.200000001,14883422.4,14586111.200000001,14800721.4,13025176.600000001,10454889.200000001,10507729.600000001,14593264.8,13967648.0,38292884.6,11884509.4,9134974.6,9633951.0,13988339.0,14273325.4,13407748.0,12959531.200000001,11605750.8,8266370.800000001,9377140.6,13773464.0,13803502.600000001,13442921.0,13933631.0,12665234.8,9541988.200000001,10255369.200000001,14368218.200000001,13860647.0,13907949.0,13018104.4,12609829.600000001,9237317.4,10042807.200000001,13923284.4,14434924.8,13736635.0,13640096.200000001,12188965.0,8978845.8,9034608.0,10411126.0,13956154.200000001,14289103.200000001,14393151.4,13125172.200000001,9359021.200000001,9878885.4,14689277.200000001,14303029.600000001]}]}'
headers:
apim-request-id: 6f6023a8-9b7d-4c1c-8bab-490028dc0bb8
content-length: '175'
apim-request-id: 51765e6e-bb9b-49bc-8b9d-2ac5ce910aa3
content-length: '9353'
content-type: application/json; charset=utf-8
date: Mon, 21 Sep 2020 16:55:14 GMT
date: Mon, 12 Oct 2020 19:28:17 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
x-envoy-upstream-service-time: '434'
x-request-id: 6f6023a8-9b7d-4c1c-8bab-490028dc0bb8
x-envoy-upstream-service-time: '861'
x-request-id: 51765e6e-bb9b-49bc-8b9d-2ac5ce910aa3
status:
code: 200
message: OK
url: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/metrics/3d48ed3e-6e6e-4391-b78f-b00dfee1e6f5/data/query
url: https://anuchan-cg-metric-advisor.cognitiveservices.azure.com//metricsadvisor/v1.0/metrics/3d48ed3e-6e6e-4391-b78f-b00dfee1e6f5/data/query
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def test_list_incident_root_cause(self):
@TestMetricsAdvisorClientBaseAsync.await_prepared_test
async def test_list_metric_enriched_series_data(self):
async with self.client:
series_identity = {"city":"city"}
series_identity = {"Dim1": "Common Lime"}
results = self.client.list_metric_enriched_series_data(
detection_configuration_id=self.anomaly_detection_configuration_id,
start_time=datetime.datetime(2020, 1, 1),
Expand Down Expand Up @@ -135,7 +135,7 @@ async def test_list_metrics_series_data(self):
start_time=datetime.datetime(2020, 1, 1),
end_time=datetime.datetime(2020, 9, 9),
series_to_filter=[
{"city": "Mumbai", "category": "Shoes Handbags & Sunglasses"}
{"Dim1": "Common Lime", "Dim2": "African buffalo"}
]
)
tolist = []
Expand Down
Loading