Skip to content

Commit d3d7f0d

Browse files
committed
Monitor live test fix (Azure#23144)
* Fix live pipeline * changelog * Remove py2 support * fix build
1 parent 9e50422 commit d3d7f0d

File tree

12 files changed

+33
-60
lines changed

12 files changed

+33
-60
lines changed

sdk/monitor/azure-mgmt-monitor/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
install_requires=[
6969
'msrest>=0.6.21',
7070
'azure-common~=1.1',
71-
'azure-mgmt-core>=1.2.0,<2.0.0',
71+
'azure-mgmt-core>=1.3.0,<2.0.0',
7272
],
7373
python_requires=">=3.6",
7474
)

sdk/monitor/azure-monitor-query/CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
## 1.0.2 (Unreleased)
44

5-
### Features Added
6-
7-
### Breaking Changes
5+
- This version and all future versions will require Python 3.7+. Python 2.7 and 3.6 are no longer supported.
86

97
### Bugs Fixed
108

11-
### Other Changes
9+
- Fixed a bug where having a None value in datetime throws
1210

1311
## 1.0.1 (2021-11-09)
1412

sdk/monitor/azure-monitor-query/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ The Azure Monitor Query client library is used to execute read-only queries agai
1616

1717
## _Disclaimer_
1818

19-
_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
19+
_Azure SDK Python packages support for Python 2.7 has ended on 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
2020

2121
## Getting started
2222

2323
### Prerequisites
2424

25-
- Python 2.7, or 3.6 or later
25+
- Python 3.6 or later
2626
- An [Azure subscription][azure_subscription]
2727
- To query Logs, you need an [Azure Log Analytics workspace][azure_monitor_create_using_portal].
2828
- To query Metrics, you need an Azure resource of any kind (Storage Account, Key Vault, Cosmos DB, etc.).

sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ def construct_iso8601(timespan=None):
116116

117117
def native_col_type(col_type, value):
118118
if col_type == "datetime":
119-
value = Deserializer.deserialize_iso(value)
119+
try:
120+
value = Deserializer.deserialize_iso(value)
121+
except: # pylint: disable=bare-except
122+
# if there is any exception in deserializing the iso,
123+
# return the value to the user
124+
pass
120125
elif col_type in ("timespan", "guid"):
121126
value = str(value)
122127
return value

sdk/monitor/azure-monitor-query/dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
-e ../../core/azure-core
44
-e ../../identity/azure-identity
55
azure-mgmt-loganalytics
6-
aiohttp>=3.0; python_version >= '3.5'
6+
aiohttp>=3.0

sdk/monitor/azure-monitor-query/samples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ The following code samples show common scenarios with the Azure Monitor Query cl
3131

3232
## _Disclaimer_
3333

34-
_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_.
34+
_Azure SDK Python packages support for Python 2.7 has ended on 01 January 2022. For more information and questions, refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_.
3535

3636
## Prerequisites
3737

38-
- Python 2.7, or 3.6 or later
38+
- Python 3.6 or later
3939
- An [Azure subscription][azure_subscription]
4040
- To query Logs, you need an [Azure Log Analytics workspace][azure_monitor_create_using_portal].
4141
- To query Metrics, you need an Azure resource of any kind (Storage Account, Key Vault, Cosmos DB, etc.).

sdk/monitor/azure-monitor-query/setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

sdk/monitor/azure-monitor-query/setup.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@
6363
classifiers=[
6464
"Development Status :: 5 - Production/Stable",
6565
'Programming Language :: Python',
66-
'Programming Language :: Python :: 2',
67-
'Programming Language :: Python :: 2.7',
68-
'Programming Language :: Python :: 3',
66+
'Programming Language :: Python :: 3 :: Only',
6967
'Programming Language :: Python :: 3.6',
7068
'Programming Language :: Python :: 3.7',
7169
'Programming Language :: Python :: 3.8',
7270
'Programming Language :: Python :: 3.9',
7371
'Programming Language :: Python :: 3.10',
7472
'License :: OSI Approved :: MIT License',
7573
],
74+
python_requires=">=3.6",
7675
zip_safe=False,
7776
packages=find_packages(exclude=[
7877
'tests',
@@ -84,8 +83,5 @@
8483
install_requires=[
8584
'msrest>=0.6.19',
8685
'azure-core<2.0.0,>=1.12.0',
87-
],
88-
extras_require={
89-
":python_version<'3.0'": ['azure-monitor-nspkg'],
90-
}
86+
]
9187
)

sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async def test_logs_query_batch_additional_workspaces():
159159
async def test_logs_single_query_with_render():
160160
credential = _credential()
161161
client = LogsQueryClient(credential)
162-
query = """AppRequests"""
162+
query = """AppRequests | take 10"""
163163

164164
# returns LogsQueryResult
165165
response = await client.query_workspace(os.environ['LOG_WORKSPACE_ID'], query, timespan=None, include_visualization=True)
@@ -171,7 +171,7 @@ async def test_logs_single_query_with_render():
171171
async def test_logs_single_query_with_render_and_stats():
172172
credential = _credential()
173173
client = LogsQueryClient(credential)
174-
query = """AppRequests"""
174+
query = """AppRequests | take 10"""
175175

176176
# returns LogsQueryResult
177177
response = await client.query_workspace(os.environ['LOG_WORKSPACE_ID'], query, timespan=None, include_visualization=True, include_statistics=True)
@@ -184,7 +184,7 @@ async def test_logs_single_query_with_render_and_stats():
184184
async def test_logs_query_result_iterate_over_tables():
185185
client = LogsQueryClient(_credential())
186186

187-
query = "AppRequests; AppRequests | take 5"
187+
query = "AppRequests | take 10; AppRequests | take 5"
188188

189189
response = await client.query_workspace(
190190
os.environ['LOG_WORKSPACE_ID'],

sdk/monitor/azure-monitor-query/tests/conftest.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)