I had the chance to try version 0.9.3 and tested the async tracer functionality.
Unfortunately it threw the exception below. Any ideas?
{
"error": "AlreadyEndedException",
"cause": {
"errorMessage": "Already ended segment and subsegment cannot be modified.",
"errorType": "AlreadyEndedException",
"stackTrace": [
" File \"/opt/python/aws_lambda_powertools/tracing/tracer.py\", line 266, in decorate\n response = lambda_handler(event, context)\n",
" File \"/opt/python/aws_lambda_powertools/logging/logger.py\", line 442, in decorate\n return lambda_handler(event, context)\n",
" File \"/var/task/loadSegmentChunk/lambda_function.py\", line 231, in lambda_handler\n run(main(event, context))\n",
" File \"/var/lang/lib/python3.8/asyncio/runners.py\", line 43, in run\n return loop.run_until_complete(main)\n",
" File \"/var/lang/lib/python3.8/asyncio/base_events.py\", line 616, in run_until_complete\n return future.result()\n",
" File \"/var/task/loadSegmentChunk/lambda_function.py\", line 201, in main\n await s3_to_dynamo(event, context, shard_index, s3obj, table)\n",
" File \"/var/task/loadSegmentChunk/lambda_function.py\", line 150, in s3_to_dynamo\n await gather(*(dynamoBatchWrite(batch, table, segmentId) for batch in limitBatchArr))\n",
" File \"/var/task/loadSegmentChunk/lambda_function.py\", line 50, in dynamoBatchWrite\n await batch_writer.put_item(\n",
" File \"/opt/python/aioboto3/dynamodb/table.py\", line 67, in put_item\n await self._add_request_and_process({'PutRequest': {'Item': Item}})\n",
" File \"/opt/python/aioboto3/dynamodb/table.py\", line 76, in _add_request_and_process\n await self._flush_if_needed()\n",
" File \"/opt/python/aioboto3/dynamodb/table.py\", line 94, in _flush_if_needed\n await self._flush()\n",
" File \"/opt/python/aioboto3/dynamodb/table.py\", line 99, in _flush\n response = await self._client.batch_write_item(RequestItems={self._table_name: items_to_send})\n",
" File \"/opt/python/aws_xray_sdk/ext/aiobotocore/patch.py\", line 32, in _xray_traced_aiobotocore\n result = await xray_recorder.record_subsegment_async(\n",
" File \"/opt/python/aws_xray_sdk/core/async_recorder.py\", line 93, in record_subsegment_async\n meta_processor(\n",
" File \"/opt/python/aws_xray_sdk/ext/boto_utils.py\", line 56, in aws_meta_processor\n subsegment.put_http_meta(http.STATUS,\n",
" File \"/opt/python/aws_xray_sdk/core/models/entity.py\", line 102, in put_http_meta\n self._check_ended()\n",
" File \"/opt/python/aws_xray_sdk/core/models/entity.py\", line 283, in _check_ended\n raise AlreadyEndedException(\"Already ended segment and subsegment cannot be modified.\")\n"
]
}
}