diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.cfg b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.cfg index 25e774c247fb..8d31ad031ad6 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.cfg +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.cfg @@ -39,13 +39,13 @@ package_dir= =src packages=find_namespace: install_requires = - opentelemetry-api == 0.15.dev0 - opentelemetry-instrumentation == 0.15.dev0 + opentelemetry-api == 0.15b0 + opentelemetry-instrumentation == 0.15b0 asyncpg >= 0.12.0 [options.extras_require] test = - opentelemetry-test == 0.15.dev0 + opentelemetry-test == 0.15b0 [options.packages.find] where = src diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py index 6af816b39dff..2f4ecaf3af62 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py @@ -43,21 +43,11 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.utils import unwrap from opentelemetry.trace import SpanKind -from opentelemetry.trace.status import Status, StatusCanonicalCode +from opentelemetry.trace.status import Status, StatusCode _APPLIED = "_opentelemetry_tracer" -def _exception_to_canonical_code(exc: Exception) -> StatusCanonicalCode: - if isinstance( - exc, (exceptions.InterfaceError, exceptions.SyntaxOrAccessError), - ): - return StatusCanonicalCode.INVALID_ARGUMENT - if isinstance(exc, exceptions.IdleInTransactionSessionTimeoutError): - return StatusCanonicalCode.DEADLINE_EXCEEDED - return StatusCanonicalCode.UNKNOWN - - def _hydrate_span_from_args(connection, query, parameters) -> dict: span_attributes = {"db.type": "sql"} @@ -134,12 +124,7 @@ async def _do_execute(self, func, instance, args, kwargs): exception = exc raise finally: - if span.is_recording(): - if exception is not None: - span.set_status( - Status(_exception_to_canonical_code(exception)) - ) - else: - span.set_status(Status(StatusCanonicalCode.OK)) + if span.is_recording() and exception is not None: + span.set_status(Status(StatusCode.ERROR)) return result diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py index e7b342d644e0..ff494d225aa4 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.15.dev0" +__version__ = "0.15b0"