Skip to content

Commit beb0462

Browse files
committed
Log transport send exceptions
1 parent be4ab84 commit beb0462

File tree

2 files changed

+139
-1
lines changed

2 files changed

+139
-1
lines changed

opamp/opentelemetry-opamp-client/src/opentelemetry/_opamp/transport/requests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from __future__ import annotations
1616

17+
import logging
1718
from typing import Mapping
1819

1920
import requests
@@ -22,6 +23,8 @@
2223
from opentelemetry._opamp.transport.base import HttpTransport, base_headers
2324
from opentelemetry._opamp.transport.exceptions import OpAMPException
2425

26+
logger = logging.getLogger(__name__)
27+
2528

2629
class RequestsTransport(HttpTransport):
2730
def __init__(self, session: requests.Session | None = None):
@@ -41,7 +44,8 @@ def send(
4144
url, headers=headers, data=data, timeout=timeout
4245
)
4346
response.raise_for_status()
44-
except Exception:
47+
except Exception as exc:
48+
logger.error(str(exc))
4549
raise OpAMPException
4650

4751
message = messages.decode_message(response.content)
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
interactions:
2+
- request:
3+
body: !!binary |
4+
ChABl89ktxVxE7d60nbzJJzzGj0KFQoMc2VydmljZS5uYW1lEgUKA2ZvbwokChtkZXBsb3ltZW50
5+
LmVudmlyb25tZW50Lm5hbWUSBQoDZm9vIINg
6+
headers:
7+
Accept:
8+
- '*/*'
9+
Accept-Encoding:
10+
- gzip, deflate
11+
Connection:
12+
- keep-alive
13+
Content-Length:
14+
- '84'
15+
Content-Type:
16+
- application/x-protobuf
17+
User-Agent:
18+
- OTel-OpAMP-Python/0.0.1
19+
method: POST
20+
uri: http://localhost:4320/v1/opamp
21+
response:
22+
body:
23+
string: !!binary |
24+
ChABl89ktxVxE7d60nbzJJzzGmYKOgo4CgdlbGFzdGljEi0KGXsibG9nZ2luZ19sZXZlbCI6ImRl
25+
YnVnIn0SEGFwcGxpY2F0aW9uL2pzb24SKGY3MzA5M2VjZDEyNjkzZGMxNDUxYWQ2MjdlZDA2MWJl
26+
ZWM5ZjU1OWM4AlIA
27+
headers:
28+
Content-Length:
29+
- '126'
30+
Content-Type:
31+
- application/x-protobuf
32+
Date:
33+
- Thu, 03 Jul 2025 08:26:13 GMT
34+
status:
35+
code: 200
36+
message: OK
37+
- request:
38+
body: !!binary |
39+
ChABl89ktxVxE7d60nbzJJzzEAEgg2A6LAooZjczMDkzZWNkMTI2OTNkYzE0NTFhZDYyN2VkMDYx
40+
YmVlYzlmNTU5YxAB
41+
headers:
42+
Accept:
43+
- '*/*'
44+
Accept-Encoding:
45+
- gzip, deflate
46+
Connection:
47+
- keep-alive
48+
Content-Length:
49+
- '69'
50+
Content-Type:
51+
- application/x-protobuf
52+
User-Agent:
53+
- OTel-OpAMP-Python/0.0.1
54+
method: POST
55+
uri: http://localhost:4320/v1/opamp
56+
response:
57+
body:
58+
string: !!binary |
59+
ChABl89ktxVxE7d60nbzJJzzOAJSAA==
60+
headers:
61+
Content-Length:
62+
- '22'
63+
Content-Type:
64+
- application/x-protobuf
65+
Date:
66+
- Thu, 03 Jul 2025 08:26:13 GMT
67+
status:
68+
code: 200
69+
message: OK
70+
- request:
71+
body: !!binary |
72+
ChABl89ktxVxE7d60nbzJJzzEAIgg2A=
73+
headers:
74+
Accept:
75+
- '*/*'
76+
Accept-Encoding:
77+
- gzip, deflate
78+
Connection:
79+
- keep-alive
80+
Content-Length:
81+
- '23'
82+
Content-Type:
83+
- application/x-protobuf
84+
User-Agent:
85+
- OTel-OpAMP-Python/0.0.1
86+
method: POST
87+
uri: http://localhost:4320/v1/opamp
88+
response:
89+
body:
90+
string: !!binary |
91+
ChABl89ktxVxE7d60nbzJJzzOAJSAA==
92+
headers:
93+
Content-Length:
94+
- '22'
95+
Content-Type:
96+
- application/x-protobuf
97+
Date:
98+
- Thu, 03 Jul 2025 08:26:14 GMT
99+
status:
100+
code: 200
101+
message: OK
102+
- request:
103+
body: !!binary |
104+
ChABl89ktxVxE7d60nbzJJzzEAMgg2BKAA==
105+
headers:
106+
Accept:
107+
- '*/*'
108+
Accept-Encoding:
109+
- gzip, deflate
110+
Connection:
111+
- keep-alive
112+
Content-Length:
113+
- '25'
114+
Content-Type:
115+
- application/x-protobuf
116+
User-Agent:
117+
- OTel-OpAMP-Python/0.0.1
118+
method: POST
119+
uri: http://localhost:4320/v1/opamp
120+
response:
121+
body:
122+
string: !!binary |
123+
ChABl89ktxVxE7d60nbzJJzzOAJSAA==
124+
headers:
125+
Content-Length:
126+
- '22'
127+
Content-Type:
128+
- application/x-protobuf
129+
Date:
130+
- Thu, 03 Jul 2025 08:26:15 GMT
131+
status:
132+
code: 200
133+
message: OK
134+
version: 1

0 commit comments

Comments
 (0)