diff --git a/libp2p/muxers/mplex/mplex.nim b/libp2p/muxers/mplex/mplex.nim index d84cf5e00..7d75942e4 100644 --- a/libp2p/muxers/mplex/mplex.nim +++ b/libp2p/muxers/mplex/mplex.nim @@ -97,6 +97,8 @@ proc newStreamInternal*(m: Mplex, result.peerId = m.connection.peerId result.observedAddr = m.connection.observedAddr result.transportDir = m.connection.transportDir + when defined(libp2p_agents_metrics): + result.shortAgent = m.connection.shortAgent trace "Creating new channel", m, channel = result, id, initiator, name diff --git a/libp2p/upgrademngrs/muxedupgrade.nim b/libp2p/upgrademngrs/muxedupgrade.nim index 2ba98c875..fc596a704 100644 --- a/libp2p/upgrademngrs/muxedupgrade.nim +++ b/libp2p/upgrademngrs/muxedupgrade.nim @@ -173,6 +173,11 @@ proc muxerHandler( try: await self.identify(muxer) + when defined(libp2p_agents_metrics): + #TODO Passing data between layers is a pain + if muxer.connection of SecureConn: + let secureConn = (SecureConn)muxer.connection + secureConn.stream.shortAgent = muxer.connection.shortAgent except IdentifyError as exc: # Identify is non-essential, though if it fails, it might indicate that # the connection was closed already - this will be picked up by the read