expose the constructor for the multipexed connection tracer

This commit is contained in:
Marten Seemann 2021-02-09 10:54:51 +08:00
parent 622ca23d4e
commit 0d38dce8cd
2 changed files with 5 additions and 4 deletions

View file

@ -11,7 +11,7 @@ type tracerMultiplexer struct {
var _ Tracer = &tracerMultiplexer{}
// NewMultiplexedTracer creates a new tracer that multiplexes all events to multiple tracers.
// NewMultiplexedTracer creates a new tracer that multiplexes events to multiple tracers.
func NewMultiplexedTracer(tracers ...Tracer) Tracer {
if len(tracers) == 0 {
return nil
@ -29,7 +29,7 @@ func (m *tracerMultiplexer) TracerForConnection(p Perspective, odcid ConnectionI
connTracers = append(connTracers, ct)
}
}
return newConnectionMultiplexer(connTracers...)
return NewMultiplexedConnectionTracer(connTracers...)
}
func (m *tracerMultiplexer) SentPacket(remote net.Addr, hdr *Header, size ByteCount, frames []Frame) {
@ -50,7 +50,8 @@ type connTracerMultiplexer struct {
var _ ConnectionTracer = &connTracerMultiplexer{}
func newConnectionMultiplexer(tracers ...ConnectionTracer) ConnectionTracer {
// NewMultiplexedConnectionTracer creates a new connection tracer that multiplexes events to multiple tracers.
func NewMultiplexedConnectionTracer(tracers ...ConnectionTracer) ConnectionTracer {
if len(tracers) == 0 {
return nil
}

View file

@ -94,7 +94,7 @@ var _ = Describe("Tracing", func() {
BeforeEach(func() {
tr1 = NewMockConnectionTracer(mockCtrl)
tr2 = NewMockConnectionTracer(mockCtrl)
tracer = newConnectionMultiplexer(tr1, tr2)
tracer = NewMultiplexedConnectionTracer(tr1, tr2)
})
It("trace the ConnectionStarted event", func() {