Example #1
0
func (e *Endpoint) traceStarted() {
	if tracer.Enabled {
		tracer.Emit("endpoint.started", tracer.Info{
			"endpoint_id": e.TID,
		})
	}
}
Example #2
0
func (e *Endpoint) traceNew() {
	if tracer.Enabled {
		tracer.Emit("endpoint.new", tracer.Info{
			"endpoint_id": e.TID,
			"hashname":    e.hashname.String(),
		})
	}
}
Example #3
0
func (e *Endpoint) traceError(err error) error {
	if tracer.Enabled && err != nil {
		tracer.Emit("endpoint.error", tracer.Info{
			"endpoint_id": e.TID,
			"error":       err.Error(),
		})
	}
	return err
}
Example #4
0
func (c *Channel) traceReceivedPacket(pkt *lob.Packet) {
	if tracer.Enabled {
		tracer.Emit("channel.rcv.packet", tracer.Info{
			"channel_id": c.TID,
			"packet_id":  pkt.TID,
			"packet": tracer.Info{
				"header": pkt.Header(),
				"body":   base64.StdEncoding.EncodeToString(pkt.Body(nil)),
			},
		})
	}
}
Example #5
0
func (c *Channel) traceNew() {
	if tracer.Enabled {
		tracer.Emit("channel.new", tracer.Info{
			"exchange_id": c.x.getTID(),
			"channel_id":  c.TID,
			"channel": tracer.Info{
				"type":     c.typ,
				"reliable": c.reliable,
				"cid":      c.id,
			},
		})
	}
}
Example #6
0
func (e *Endpoint) traceReceivedPacket(msg message) {
	if tracer.Enabled {
		pkt := tracer.Info{
			"msg": base64.StdEncoding.EncodeToString(msg.Data.Get(nil)),
		}

		if msg.Pipe != nil {
			pkt["src"] = msg.Pipe.raddr.String()
		}

		tracer.Emit("endpoint.rcv.packet", tracer.Info{
			"endpoint_id": e.TID,
			"packet_id":   msg.TID,
			"packet":      pkt,
		})
	}
}
Example #7
0
func (c *Channel) traceDroppedPacket(pkt *lob.Packet, reason string) {
	if tracer.Enabled {
		info := tracer.Info{
			"channel_id": c.TID,
			"packet_id":  pkt.TID,
			"reason":     reason,
		}

		if pkt != nil {
			info["packet"] = tracer.Info{
				"header": pkt.Header(),
				"body":   base64.StdEncoding.EncodeToString(pkt.Body(nil)),
			}
		}

		tracer.Emit("channel.rcv.packet", info)
	}
}
Example #8
0
func (e *Endpoint) traceDroppedPacket(msg []byte, conn net.Conn, reason string) {
	if tracer.Enabled {
		pkt := tracer.Info{
			"msg": base64.StdEncoding.EncodeToString(msg),
		}

		if conn != nil {
			pkt["src"] = conn.RemoteAddr()
			pkt["dst"] = conn.LocalAddr()
		}

		tracer.Emit("endpoint.drop.packet", tracer.Info{
			"endpoint_id": e.TID,
			"packet_id":   tracer.NewID(),
			"reason":      reason,
			"packet":      pkt,
		})
	}
}
Example #9
0
func (c *Channel) traceWrite(pkt *lob.Packet, p *Pipe) {
	if tracer.Enabled {
		info := tracer.Info{
			"channel_id": c.TID,
		}

		if p != nil {
			info["path"] = p.RemoteAddr().String()
		}

		if pkt != nil {
			info["packet_id"] = pkt.TID
			info["packet"] = tracer.Info{
				"header": pkt.Header(),
				"body":   base64.StdEncoding.EncodeToString(pkt.Body(nil)),
			}
		}

		tracer.Emit("channel.write", info)
	}
}
Example #10
0
func (c *Channel) traceWriteError(pkt *lob.Packet, p *Pipe, reason error) error {
	if tracer.Enabled {
		info := tracer.Info{
			"channel_id": c.TID,
			"reason":     reason.Error(),
		}

		if p != nil {
			info["path"] = p.RemoteAddr().String()
		}

		if pkt != nil {
			info["packet_id"] = pkt.TID
			info["packet"] = tracer.Info{
				"header": pkt.Header(),
				"body":   base64.StdEncoding.EncodeToString(pkt.Body(nil)),
			}
		}

		tracer.Emit("channel.write.error", info)
	}
	return reason
}