]> Sergey Matveev's repositories - btrtrc.git/blobdiff - webtorrent/otel.go
webtorrent: Create data channel earlier per webrtc examples
[btrtrc.git] / webtorrent / otel.go
index d939c3f83401d7ac6c36cf039d2d54d8079fdc47..2c09964219914df4c2d0493c93b2089799b67854 100644 (file)
@@ -1,22 +1,6 @@
 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) {
-       trace.SpanFromContext(peerConnectionCtx).AddEvent("starting data channel")
-       dataChannelCtx, span = otel.Tracer(tracerName).Start(peerConnectionCtx, "DataChannel")
-       dc.OnClose(func() {
-               span.End()
-       })
-       return
-}