2
0
mirror of synced 2025-02-24 06:38:14 +00:00
2022-07-12 16:15:49 +10:00

22 lines
519 B
Go

package webtorrent
import (
"context"
"github.com/pion/webrtc/v3"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
const (
tracerName = "anacrolix.torrent.webtorrent"
webrtcConnTypeKey = "webtorrent.webrtc.conn.type"
)
func dataChannelStarted(peerConnectionCtx context.Context, dc *webrtc.DataChannel) (dataChannelCtx context.Context, span trace.Span) {
dataChannelCtx, span = otel.Tracer(tracerName).Start(peerConnectionCtx, "DataChannel")
dc.OnClose(func() {
span.End()
})
return
}