diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 72c20cd6d018..68001099c9d2 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -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 diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py index 0a3745e1db93..f3c3b4c718b6 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py @@ -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 @@ -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 diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py index e1d1e44e16dc..11407a90a8b0 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py @@ -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 @@ -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 diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py index 0246556d7e23..e0eed23fabe9 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py @@ -19,7 +19,7 @@ metrics_uri = os.environ['METRICS_RESOURCE_URI'] response = client.query( metrics_uri, - metricnames=["PublishSuccessCount"], + metric_names=["PublishSuccessCount"], timespan='P2D' ) diff --git a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py index d0e06c822663..ee84c7ab1711 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py @@ -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 diff --git a/sdk/monitor/tests.yml b/sdk/monitor/tests.yml index c7fd14b50116..b4e25640e0f7 100644 --- a/sdk/monitor/tests.yml +++ b/sdk/monitor/tests.yml @@ -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)