code: func (c *ServerContext) reportStats(conn utils.Stater) {
  	// Never emit session data events for the proxy or from a Teleport node if
  	// sessions are being recorded at the proxy (this would result in double
  	// events).
  	if c.GetServer().Component() == teleport.ComponentProxy {
  		return
  	}
  	if c.ClusterConfig.GetSessionRecording() == services.RecordAtProxy &&
  		c.GetServer().Component() == teleport.ComponentNode {
  		return
  	}
  
  	// Get the TX and RX bytes.
  	txBytes, rxBytes := conn.Stat()
  
  	// Build and emit session data event. Note that TX and RX are reversed
  	// below, that is because the connection is held from the perspective of
  	// the server not the client, but the logs are from the perspective of the
  	// client.
  	eventFields := events.EventFields{
  		events.DataTransmitted: rxBytes,
  		events.DataReceived:    txBytes,
  		events.SessionServerID: c.GetServer().ID(),
  		events.EventLogin:      c.Identity.Login,
  		events.EventUser:       c.Identity.TeleportUser,
  		events.LocalAddr:       c.Conn.LocalAddr().String(),
  		events.RemoteAddr:      c.Conn.RemoteAddr().String(),
  	}
  	if c.session != nil {
  		eventFields[events.SessionEventID] = c.session.id
  	}
  	c.GetServer().GetAuditLog().EmitAuditEvent(events.SessionData, eventFields)
  
  	// Emit TX and RX bytes to their respective Prometheus counters.
  	serverTX.Add(float64(txBytes))
  	serverRX.Add(float64(rxBytes))
  }
docs: // When the ServerContext (connection) is closed, emit "session.data" event
  // containing how much data was transmitted and received over the net.Conn.