Skip to content
Merged

Snake #19084

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: 1 addition & 1 deletion sdk/monitor/azure-monitor-query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ credential = ClientSecretCredential(
)

client = MetricsClient(credential)
response = client.query(os.environ['METRICS_RESOURCE_URI'], metricnames=["Microsoft.CognitiveServices/accounts"])
response = client.query(os.environ['METRICS_RESOURCE_URI'], metric_names=["Microsoft.CognitiveServices/accounts"])
```

## Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def __init__(self, credential, **kwargs):
self._namespace_op = self._client.metric_namespaces
self._definitions_op = self._client.metric_definitions

def query(self, resource_uri, metricnames, **kwargs):
def query(self, resource_uri, metric_names, **kwargs):
# type: (str, list, Any) -> MetricsResult
"""Lists the metric values for a resource.

:param resource_uri: The identifier of the resource.
:type resource_uri: str
:param metricnames: The names of the metrics to retrieve.
:type metricnames: list
:param metric_names: The names of the metrics to retrieve.
:type metric_names: list
:keyword timespan: The timespan of the query. It is a string with the following format
'startDateTime_ISO/endDateTime_ISO'.
:paramtype timespan: str
Expand Down Expand Up @@ -77,13 +77,13 @@ def query(self, resource_uri, metricnames, **kwargs):
:keyword result_type: Reduces the set of data collected. The syntax allowed depends on the
operation. See the operation's description for details.
:paramtype result_type: str or ~monitor_query_client.models.ResultType
:keyword metricnamespace: Metric namespace to query metric definitions for.
:paramtype metricnamespace: str
:keyword metric_namespace: Metric namespace to query metric definitions for.
:paramtype metric_namespace: str
:return: Response, or the result of cls(response)
:rtype: ~azure.monitor.query.MetricsResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs.setdefault("metricnames", ",".join(metricnames))
kwargs.setdefault("metric_names", ",".join(metric_names))
generated = self._metrics_op.list(resource_uri, connection_verify=False, **kwargs)
return MetricsResult._from_generated(generated) # pylint: disable=protected-access

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
self._namespace_op = self._client.metric_namespaces
self._definitions_op = self._client.metric_definitions

async def query(self, resource_uri: str, metricnames: List, **kwargs: Any) -> MetricsResult:
async def query(self, resource_uri: str, metric_names: List, **kwargs: Any) -> MetricsResult:
"""Lists the metric values for a resource.

:param resource_uri: The identifier of the resource.
:type resource_uri: str
:param metricnames: The names of the metrics to retrieve.
:type metricnames: list
:param metric_names: The names of the metrics to retrieve.
:type metric_names: list
:keyword timespan: The timespan of the query. It is a string with the following format
'startDateTime_ISO/endDateTime_ISO'.
:paramtype timespan: str
Expand Down Expand Up @@ -73,13 +73,13 @@ async def query(self, resource_uri: str, metricnames: List, **kwargs: Any) -> Me
:keyword result_type: Reduces the set of data collected. The syntax allowed depends on the
operation. See the operation's description for details.
:paramtype result_type: str or ~monitor_query_client.models.ResultType
:keyword metricnamespace: Metric namespace to query metric definitions for.
:paramtype metricnamespace: str
:keyword metric_namespace: Metric namespace to query metric definitions for.
:paramtype metric_namespace: str
:return: Response, or the result of cls(response)
:rtype: ~azure.monitor.query.MetricsResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs.setdefault("metricnames", ",".join(metricnames))
kwargs.setdefault("metric_names", ",".join(metric_names))
generated = await self._metrics_op.list(resource_uri, connection_verify=False, **kwargs)
return MetricsResult._from_generated(generated) # pylint: disable=protected-access

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
metrics_uri = os.environ['METRICS_RESOURCE_URI']
response = client.query(
metrics_uri,
metricnames=["PublishSuccessCount"],
metric_names=["PublishSuccessCount"],
timespan='P2D'
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_metrics_auth():
credential = _credential()
client = MetricsClient(credential)
# returns LogsQueryResults
response = client.query(os.environ['METRICS_RESOURCE_URI'], metricnames=["PublishSuccessCount"], timespan='P2D')
response = client.query(os.environ['METRICS_RESOURCE_URI'], metric_names=["PublishSuccessCount"], timespan='P2D')

assert response is not None
assert response.metrics is not None
Expand Down
13 changes: 1 addition & 12 deletions sdk/monitor/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@ stages:
parameters:
ServiceDirectory: monitor
TestTimeoutInMinutes: 300
BuildTargetingString: azure-monitor-opentelemetry-exporter
EnvVars:
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_TEST_RUN_LIVE: 'true'
- template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
ServiceDirectory: monitor
TestTimeoutInMinutes: 300
BuildTargetingString: azure-monitor-query
BuildTargetingString: azure-monitor-*
EnvVars:
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
Expand Down