24
24
from opentelemetry import trace
25
25
from opentelemetry.instrumentation.aiopg import trace_integration
26
26
27
- trace_integration(aiopg.connection, "_connect", "postgresql", "sql" )
27
+ trace_integration(aiopg.connection, "_connect", "postgresql")
28
28
29
29
API
30
30
---
48
48
49
49
50
50
def trace_integration (
51
- database_component : str ,
52
- database_type : str = "" ,
51
+ database_system : str ,
53
52
connection_attributes : typing .Dict = None ,
54
53
tracer_provider : typing .Optional [TracerProvider ] = None ,
55
54
):
56
55
"""Integrate with aiopg library.
57
56
based on dbapi integration, where replaced sync wrap methods to async
58
57
59
58
Args:
60
- database_component: Database driver name or
61
- database name "postgreSQL".
62
- database_type: The Database type. For any SQL database, "sql".
59
+ database_system: An identifier for the database management system (DBMS)
60
+ product being used.
63
61
connection_attributes: Attribute names for database, port, host and
64
62
user in Connection object.
65
63
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
66
- use. If ommited the current configured one is used.
64
+ use. If omitted the current configured one is used.
67
65
"""
68
66
69
67
wrap_connect (
70
68
__name__ ,
71
- database_component ,
72
- database_type ,
69
+ database_system ,
73
70
connection_attributes ,
74
71
__version__ ,
75
72
tracer_provider ,
@@ -78,8 +75,7 @@ def trace_integration(
78
75
79
76
def wrap_connect (
80
77
name : str ,
81
- database_component : str ,
82
- database_type : str = "" ,
78
+ database_system : str ,
83
79
connection_attributes : typing .Dict = None ,
84
80
version : str = "" ,
85
81
tracer_provider : typing .Optional [TracerProvider ] = None ,
@@ -89,14 +85,13 @@ def wrap_connect(
89
85
90
86
Args:
91
87
name: Name of opentelemetry extension for aiopg.
92
- database_component: Database driver name
93
- or database name "postgreSQL".
94
- database_type: The Database type. For any SQL database, "sql".
88
+ database_system: An identifier for the database management system (DBMS)
89
+ product being used.
95
90
connection_attributes: Attribute names for database, port, host and
96
91
user in Connection object.
97
92
version: Version of opentelemetry extension for aiopg.
98
93
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
99
- use. If ommited the current configured one is used.
94
+ use. If omitted the current configured one is used.
100
95
"""
101
96
102
97
# pylint: disable=unused-argument
@@ -108,8 +103,7 @@ def wrap_connect_(
108
103
):
109
104
db_integration = AiopgIntegration (
110
105
name ,
111
- database_component ,
112
- database_type = database_type ,
106
+ database_system ,
113
107
connection_attributes = connection_attributes ,
114
108
version = version ,
115
109
tracer_provider = tracer_provider ,
@@ -135,8 +129,7 @@ def unwrap_connect():
135
129
def instrument_connection (
136
130
name : str ,
137
131
connection ,
138
- database_component : str ,
139
- database_type : str = "" ,
132
+ database_system : str ,
140
133
connection_attributes : typing .Dict = None ,
141
134
version : str = "" ,
142
135
tracer_provider : typing .Optional [TracerProvider ] = None ,
@@ -146,21 +139,20 @@ def instrument_connection(
146
139
Args:
147
140
name: Name of opentelemetry extension for aiopg.
148
141
connection: The connection to instrument.
149
- database_component: Database driver name or database name "postgreSQL".
150
- database_type: The Database type. For any SQL database, "sql" .
142
+ database_system: An identifier for the database management system (DBMS)
143
+ product being used .
151
144
connection_attributes: Attribute names for database, port, host and
152
145
user in a connection object.
153
146
version: Version of opentelemetry extension for aiopg.
154
147
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
155
- use. If ommited the current configured one is used.
148
+ use. If omitted the current configured one is used.
156
149
157
150
Returns:
158
151
An instrumented connection.
159
152
"""
160
153
db_integration = AiopgIntegration (
161
154
name ,
162
- database_component ,
163
- database_type ,
155
+ database_system ,
164
156
connection_attributes = connection_attributes ,
165
157
version = version ,
166
158
tracer_provider = tracer_provider ,
@@ -187,8 +179,7 @@ def uninstrument_connection(connection):
187
179
188
180
def wrap_create_pool (
189
181
name : str ,
190
- database_component : str ,
191
- database_type : str = "" ,
182
+ database_system : str ,
192
183
connection_attributes : typing .Dict = None ,
193
184
version : str = "" ,
194
185
tracer_provider : typing .Optional [TracerProvider ] = None ,
@@ -202,8 +193,7 @@ def wrap_create_pool_(
202
193
):
203
194
db_integration = AiopgIntegration (
204
195
name ,
205
- database_component ,
206
- database_type ,
196
+ database_system ,
207
197
connection_attributes = connection_attributes ,
208
198
version = version ,
209
199
tracer_provider = tracer_provider ,
0 commit comments