fix: unquote peer ip (#1315)

This commit is contained in:
Srikanth Chekuri
2022-09-07 01:28:21 +05:30
committed by GitHub
parent 8107ad474b
commit 6af37e9fd8

View File

@ -23,6 +23,7 @@ Implementation of the service-side open-telemetry interceptor.
import logging import logging
from contextlib import contextmanager from contextlib import contextmanager
from urllib.parse import unquote
import grpc import grpc
@ -237,6 +238,7 @@ class OpenTelemetryServerInterceptor(grpc.ServerInterceptor):
ip, port = ( ip, port = (
context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1) context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1)
) )
ip = unquote(ip)
attributes.update( attributes.update(
{ {
SpanAttributes.NET_PEER_IP: ip, SpanAttributes.NET_PEER_IP: ip,