-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TLS support after tracing feature #1370
Conversation
pynipap/pynipap.py
Outdated
from tracing import TracingXMLTransport, TracingXMLSafeTransport | ||
if p.scheme == "http": | ||
xml_transport = TracingXMLTransport | ||
elif p.scheme == "https": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiple spaces before operator
current_span.set_attribute("net.peer.port", connection.port) | ||
current_span.set_attribute("net.peer.transport", "ip_tcp") | ||
connection.putheader("traceparent", "00-" + hex(current_span.get_span_context().trace_id)[2:].zfill(32) + "-" + hex( | ||
current_span.get_span_context().span_id)[2:].zfill(16) + "-01") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (83 > 79 characters)
current_span.set_attribute("net.peer.ip", connection.host) | ||
current_span.set_attribute("net.peer.port", connection.port) | ||
current_span.set_attribute("net.peer.transport", "ip_tcp") | ||
connection.putheader("traceparent", "00-" + hex(current_span.get_span_context().trace_id)[2:].zfill(32) + "-" + hex( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (132 > 79 characters)
result = super().request(host, handler, request_body, verbose) | ||
current_span.set_attribute("http.status_code", 200) | ||
except xmlrpclib.ProtocolError as protocolError: | ||
current_span.set_attribute("http.status_code", protocolError.errcode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (89 > 79 characters)
with tracer.start_as_current_span("POST XML request", context.get_current(), SpanKind.CLIENT): | ||
current_span = trace.get_current_span() | ||
try: | ||
result = super().request(host, handler, request_body, verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (82 > 79 characters)
headers=headers, context=context) | ||
|
||
def request(self, host, handler, request_body, verbose=False): | ||
with tracer.start_as_current_span("POST XML request", context.get_current(), SpanKind.CLIENT): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (106 > 79 characters)
@@ -103,6 +103,39 @@ def send_content(self, connection, request_body): | |||
current_span.get_span_context().span_id)[2:].zfill(16) + "-01") | |||
|
|||
super().send_content(connection, request_body) | |||
|
|||
|
|||
class TracingXMLSafeTransport(xmlrpclib.SafeTransport): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
The implementation of OpenTelemetry tracing broke TLS support in pynipap. This commit fixes that.
The implementation of OpenTelemetry tracing broke TLS support in pynipap. Fix.