From fe07b26e67d243740865680072f9c64551dc91ff Mon Sep 17 00:00:00 2001 From: Filip Gora Date: Fri, 26 Apr 2024 15:50:00 +0200 Subject: [PATCH] sync --- app/main.go | 2 +- pkg/gelf_exporter/trace.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) 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{}), }) }