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

Monitor metadata bug #21513

Merged
merged 1 commit into from
Nov 3, 2021
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
2 changes: 2 additions & 0 deletions sdk/monitor/azure-monitor-query/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Fixed a bug where Metadata values in timestamp don't show up sometimes.

### Other Changes

## 1.0.0 (2021-10-06)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class TimeSeriesElement(object):
"""
def __init__(self, **kwargs):
# type: (Any) -> None
self.metadata_values = kwargs.get("metadatavalues", None)
self.metadata_values = kwargs.get("metadata_values", None)
self.data = kwargs.get("data", None)

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ async def test_metrics_granularity():
assert response
assert response.granularity == timedelta(minutes=5)

@pytest.mark.live_test_only
@pytest.mark.asyncio
async def test_metrics_filter():
credential = _credential()
client = MetricsQueryClient(credential)
response = await client.query_resource(
os.environ['METRICS_RESOURCE_URI'],
metric_names=["MatchedEventCount"],
timespan=timedelta(days=1),
granularity=timedelta(minutes=5),
filter="EventSubscriptionName eq '*'",
aggregations=[MetricAggregationType.COUNT]
)
assert response
metric = response.metrics['MatchedEventCount']
for t in metric.timeseries:
assert t.metadata_values is not None

@pytest.mark.live_test_only
@pytest.mark.asyncio
Expand Down
17 changes: 17 additions & 0 deletions sdk/monitor/azure-monitor-query/tests/test_metrics_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ def test_metrics_granularity():
assert response
assert response.granularity == timedelta(minutes=5)

@pytest.mark.live_test_only
def test_metrics_filter():
credential = _credential()
client = MetricsQueryClient(credential)
response = client.query_resource(
os.environ['METRICS_RESOURCE_URI'],
metric_names=["MatchedEventCount"],
timespan=timedelta(days=1),
granularity=timedelta(minutes=5),
filter="EventSubscriptionName eq '*'",
aggregations=[MetricAggregationType.COUNT]
)
assert response
metric = response.metrics['MatchedEventCount']
for t in metric.timeseries:
assert t.metadata_values is not None

@pytest.mark.live_test_only
def test_metrics_list():
credential = _credential()
Expand Down