Skip to content

Commit

Permalink
feat: update go api
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Sep 21, 2023
1 parent ba26646 commit 882cda5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion observe-api/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module dylibso.com/observe_api
module github.com/dylibso/observe-sdk/observe-api/go

go 1.21.1
24 changes: 17 additions & 7 deletions observe-api/go/observe_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,27 @@ func Log(level LogLevel, msg string) {
log(uint32(level), ptr, uint32(len(msg)))
}

func SpanEnter(name string) {
func SpanTags(tags []string) {
s := strings.Join(tags[:], ",")
ptr := stringPointer(&s)
span_tags(ptr, uint32(len(s)))
}

type span struct {
name string
tags []string
}

func NewSpan(name string) span {
ptr := stringPointer(&name)
span_enter(ptr, uint32(len(name)))
return span { name }
}

func SpanExit() {
func (s span) End() {
span_exit()
}

func SpanTags(tags []string) {
s := strings.Join(tags[:], ",")
ptr := stringPointer(&s)
span_tags(ptr, uint32(len(s)))
}
func (s span) AddTags(tags ...string) {
SpanTags(tags...)
}

0 comments on commit 882cda5

Please sign in to comment.