mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 12:43:39 +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
|
||||
from contextlib import contextmanager
|
||||
from urllib.parse import unquote
|
||||
|
||||
import grpc
|
||||
|
||||
@ -237,6 +238,7 @@ class OpenTelemetryServerInterceptor(grpc.ServerInterceptor):
|
||||
ip, port = (
|
||||
context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1)
|
||||
)
|
||||
ip = unquote(ip)
|
||||
attributes.update(
|
||||
{
|
||||
SpanAttributes.NET_PEER_IP: ip,
|
||||
|
Reference in New Issue
Block a user