swarm: integrate OpenTracing; propagate ctx to internal APIs (#17169)
* swarm: propagate ctx, enable opentracing * swarm/tracing: log error when tracing is misconfigured
This commit is contained in:
committed by
Balint Gabor
parent
f7d3678c28
commit
7c9314f231
@@ -19,6 +19,7 @@
|
||||
package pss
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
@@ -40,7 +41,7 @@ type Ping struct {
|
||||
InC chan bool // optional, report back to calling code
|
||||
}
|
||||
|
||||
func (p *Ping) pingHandler(msg interface{}) error {
|
||||
func (p *Ping) pingHandler(ctx context.Context, msg interface{}) error {
|
||||
var pingmsg *PingMsg
|
||||
var ok bool
|
||||
if pingmsg, ok = msg.(*PingMsg); !ok {
|
||||
@@ -80,7 +81,7 @@ func NewPingProtocol(ping *Ping) *p2p.Protocol {
|
||||
for {
|
||||
select {
|
||||
case ispong := <-ping.OutC:
|
||||
pp.Send(&PingMsg{
|
||||
pp.Send(context.TODO(), &PingMsg{
|
||||
Created: time.Now(),
|
||||
Pong: ispong,
|
||||
})
|
||||
|
Reference in New Issue
Block a user