diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 4fe8149be..c2cfdb87a 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -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", } diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go index 128c37473..26537a600 100644 --- a/node/modules/tracer/json_transport.go +++ b/node/modules/tracer/json_transport.go @@ -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 } diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go index e67867fd7..56d926afc 100644 --- a/node/modules/tracer/transport.go +++ b/node/modules/tracer/transport.go @@ -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 {