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