diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index afaa8178e4..ce7a84744b 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -24,6 +24,7 @@ from six.moves import urllib import attr import opentracing +from opentracing import tags import treq from canonicaljson import encode_canonical_json from opentracing.propagation import Format @@ -345,10 +346,10 @@ class MatrixFederationHttpClient(object): scope = opentracing.tracer.start_active_span( "outgoing-federation-request", tags={ - "span.kind": "client", # With respect to this request's role in an rpc - "peer.address": request.destination, - "http.method": request.method, - "http.url": request.path, + tags.SPAN_KIND: tags.SPAN_KIND_RPC_CLIENT + tags.PEER_ADDRESS: request.destination, + tags.HTTP_METHOD: request.method, + tags.HTTP_URL: request.path, }, finish_on_close=True, ) @@ -443,7 +444,7 @@ class MatrixFederationHttpClient(object): 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: pass else: diff --git a/synapse/http/site.py b/synapse/http/site.py index 887b7701ad..b1d7bf0cbb 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -16,6 +16,7 @@ import logging import time import opentracing +from opentracing import tags from twisted.web.server import Request, Site @@ -243,10 +244,10 @@ class SynapseRequest(Request): "incoming-federation-request", tags={ "request_id": self.get_request_id(), - "span.kind": "server", - "http.method": self.get_method(), - "http.url": self.get_redacted_uri(), - "peer.ipv6": self.getClientIP(), + tags.SPAN_KIND: tags.SPAN_KIND_RPC_SERVER, + tags.HTTP_METHOD: self.get_method(), + tags.HTTP_URL: self.get_redacted_uri(), + tags.PEER_HOST_IPV6: self.getClientIP(), }, child_of=span_context, )