@@ -148,10 +148,9 @@ def test_get_final_attributes(setup, setup_optin):
148
148
"user_agent.original" : f"gcloud-python/{ __version__ } " ,
149
149
"http.request.method" : "GET" ,
150
150
"server.address" : "testOtel.org" ,
151
- "server.port" : None ,
152
151
"url.path" : "/foo/bar/baz" ,
153
152
"url.scheme" : "https" ,
154
- "http.request.timeout " : str ((100 , 100 )),
153
+ "connect_timeout,read_timeout " : str ((100 , 100 )),
155
154
"retry" : f"multiplier{ retry_obj ._multiplier } /deadline{ retry_obj ._deadline } /max{ retry_obj ._maximum } /initial{ retry_obj ._initial } /predicate{ retry_obj ._predicate } " ,
156
155
}
157
156
expected_attributes .update (_opentelemetry_tracing ._cloud_trace_adoption_attrs )
@@ -219,6 +218,20 @@ def test__get_opentelemetry_attributes_from_url():
219
218
assert attrs == expected
220
219
221
220
221
+ def test__get_opentelemetry_attributes_from_url_with_query ():
222
+ url = "https://example.com/path?query=true&another=false"
223
+ expected = {
224
+ "server.address" : "example.com" ,
225
+ "server.port" : None ,
226
+ "url.scheme" : "https" ,
227
+ "url.path" : "/path" ,
228
+ "url.query" : "query=true&another=false" ,
229
+ }
230
+ # Test not stripping query
231
+ attrs = _opentelemetry_tracing ._get_opentelemetry_attributes_from_url (url , strip_query = False )
232
+ assert attrs == expected
233
+
234
+
222
235
def test_set_api_request_attr_with_pii_in_query ():
223
236
client = mock .Mock ()
224
237
client ._connection .build_api_url .return_value = "https://example.com/path?sensitive=true&token=secret"
@@ -230,7 +243,7 @@ def test_set_api_request_attr_with_pii_in_query():
230
243
"server.port" : None ,
231
244
"url.scheme" : "https" ,
232
245
"url.path" : "/path" ,
233
- "http.request.timeout " : "60" ,
246
+ "connect_timeout,read_timeout " : "60" ,
234
247
}
235
248
attr = _opentelemetry_tracing ._set_api_request_attr (request , client )
236
249
assert attr == expected_attributes
@@ -243,4 +256,4 @@ def test_set_api_request_attr_no_timeout():
243
256
244
257
request = {"method" : "GET" , "path" : "/path" }
245
258
attr = _opentelemetry_tracing ._set_api_request_attr (request , client )
246
- assert "http.request.timeout " not in attr
259
+ assert "connect_timeout,read_timeout " not in attr
0 commit comments