From f5ec719fbd542ae9b12fdcfded4019b977519b3b Mon Sep 17 00:00:00 2001 From: thinkerou Date: Fri, 28 Jun 2019 04:34:57 +0800 Subject: [PATCH] update type style (#28) --- sdk/event/event.go | 10 ++++------ sdk/trace/span.go | 10 ++++++++++ sdk/trace/trace.go | 18 +++--------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/sdk/event/event.go b/sdk/event/event.go index 84b6a38faaf..f346f92ceda 100644 --- a/sdk/event/event.go +++ b/sdk/event/event.go @@ -21,12 +21,10 @@ import ( apievent "github.com/open-telemetry/opentelemetry-go/api/event" ) -type ( - event struct { - message string - attributes []core.KeyValue - } -) +type event struct { + message string + attributes []core.KeyValue +} var _ apievent.Event = (*event)(nil) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 216ddc86bb6..804986fda93 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -26,6 +26,16 @@ import ( "github.com/open-telemetry/opentelemetry-go/exporter/observer" ) +type span struct { + tracer *tracer + spanContext core.SpanContext + lock sync.Mutex + eventID core.EventID + finishOnce sync.Once + recordEvent bool + status codes.Code +} + // SpancContext returns span context of the span. Return SpanContext is usable // even after the span is finished. func (sp *span) SpanContext() core.SpanContext { diff --git a/sdk/trace/trace.go b/sdk/trace/trace.go index 3fb4ced209a..aefacd7dd9c 100644 --- a/sdk/trace/trace.go +++ b/sdk/trace/trace.go @@ -29,21 +29,9 @@ import ( "github.com/open-telemetry/opentelemetry-go/sdk/event" ) -type ( - span struct { - tracer *tracer - spanContext core.SpanContext - lock sync.Mutex - eventID core.EventID - finishOnce sync.Once - recordEvent bool - status codes.Code - } - - tracer struct { - resources core.EventID - } -) +type tracer struct { + resources core.EventID +} var ( ServiceKey = tag.New("service")