mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
fix: unquote peer ip (#1315)
This commit is contained in:
@ -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,
|
||||||
|
Reference in New Issue
Block a user