diff --git a/app/main.go b/app/main.go index d3f272d..69aaf34 100644 --- a/app/main.go +++ b/app/main.go @@ -21,7 +21,7 @@ func main() { main.Use(tracer.NewTracer(tracer.Config{ AppName: "test", JaegerUrl: "http://localhost:4318/v1/traces", - GelfUrl: "192.168.220.30:12001", + GelfUrl: "192.168.220.30:12201", Version: "1", })) defer tracer.ShutdownTracer() diff --git a/pkg/gelf_exporter/trace.go b/pkg/gelf_exporter/trace.go index 1432b6d..34f5828 100644 --- a/pkg/gelf_exporter/trace.go +++ b/pkg/gelf_exporter/trace.go @@ -2,7 +2,7 @@ package gelfexporter import ( "context" - "fmt" + "maal/tracer/pkg/level" "sync" "time" @@ -33,7 +33,6 @@ func New(options ...Option) (*Exporter, error) { } -// Exporter is an implementation of trace.SpanSyncer that writes spans to stdout. type Exporter struct { timestamps bool gelfWriter *gelf.UDPWriter @@ -42,7 +41,6 @@ type Exporter struct { stopped bool } -// ExportSpans writes spans in json format to stdout. func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { if err := ctx.Err(); err != nil { return err @@ -72,11 +70,15 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) } } - fmt.Printf("stub: %v\n", stub) + // fmt.Printf("stub: %v\n", stub) Log(e.gelfWriter, GELFMessage{ Host: "test", - ShortMessage: "test", + ShortMessage: stub.Name, + LongMessage: "test", + Timestamp: stub.StartTime, + Level: level.DEBUG, + ExtraFields: make(map[string]interface{}), }) }