Skip to content

Commit 6df039e

Browse files
committed
Track S3Transfer usage
1 parent 29c5597 commit 6df039e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

boto3/s3/inject.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
import copy as python_copy
14+
from functools import partial
1415

16+
from botocore.context import with_current_context
1517
from botocore.exceptions import ClientError
18+
from botocore.useragent import register_feature_id
1619

1720
from boto3 import utils
1821
from boto3.s3.transfer import (
@@ -104,6 +107,7 @@ def object_summary_load(self, *args, **kwargs):
104107
self.meta.data = response
105108

106109

110+
@with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
107111
def upload_file(
108112
self, Filename, Bucket, Key, ExtraArgs=None, Callback=None, Config=None
109113
):
@@ -151,6 +155,7 @@ def upload_file(
151155
)
152156

153157

158+
@with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
154159
def download_file(
155160
self, Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None
156161
):
@@ -368,6 +373,7 @@ def object_download_file(
368373
)
369374

370375

376+
@with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
371377
def copy(
372378
self,
373379
CopySource,
@@ -579,6 +585,7 @@ def object_copy(
579585
)
580586

581587

588+
@with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
582589
def upload_fileobj(
583590
self, Fileobj, Bucket, Key, ExtraArgs=None, Callback=None, Config=None
584591
):
@@ -738,6 +745,7 @@ def object_upload_fileobj(
738745
)
739746

740747

748+
@with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
741749
def download_fileobj(
742750
self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None
743751
):

0 commit comments

Comments
 (0)