Skip to content

Commit 495bade

Browse files
committed
Bumped version to 0.1.1
Signed-off-by: chandr-andr (Kiselev Aleksandr) <[email protected]>
1 parent 86543ee commit 495bade

File tree

5 files changed

+49
-95
lines changed

5 files changed

+49
-95
lines changed

otlp_psqlpy/__init__.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
import psqlpy
55
import wrapt # type: ignore[import-untyped]
6-
76
from opentelemetry import trace
8-
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor # type: ignore[attr-defined]
7+
from opentelemetry.instrumentation.instrumentor import (
8+
BaseInstrumentor, # type: ignore[attr-defined]
9+
)
910
from opentelemetry.instrumentation.utils import unwrap
1011
from opentelemetry.semconv.trace import (
1112
DbSystemValues,
@@ -14,10 +15,10 @@
1415
)
1516
from opentelemetry.trace import SpanKind
1617
from opentelemetry.trace.status import Status, StatusCode
18+
1719
from otlp_psqlpy.package import _instruments
1820
from otlp_psqlpy.version import __version__
1921

20-
2122
CONNECTION_METHODS = [
2223
"execute",
2324
"execute_batch",
@@ -51,7 +52,12 @@
5152
]
5253

5354

54-
def _construct_span(instance, query, parameters, prepared=None) -> dict:
55+
def _construct_span(
56+
instance: psqlpy.Connection | psqlpy.Transaction | psqlpy.Cursor,
57+
query: str,
58+
parameters: t.Sequence[t.Any],
59+
prepared: bool | None = None,
60+
) -> dict[str, t.Any]:
5561
"""Get network and database attributes from instance."""
5662
span_attributes = {
5763
SpanAttributes.DB_SYSTEM: DbSystemValues.POSTGRESQL.value,
@@ -108,17 +114,19 @@ def _retrieve_parameter_from_args_or_kwargs(
108114

109115

110116
class PSQLPyPGInstrumentor(BaseInstrumentor):
117+
"""Instrumentor for PSQLPy."""
118+
111119
_leading_comment_remover = re.compile(r"^/\*.*?\*/")
112120
_tracer = None
113121

114-
def __init__(self, capture_parameters=False):
122+
def __init__(self, capture_parameters: bool = False) -> None:
115123
super().__init__()
116124
self.capture_parameters = capture_parameters
117125

118-
def instrumentation_dependencies(self) -> t.Collection[str]:
126+
def instrumentation_dependencies(self) -> t.Collection[str]: # noqa: D102
119127
return _instruments
120128

121-
def _instrument(self, **kwargs):
129+
def _instrument(self, **kwargs: t.Any) -> None:
122130
tracer_provider = kwargs.get("tracer_provider")
123131
self._tracer = trace.get_tracer(
124132
__name__,
@@ -148,7 +156,7 @@ def _instrument(self, **kwargs):
148156
self._do_cursor_execute,
149157
)
150158

151-
def _uninstrument(self, **__):
159+
def _uninstrument(self, **__: t.Any) -> None:
152160
for cls, methods in [
153161
(
154162
psqlpy.Connection,

otlp_psqlpy/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
_instruments = ("psqlpy >= 0.9.0",)
15+
_instruments = ("psqlpy >= 0.9.1",)

otlp_psqlpy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.0.1dev"
15+
__version__ = "0.1.1"

poetry.lock

Lines changed: 29 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)