Rename jsonEvent to evt
This commit is contained in:
parent
add13c2646
commit
67c1d633c6
@ -33,20 +33,20 @@ type elasticSearchTransport struct {
|
||||
cl *elasticsearch.Client
|
||||
}
|
||||
|
||||
func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error {
|
||||
func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error {
|
||||
var e interface{}
|
||||
var docId string
|
||||
if event.lotusTraceEvent != nil {
|
||||
e = *event.lotusTraceEvent
|
||||
if evt.lotusTraceEvent != nil {
|
||||
e = *evt.lotusTraceEvent
|
||||
docId = ElasticSearch_DOC_LOTUS
|
||||
} else if event.pubsubTraceEvent != nil {
|
||||
e = *event.pubsubTraceEvent
|
||||
} else if evt.pubsubTraceEvent != nil {
|
||||
e = *evt.pubsubTraceEvent
|
||||
docId = ElasticSearch_DOC_PUBSUB
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
jsonEvent, err := json.Marshal(e)
|
||||
jsonEvt, err := json.Marshal(e)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error while marshaling event: %s", err)
|
||||
}
|
||||
@ -54,7 +54,7 @@ func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error {
|
||||
req := esapi.IndexRequest{
|
||||
Index: ElasticSearch_INDEX,
|
||||
DocumentID: docId,
|
||||
Body: strings.NewReader(string(jsonEvent)),
|
||||
Body: strings.NewReader(string(jsonEvt)),
|
||||
Refresh: "true",
|
||||
}
|
||||
|
||||
|
@ -16,21 +16,21 @@ func NewJsonTracerTransport(out *os.File) TracerTransport {
|
||||
}
|
||||
}
|
||||
|
||||
func (jtt *jsonTracerTransport) Transport(event TracerTransportEvent) error {
|
||||
func (jtt *jsonTracerTransport) Transport(evt TracerTransportEvent) error {
|
||||
var e interface{}
|
||||
if event.lotusTraceEvent != nil {
|
||||
e = *event.lotusTraceEvent
|
||||
} else if event.pubsubTraceEvent != nil {
|
||||
e = *event.pubsubTraceEvent
|
||||
if evt.lotusTraceEvent != nil {
|
||||
e = *evt.lotusTraceEvent
|
||||
} else if evt.pubsubTraceEvent != nil {
|
||||
e = *evt.pubsubTraceEvent
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
jsonEvent, err := json.Marshal(e)
|
||||
jsonEvt, err := json.Marshal(e)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error while marshaling event: %s", err)
|
||||
}
|
||||
|
||||
_, err = jtt.out.Write(jsonEvent)
|
||||
_, err = jtt.out.Write(jsonEvt)
|
||||
return err
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package tracer
|
||||
import pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
||||
|
||||
type TracerTransport interface {
|
||||
Transport(jsonEvent TracerTransportEvent) error
|
||||
Transport(evt TracerTransportEvent) error
|
||||
}
|
||||
|
||||
type TracerTransportEvent struct {
|
||||
|
Loading…
Reference in New Issue
Block a user