Add source auth token to lotus traces
This commit is contained in:
parent
515925a178
commit
e2206147cc
@ -311,6 +311,7 @@ type Pubsub struct {
|
|||||||
RemoteTracer string
|
RemoteTracer string
|
||||||
JsonTracerFile string
|
JsonTracerFile string
|
||||||
ElasticSearchTracer string
|
ElasticSearchTracer string
|
||||||
|
TracerSourceAuth string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Chainstore struct {
|
type Chainstore struct {
|
||||||
|
@ -384,7 +384,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) {
|
|||||||
}
|
}
|
||||||
transports = append(transports, elasticSearchTransport)
|
transports = append(transports, elasticSearchTransport)
|
||||||
}
|
}
|
||||||
lt := tracer.NewLotusTracer(transports, in.Host.ID())
|
lt := tracer.NewLotusTracer(transports, in.Host.ID(), in.Cfg.TracerSourceAuth)
|
||||||
|
|
||||||
// tracer
|
// tracer
|
||||||
if in.Cfg.RemoteTracer != "" {
|
if in.Cfg.RemoteTracer != "" {
|
||||||
|
@ -11,16 +11,18 @@ import (
|
|||||||
|
|
||||||
var log = logging.Logger("lotus-tracer")
|
var log = logging.Logger("lotus-tracer")
|
||||||
|
|
||||||
func NewLotusTracer(tt []TracerTransport, pid peer.ID) LotusTracer {
|
func NewLotusTracer(tt []TracerTransport, pid peer.ID, sourceAuth string) LotusTracer {
|
||||||
return &lotusTracer{
|
return &lotusTracer{
|
||||||
tt: tt,
|
tt: tt,
|
||||||
pid: pid,
|
pid: pid,
|
||||||
|
sa: sourceAuth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type lotusTracer struct {
|
type lotusTracer struct {
|
||||||
tt []TracerTransport
|
tt []TracerTransport
|
||||||
pid peer.ID
|
pid peer.ID
|
||||||
|
sa string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -32,6 +34,7 @@ type LotusTraceEvent struct {
|
|||||||
PeerID []byte `json:"peerID,omitempty"`
|
PeerID []byte `json:"peerID,omitempty"`
|
||||||
Timestamp *int64 `json:"timestamp,omitempty"`
|
Timestamp *int64 `json:"timestamp,omitempty"`
|
||||||
PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"`
|
PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"`
|
||||||
|
SourceAuth string `json:"sourceAuth,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TraceEvent_PeerScores struct {
|
type TraceEvent_PeerScores struct {
|
||||||
@ -48,9 +51,10 @@ type LotusTracer interface {
|
|||||||
func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) {
|
func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) {
|
||||||
now := time.Now().UnixNano()
|
now := time.Now().UnixNano()
|
||||||
evt := &LotusTraceEvent{
|
evt := &LotusTraceEvent{
|
||||||
Type: *TraceEvent_PEER_SCORES.Enum(),
|
Type: *TraceEvent_PEER_SCORES.Enum(),
|
||||||
PeerID: []byte(lt.pid),
|
PeerID: []byte(lt.pid),
|
||||||
Timestamp: &now,
|
Timestamp: &now,
|
||||||
|
SourceAuth: lt.sa,
|
||||||
PeerScores: &TraceEvent_PeerScores{
|
PeerScores: &TraceEvent_PeerScores{
|
||||||
Scores: scores,
|
Scores: scores,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user