From 3a029c004cd09f8b120de081e4a10510706b3ed3 Mon Sep 17 00:00:00 2001 From: Tomas Cerda Date: Fri, 13 Jan 2023 10:42:29 +0000 Subject: [PATCH 1/3] Reduce Boto3 retrial attempts from 3 to 1 --- codeguru_profiler_agent/codeguru_client_builder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codeguru_profiler_agent/codeguru_client_builder.py b/codeguru_profiler_agent/codeguru_client_builder.py index bb9b767..876b565 100644 --- a/codeguru_profiler_agent/codeguru_client_builder.py +++ b/codeguru_profiler_agent/codeguru_client_builder.py @@ -42,8 +42,11 @@ def _create_codeguru_client(self): region = self._get_region_or_default() # the default retry mode is 'legacy', not 'standard' + # retry at most once to avoid retry storms + # see https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html standard_config = Config( - retries={ + retries = { + 'max_attempts': 1, 'mode': 'standard' } ) From 629adc683849caa5d4210b282b8d83daf1f4f629 Mon Sep 17 00:00:00 2001 From: Tomas Cerda Date: Fri, 13 Jan 2023 11:34:21 +0000 Subject: [PATCH 2/3] Remove Ubuntu when running tests on python 3.6 and fix CPU time test --- .github/workflows/python-package.yml | 8 ++++++-- test/unit/metrics/test_with_timer.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 81ed0c6..7a8afa6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,8 +16,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.6', '3.7', '3.8', '3.9'] - + python-version: ['3.7', '3.8', '3.9'] + include: + - os: macos-latest + python-version: '3.6' + - os: windows-latest + python-version: '3.6' steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/test/unit/metrics/test_with_timer.py b/test/unit/metrics/test_with_timer.py index 29c830e..b25303a 100644 --- a/test/unit/metrics/test_with_timer.py +++ b/test/unit/metrics/test_with_timer.py @@ -15,7 +15,9 @@ def foo_wall(self): @with_timer(metric_name="test-foo-cpu", measurement="cpu-time") def foo_cpu(self): # Run something to make sure the cpu clock does tick (https://bugs.python.org/issue37859) - len(str(2 ** 500_000)) + sum_x = 0 + for i in range(10000000): + sum_x += i return From 84b80664759e24d07832d6e57bb5d9009c024cfc Mon Sep 17 00:00:00 2001 From: Tomas Cerda Date: Fri, 13 Jan 2023 11:34:32 +0000 Subject: [PATCH 3/3] Remove Python 3.6 from released Lambda layers --- release_layer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_layer.py b/release_layer.py index 0d1f336..a7da27c 100755 --- a/release_layer.py +++ b/release_layer.py @@ -8,7 +8,7 @@ # The following values are used in the documentation, so any change of them requires updates to the documentation. LAYER_NAME = 'AWSCodeGuruProfilerPythonAgentLambdaLayer' -SUPPORTED_VERSIONS = ['3.6', '3.7', '3.8', '3.9'] +SUPPORTED_VERSIONS = ['3.7', '3.8', '3.9'] EXEC_SCRIPT_FILE_NAME = 'codeguru_profiler_lambda_exec' # We should release in all the regions that lambda layer is supported, not just the ones CodeGuru Profiler Service supports.