|
2 | 2 | # (c) Copyright Instana Inc. 2020
|
3 | 3 |
|
4 | 4 | try:
|
5 |
| - import contextlib |
6 | 5 | from typing import TYPE_CHECKING, Any, Callable, Dict, Sequence, Type
|
7 | 6 |
|
8 | 7 | from instana.span_context import SpanContext
|
@@ -58,21 +57,19 @@ def collect_s3_injected_attributes(
|
58 | 57 | with tracer.start_as_current_span("s3", span_context=parent_context) as span:
|
59 | 58 | try:
|
60 | 59 | span.set_attribute("s3.op", operations[wrapped.__name__])
|
61 |
| - # Suppress key/index errors to all the function to still happen |
62 |
| - with contextlib.suppress(IndexError, KeyError): |
63 |
| - if "Bucket" in kwargs: |
64 |
| - span.set_attribute("s3.bucket", kwargs["Bucket"]) |
65 |
| - elif wrapped.__name__ in ["download_file", "download_fileobj"]: |
66 |
| - span.set_attribute("s3.bucket", args[0]) |
67 |
| - else: |
68 |
| - span.set_attribute("s3.bucket", args[1]) |
69 |
| - return wrapped(*args, **kwargs) |
| 60 | + if "Bucket" in kwargs: |
| 61 | + span.set_attribute("s3.bucket", kwargs["Bucket"]) |
| 62 | + elif wrapped.__name__ in ["download_file", "download_fileobj"]: |
| 63 | + span.set_attribute("s3.bucket", args[0]) |
| 64 | + else: |
| 65 | + span.set_attribute("s3.bucket", args[1]) |
70 | 66 | except Exception as exc:
|
71 | 67 | span.record_exception(exc)
|
72 | 68 | logger.debug(
|
73 | 69 | "collect_s3_injected_attributes: collect error", exc_info=True
|
74 | 70 | )
|
75 |
| - raise exc |
| 71 | + |
| 72 | + return wrapped(*args, **kwargs) |
76 | 73 |
|
77 | 74 | for method in [
|
78 | 75 | "upload_file",
|
|
0 commit comments