diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py
index 546fde0b44a8..f0204b02fc8d 100644
--- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py
+++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py
@@ -892,6 +892,11 @@ class Metrics(GenMetrics):
:keyword str version:
The version of Storage Analytics to configure. The default value is 1.0.
+ :keyword bool enabled:
+ Indicates whether metrics are enabled for the Datalake service.
+ The default value is `False`.
+ :keyword bool include_apis:
+ Indicates whether metrics should generate summary statistics for called API operations.
:keyword ~azure.storage.filedatalake.RetentionPolicy retention_policy:
Determines how long the associated data should persist. If not specified the retention
policy will be disabled by default.
@@ -899,8 +904,8 @@ class Metrics(GenMetrics):
def __init__(self, **kwargs):
self.version = kwargs.get('version', u'1.0')
- self.enabled = False
- self.include_apis = None
+ self.enabled = kwargs.get('enabled', False)
+ self.include_apis = kwargs.get('include_apis')
self.retention_policy = kwargs.get('retention_policy') or RetentionPolicy()
@classmethod
diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_hour_metrics.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_hour_metrics.yaml
index 24562d6fab45..8a3aaef8a699 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_hour_metrics.yaml
+++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_hour_metrics.yaml
@@ -2,42 +2,42 @@ interactions:
- request:
body: '
- 1.0falsetrue5'
+ 1.0truetruetrue5'
headers:
Accept:
- - '*/*'
+ - application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- - '237'
+ - '267'
Content-Type:
- - application/xml; charset=utf-8
+ - application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 0365c238-3b16-11eb-80ed-c8348e5fffbf
+ - 7675879d-9bea-11eb-9017-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 18:32:09 GMT
+ - Mon, 12 Apr 2021 23:54:47 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: PUT
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
string: ''
headers:
+ Content-Length:
+ - '0'
Date:
- - Thu, 10 Dec 2020 18:32:14 GMT
+ - Mon, 12 Apr 2021 23:54:47 GMT
Server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
- Transfer-Encoding:
- - chunked
x-ms-request-id:
- - 2b0ba4e1-101e-0021-4922-cf58fa000000
+ - e5c9e03f-801e-0055-5cf7-2f5d2b000000
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
status:
code: 202
message: Accepted
@@ -51,34 +51,32 @@ interactions:
Connection:
- keep-alive
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 05700bc2-3b16-11eb-bfa8-c8348e5fffbf
+ - 76e307d5-9bea-11eb-9616-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 18:32:13 GMT
+ - Mon, 12 Apr 2021 23:54:48 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: GET
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
- string: "\uFEFF1.0truetruetruetrue51.0falsetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true365falsetrueindex.htmlerrors/error/404error.html2014-02-14"
+ string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue51.0falsefalsetrue5falsefalse2014-02-14"
headers:
Content-Type:
- application/xml
Date:
- - Thu, 10 Dec 2020 18:32:14 GMT
+ - Mon, 12 Apr 2021 23:54:47 GMT
Server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding:
- chunked
- Vary:
- - Origin
x-ms-request-id:
- - 2b0ba4ef-101e-0021-4a22-cf58fa000000
+ - e5c9e0ab-801e-0055-14f7-2f5d2b000000
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
status:
code: 200
message: OK
diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_minute_metrics.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_minute_metrics.yaml
index 962f4e96e8b4..7d4ec434b6d4 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_minute_metrics.yaml
+++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client.test_set_minute_metrics.yaml
@@ -2,42 +2,42 @@ interactions:
- request:
body: '
- 1.0falsetrue5'
+ 1.0truetruetrue5'
headers:
Accept:
- - '*/*'
+ - application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- - '241'
+ - '271'
Content-Type:
- - application/xml; charset=utf-8
+ - application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 09246b04-3b16-11eb-866f-c8348e5fffbf
+ - 9317b341-9bea-11eb-a813-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 18:32:19 GMT
+ - Mon, 12 Apr 2021 23:55:35 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: PUT
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
string: ''
headers:
+ Content-Length:
+ - '0'
Date:
- - Thu, 10 Dec 2020 18:32:23 GMT
+ - Mon, 12 Apr 2021 23:55:35 GMT
Server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
- Transfer-Encoding:
- - chunked
x-ms-request-id:
- - 0975cd25-301e-0026-5622-cf3499000000
+ - 626fe6f9-301e-007f-0ef7-2f823b000000
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
status:
code: 202
message: Accepted
@@ -51,34 +51,32 @@ interactions:
Connection:
- keep-alive
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 0acacb9d-3b16-11eb-9417-c8348e5fffbf
+ - 937a9045-9bea-11eb-8deb-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 18:32:22 GMT
+ - Mon, 12 Apr 2021 23:55:36 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: GET
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
- string: "\uFEFF1.0truetruetruetrue51.0falsetrue51.0falsetrue5GETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true365falsetrueindex.htmlerrors/error/404error.html2014-02-14"
+ string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue51.0truetruetrue5true5falsefalse2014-02-14"
headers:
Content-Type:
- application/xml
Date:
- - Thu, 10 Dec 2020 18:32:23 GMT
+ - Mon, 12 Apr 2021 23:55:35 GMT
Server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding:
- chunked
- Vary:
- - Origin
x-ms-request-id:
- - 0975cd30-301e-0026-5722-cf3499000000
+ - 626fe723-301e-007f-2ef7-2f823b000000
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
status:
code: 200
message: OK
diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_hour_metrics.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_hour_metrics.yaml
index 60af7cbe262d..8dea1faa9409 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_hour_metrics.yaml
+++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_hour_metrics.yaml
@@ -2,64 +2,65 @@ interactions:
- request:
body: '
- 1.0falsetrue5'
+ 1.0truetruetrue5'
headers:
+ Accept:
+ - application/xml
Content-Length:
- - '237'
+ - '267'
Content-Type:
- - application/xml; charset=utf-8
+ - application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 5bf31ccc-3b29-11eb-92f1-c8348e5fffbf
+ - d182be6d-9bea-11eb-8465-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 20:50:38 GMT
+ - Mon, 12 Apr 2021 23:57:20 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: PUT
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
string: ''
headers:
- Date: Thu, 10 Dec 2020 20:50:39 GMT
+ Content-Length: '0'
+ Date: Mon, 12 Apr 2021 23:57:19 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
- Transfer-Encoding: chunked
- x-ms-request-id: db63c688-f01e-0029-6f36-cf42f5000000
- x-ms-version: '2020-04-08'
+ x-ms-request-id: 40d35052-701e-006e-50f7-2f188f000000
+ x-ms-version: '2020-06-12'
status:
code: 202
message: Accepted
- url: https://storagename.blob.core.windows.net/?restype=service&comp=properties
+ url: https://seannsecanary.blob.core.windows.net/?restype=service&comp=properties
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 5c60002b-3b29-11eb-b37d-c8348e5fffbf
+ - d1c4844a-9bea-11eb-be81-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 20:50:39 GMT
+ - Mon, 12 Apr 2021 23:57:20 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: GET
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
- string: "\uFEFF1.0truetruetruetrue51.0falsetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true365falsetrueindex.htmlerrors/error/404error.html2014-02-14"
+ string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue51.0truetruetrue5true5falsefalse2014-02-14"
headers:
Content-Type: application/xml
- Date: Thu, 10 Dec 2020 20:50:39 GMT
+ Date: Mon, 12 Apr 2021 23:57:19 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding: chunked
- Vary: Origin
- x-ms-request-id: db63c692-f01e-0029-7036-cf42f5000000
- x-ms-version: '2020-04-08'
+ x-ms-request-id: 40d350ad-701e-006e-03f7-2f188f000000
+ x-ms-version: '2020-06-12'
status:
code: 200
message: OK
- url: https://storagename.blob.core.windows.net/?restype=service&comp=properties
+ url: https://seannsecanary.blob.core.windows.net/?restype=service&comp=properties
version: 1
diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_minute_metrics.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_minute_metrics.yaml
index 191dc1a05f7c..2a6875525392 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_minute_metrics.yaml
+++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_datalake_service_client_async.test_set_minute_metrics.yaml
@@ -2,64 +2,65 @@ interactions:
- request:
body: '
- 1.0falsetrue5'
+ 1.0truetruetrue5'
headers:
+ Accept:
+ - application/xml
Content-Length:
- - '241'
+ - '271'
Content-Type:
- - application/xml; charset=utf-8
+ - application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 5fcc219d-3b29-11eb-af1a-c8348e5fffbf
+ - d49b9a00-9bea-11eb-a75f-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 20:50:45 GMT
+ - Mon, 12 Apr 2021 23:57:25 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: PUT
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
string: ''
headers:
- Date: Thu, 10 Dec 2020 20:50:47 GMT
+ Content-Length: '0'
+ Date: Mon, 12 Apr 2021 23:57:24 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
- Transfer-Encoding: chunked
- x-ms-request-id: 89f3b107-101e-001e-0a36-cf9059000000
- x-ms-version: '2020-04-08'
+ x-ms-request-id: e94c6acf-d01e-0083-73f7-2f53c2000000
+ x-ms-version: '2020-06-12'
status:
code: 202
message: Accepted
- url: https://storagename.blob.core.windows.net/?restype=service&comp=properties
+ url: https://seannsecanary.blob.core.windows.net/?restype=service&comp=properties
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- - azsdk-python-storage-blob/12.6.1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-storage-blob/12.8.1b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-client-request-id:
- - 61bdbb7c-3b29-11eb-b710-c8348e5fffbf
+ - d4d6805a-9bea-11eb-a347-c8348e5fffbf
x-ms-date:
- - Thu, 10 Dec 2020 20:50:48 GMT
+ - Mon, 12 Apr 2021 23:57:26 GMT
x-ms-version:
- - '2020-04-08'
+ - '2020-06-12'
method: GET
uri: https://storagename.blob.core.windows.net/?restype=service&comp=properties
response:
body:
- string: "\uFEFF1.0truetruetruetrue51.0falsetrue51.0falsetrue5GETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500true365falsetrueindex.htmlerrors/error/404error.html2014-02-14"
+ string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue51.0truetruetrue5true5falsefalse2014-02-14"
headers:
Content-Type: application/xml
- Date: Thu, 10 Dec 2020 20:50:48 GMT
+ Date: Mon, 12 Apr 2021 23:57:24 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Transfer-Encoding: chunked
- Vary: Origin
- x-ms-request-id: 89f3b115-101e-001e-0b36-cf9059000000
- x-ms-version: '2020-04-08'
+ x-ms-request-id: e94c6af5-d01e-0083-10f7-2f53c2000000
+ x-ms-version: '2020-06-12'
status:
code: 200
message: OK
- url: https://storagename.blob.core.windows.net/?restype=service&comp=properties
+ url: https://seannsecanary.blob.core.windows.net/?restype=service&comp=properties
version: 1
diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py
index 349132d475d8..32e1f00ba6a8 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py
+++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py
@@ -263,7 +263,7 @@ def test_set_logging(self):
@record
def test_set_hour_metrics(self):
- hour_metrics = Metrics(retention_policy=RetentionPolicy(enabled=True, days=5))
+ hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5))
# Act
self.dsc.set_service_properties(hour_metrics=hour_metrics)
@@ -274,7 +274,8 @@ def test_set_hour_metrics(self):
@record
def test_set_minute_metrics(self):
- minute_metrics = Metrics(retention_policy=RetentionPolicy(enabled=True, days=5))
+ minute_metrics = Metrics(enabled=True, include_apis=True,
+ retention_policy=RetentionPolicy(enabled=True, days=5))
# Act
self.dsc.set_service_properties(minute_metrics=minute_metrics)
diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py
index c0c9163ad17d..ed9b9c2c8e3b 100644
--- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py
+++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py
@@ -300,7 +300,7 @@ def test_set_logging(self):
loop.run_until_complete(self._test_set_logging())
async def _test_set_hour_metrics(self):
- hour_metrics = Metrics(retention_policy=RetentionPolicy(enabled=True, days=5))
+ hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5))
# Act
await self.dsc.set_service_properties(hour_metrics=hour_metrics)
@@ -315,7 +315,8 @@ def test_set_hour_metrics(self):
loop.run_until_complete(self._test_set_hour_metrics())
async def _test_set_minute_metrics(self):
- minute_metrics = Metrics(retention_policy=RetentionPolicy(enabled=True, days=5))
+ minute_metrics = Metrics(
+ enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5))
# Act
await self.dsc.set_service_properties(minute_metrics=minute_metrics)