-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
lib/opentelemetry_plug.ex reads wrong to me:
attributes = [{"http.target", conn.request_path},
{"http.host", conn.host},
{"http.scheme", conn.scheme},
{"http.user_agent", user_agent},
{"http.method", conn.method},
{"net.peer.ip", to_string(:inet_parse.ntoa(peer_ip))},
{"net.peer.port", adapter.peer_data.port},
{"net.peer.name", host},
{"net.transport", "IP.TCP"},
{"net.host.ip", to_string(:inet_parse.ntoa(conn.remote_ip))},
{"net.host.port", conn.port} | optional_attributes(conn)
# {"net.host.name", HostName}
]vs the semantic conventions spec:
Attribute name Notes and examples net.transportTransport protocol used. See note below. net.peer.ipRemote address of the peer (dotted decimal for IPv4 or RFC5952 for IPv6) net.peer.portRemote port number as an integer. E.g., 80.net.peer.nameRemote hostname or similar, see note below. net.host.ipLike net.peer.ipbut for the host IP. Useful in case of a multi-IP host.net.host.portLike net.peer.portbut for the host port.net.host.nameLocal hostname or similar, see note below.
… and the semantic conventions for HTTP spec, from which I lack the time to extract the right bit, and Plug.Conn:
remote_ip - the IP of the client, example: {151, 236, 219, 228}. This field is meant to be overwritten by plugs that understand e.g. the X-Forwarded-For header or HAProxy's PROXY protocol. It defaults to peer's IP
If conn.remote_ip has the apparent client IP address from X-Forwarded-For, that should go in http.client_ip, which you did by other means, not in net.host.ip. So there'll be some cleaning up in there.
Metadata
Metadata
Assignees
Labels
No labels