Skip to content

Commit

Permalink
feat: expose span data
Browse files Browse the repository at this point in the history
  • Loading branch information
w-h-a committed Oct 13, 2024
1 parent 2fdf70b commit 4aeb6a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
14 changes: 7 additions & 7 deletions telemetry/tracev2/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

// TODO: status
type SpanData struct {
Name string
Id string
Parent string
Trace string
Started time.Time
Ended time.Time
Metadata map[string]string
Name string `json:"name"`
Id string `json:"id"`
Parent string `json:"parent"`
Trace string `json:"trace"`
Started time.Time `json:"started"`
Ended time.Time `json:"ended"`
Metadata map[string]string `json:"metadata"`
}
8 changes: 8 additions & 0 deletions telemetry/tracev2/memory/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ func (s *memorySpan) Options() tracev2.SpanOptions {
return s.options
}

func (s *memorySpan) SpanData() *tracev2.SpanData {
return &tracev2.SpanData{
Name: s.options.Name,
Id: s.span.SpanContext().SpanID().String(),
Trace: s.span.SpanContext().TraceID().String(),
}
}

func (s *memorySpan) AddMetadata(md map[string]string) {
attrs := []attribute.KeyValue{}

Expand Down
1 change: 1 addition & 0 deletions telemetry/tracev2/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tracev2

type Span interface {
Options() SpanOptions
SpanData() *SpanData
AddMetadata(md map[string]string)
Finish()
String() string
Expand Down

0 comments on commit 4aeb6a1

Please sign in to comment.