Use tag constants for opentracing.
parent
bae3b5b8fb
commit
9c39f0e4ad
|
@ -24,6 +24,7 @@ from six.moves import urllib
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import opentracing
|
import opentracing
|
||||||
|
from opentracing import tags
|
||||||
import treq
|
import treq
|
||||||
from canonicaljson import encode_canonical_json
|
from canonicaljson import encode_canonical_json
|
||||||
from opentracing.propagation import Format
|
from opentracing.propagation import Format
|
||||||
|
@ -345,10 +346,10 @@ class MatrixFederationHttpClient(object):
|
||||||
scope = opentracing.tracer.start_active_span(
|
scope = opentracing.tracer.start_active_span(
|
||||||
"outgoing-federation-request",
|
"outgoing-federation-request",
|
||||||
tags={
|
tags={
|
||||||
"span.kind": "client", # With respect to this request's role in an rpc
|
tags.SPAN_KIND: tags.SPAN_KIND_RPC_CLIENT
|
||||||
"peer.address": request.destination,
|
tags.PEER_ADDRESS: request.destination,
|
||||||
"http.method": request.method,
|
tags.HTTP_METHOD: request.method,
|
||||||
"http.url": request.path,
|
tags.HTTP_URL: request.path,
|
||||||
},
|
},
|
||||||
finish_on_close=True,
|
finish_on_close=True,
|
||||||
)
|
)
|
||||||
|
@ -443,7 +444,7 @@ class MatrixFederationHttpClient(object):
|
||||||
opentracing.tracer.active_span
|
opentracing.tracer.active_span
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
scope.span.set_tag("http.status_code", response.code)
|
scope.span.set_tag(opentracing.tags.HTTP_STATUS_CODE response.code)
|
||||||
if 200 <= response.code < 300:
|
if 200 <= response.code < 300:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -16,6 +16,7 @@ import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import opentracing
|
import opentracing
|
||||||
|
from opentracing import tags
|
||||||
|
|
||||||
from twisted.web.server import Request, Site
|
from twisted.web.server import Request, Site
|
||||||
|
|
||||||
|
@ -243,10 +244,10 @@ class SynapseRequest(Request):
|
||||||
"incoming-federation-request",
|
"incoming-federation-request",
|
||||||
tags={
|
tags={
|
||||||
"request_id": self.get_request_id(),
|
"request_id": self.get_request_id(),
|
||||||
"span.kind": "server",
|
tags.SPAN_KIND: tags.SPAN_KIND_RPC_SERVER,
|
||||||
"http.method": self.get_method(),
|
tags.HTTP_METHOD: self.get_method(),
|
||||||
"http.url": self.get_redacted_uri(),
|
tags.HTTP_URL: self.get_redacted_uri(),
|
||||||
"peer.ipv6": self.getClientIP(),
|
tags.PEER_HOST_IPV6: self.getClientIP(),
|
||||||
},
|
},
|
||||||
child_of=span_context,
|
child_of=span_context,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue