Skip to content
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
507ae4d
SDK generated autorest
Yashikaj14 Jun 6, 2022
9b6061c
upload function added
Yashikaj14 Jun 6, 2022
74eb518
patch.py changed
Yashikaj14 Jun 8, 2022
2d8eafd
upload updated
Yashikaj14 Jun 8, 2022
33c26d6
whl file removed
Yashikaj14 Jun 9, 2022
a91c728
whls deleted
Yashikaj14 Jun 9, 2022
9af9160
aio updated
Yashikaj14 Jun 9, 2022
081fd12
spell check added
Yashikaj14 Jun 9, 2022
fb9cb76
spell check
Yashikaj14 Jun 11, 2022
11d1531
Update shared_requirements.txt
msyyc Jun 13, 2022
2be648f
Merge branch 'main' into loadtestservice
msyyc Jun 13, 2022
1d98c14
Update MANIFEST.in
Yashikaj14 Jun 13, 2022
6881429
Update setup.py
Yashikaj14 Jun 13, 2022
b42ef95
spell added
Yashikaj14 Jun 13, 2022
3dea6da
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 13, 2022
0d1dbf3
patch.py updated
Yashikaj14 Jun 13, 2022
07abc8e
linting corrected
Yashikaj14 Jun 14, 2022
e43a9fb
Update allowed_pylint_failures.py
msyyc Jun 14, 2022
4e2c523
readme updated
Yashikaj14 Jun 14, 2022
5e87691
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 14, 2022
7a6a769
patch.py updation
Yashikaj14 Jun 14, 2022
10fe0aa
Update _patch.py
Yashikaj14 Jun 15, 2022
5ac02da
tests added
Yashikaj14 Jun 15, 2022
806badd
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 15, 2022
3e3b655
async naming
Yashikaj14 Jun 15, 2022
015cf2e
test and result
BigCat20196 Jun 15, 2022
1204f67
fix
BigCat20196 Jun 15, 2022
8e27ba7
push the test result
BigCat20196 Jun 15, 2022
d577901
fix
Yashikaj14 Jun 15, 2022
5e08cc1
readme updated
Yashikaj14 Jun 15, 2022
df3e5b1
fix
Yashikaj14 Jun 15, 2022
b95aa58
tests added and async built
Yashikaj14 Jun 15, 2022
ed84eb0
yaml added
Yashikaj14 Jun 15, 2022
5959144
yaml updated
Yashikaj14 Jun 15, 2022
8703e03
sample and readme updated
Yashikaj14 Jun 16, 2022
0b6b1a5
fix ci.yml
Yashikaj14 Jun 16, 2022
592718d
Merge branch 'main' into loadtestservice
msyyc Jun 20, 2022
deb0b9c
more tests and samples addded and readme updated
Yashikaj14 Jun 20, 2022
6c6110e
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 20, 2022
2028ca3
tests
Yashikaj14 Jun 21, 2022
742cc82
fix
Yashikaj14 Jun 21, 2022
62eb9f1
fix2
Yashikaj14 Jun 21, 2022
ea5e975
type added
Yashikaj14 Jun 28, 2022
3edb300
type added
Yashikaj14 Jun 28, 2022
e8b0cff
Update CHANGELOG.md
msyyc Jul 5, 2022
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
6 changes: 6 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@
"undoc"
]
},
{
"filename": "sdk/loadtestservice/azure-analytics-loadtestservice/azure/analytics/loadtestservice/**",
"words":[
"vusers"
]
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark

{
"filename": "sdk/ml/azure-ai-ml/**",
"words": [
Expand Down
3 changes: 2 additions & 1 deletion eng/tox/allowed_pylint_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"azure-messaging-nspkg",
"azure-agrifood-farming",
"azure-ai-language-questionanswering",
"azure-ai-language-conversations"
"azure-ai-language-conversations",
"azure-analytics-loadtestservice"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Release History

## 1.0.0b1 (2022-06-07)

- Initial version

21 changes: 21 additions & 0 deletions sdk/loadtestservice/azure-analytics-loadtestservice/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include *.md
include azure/__init__.py
include azure/analytics/__init__.py
include LICENSE
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/analytics/loadtestservice/py.typed
115 changes: 115 additions & 0 deletions sdk/loadtestservice/azure-analytics-loadtestservice/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Azure Analytics LoadTestService client library for Python
Azure Analytics LoadTestService provides client library in python to the user by which they can interact natively with Load Test Service.The service is for performing the load test to optimize application performance, scalability or capacity. The user can get the client-side and server-side metrices to see the details reported by the test engine and information about your Azure application components.

## _Disclaimer_

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

## Getting started

### Installating the package

```bash
python -m pip install azure-analytics-loadtestservice
```

#### Prequisites

- Python 3.6 or later is required to use this package.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're dropping support for 3.6, so we can require 3.7 and up in the readme and in the setup.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

- You need an [Azure subscription][azure_sub] to use this package.
- An existing Azure Analytics LoadTestService instance.

#### Create with an Azure Active Directory Credential
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
provide an instance of the desired credential type obtained from the
[azure-identity][azure_identity_credentials] library.

To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip]

After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`

Use the returned token credential to authenticate the client:

```python
>>> from azure.analytics.loadtestservice import LoadTestClient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally we have our readme examples as runnable code, this is a transcription of using the code in the python shell. For example, it's usually like

from azure.analytics.loadtestservice import LoadTestClient
from azure.identity import DefaultAzureCredential
...

That way users can copy paste into their own code editor and run the code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

>>> from azure.identity import DefaultAzureCredential
>>> client = LoadTestClient(endpoint='<endpoint>', credential=DefaultAzureCredential())
```

## Examples

```python
>>> from azure.analytics.loadtestservice import LoadTestClient
>>> from azure.identity import DefaultAzureCredential
>>> from azure.core.exceptions import HttpResponseError

>>> client = LoadTestClient(endpoint='<endpoint>', credential=DefaultAzureCredential())
>>> try:
result = client.test.list_load_test_search()
print(result)
except HttpResponseError as e:
print('service responds error: {}'.format(e.response.json()))
```

## Key concepts
The following components make up the Azure Load Testing Service. The Azure Load Test client library for Python allows you to interact with each of these components through the use of a dedicated client object.

### Load testing resource
The Load testing resource is the top-level resource for your load-testing activities. This resource provides a centralized place to view and manage load tests, test results, and related artifacts. A load testing resource contains zero or more load tests.

### Test
A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource.

### Test Engine
A test engine is computing infrastructure that runs the Apache JMeter test script. You can scale out your load test by configuring the number of test engines. The test script runs in parallel across the specified number of test engines.

### Test Run
A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test.

### App Component
When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard.

### Metrics
During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics:

1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second.

2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption.

## Troubleshooting
More about it is coming soon...

## Next steps

More examples are coming soon...

## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
additional questions or comments.

<!-- LINKS -->
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
[azure_identity_pip]: https://pypi.org/project/azure-identity/
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
[pip]: https://pypi.org/project/pip/
[azure_sub]: https://azure.microsoft.com/free/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import LoadTestClient
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['LoadTestClient']
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core import PipelineClient
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import LoadTestClientConfiguration
from .operations import AppComponentOperations, ServerMetricsOperations, TestOperations, TestRunOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Dict

from azure.core.credentials import TokenCredential

class LoadTestClient: # pylint: disable=client-accepts-api-version-keyword
"""These APIs allow end users to create, view and run load tests using Azure Load Test Service.

:ivar app_component: AppComponentOperations operations
:vartype app_component: azure.analytics.loadtestservice.operations.AppComponentOperations
:ivar server_metrics: ServerMetricsOperations operations
:vartype server_metrics: azure.analytics.loadtestservice.operations.ServerMetricsOperations
:ivar test: TestOperations operations
:vartype test: azure.analytics.loadtestservice.operations.TestOperations
:ivar test_run: TestRunOperations operations
:vartype test_run: azure.analytics.loadtestservice.operations.TestRunOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword endpoint: Service URL. Default value is "https://<dataPlaneURL>".
:paramtype endpoint: str
:keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
*,
endpoint: str = "https://<dataPlaneURL>",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look like a valid url, I don't think we should default to this value. I'm thinking endpoint should be required since this default value seems invalid

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

**kwargs: Any
) -> None:

self._config = LoadTestClientConfiguration(credential=credential, **kwargs)
self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.app_component = AppComponentOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.server_metrics = ServerMetricsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.test = TestOperations( # type: ignore # pylint: disable=abstract-class-instantiated
self._client, self._config, self._serialize, self._deserialize
)
self.test_run = TestRunOperations(
self._client, self._config, self._serialize, self._deserialize
)


def send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> LoadTestClient
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class LoadTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for LoadTestClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
**kwargs: Any
) -> None:
super(LoadTestClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.credential = credential
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://loadtest.azure-dev.com/.default'])
kwargs.setdefault('sdk_moniker', 'analytics-loadtestservice/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Loading