Skip to content

Commit

Permalink
adds const value
Browse files Browse the repository at this point in the history
Signed-off-by: Afzal <[email protected]>
  • Loading branch information
afzalbin64 committed Aug 2, 2023
1 parent 8c3ac14 commit 0b0c422
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions model/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
FirehoseFlag = Flags(8)

samplerType = "sampler.type"
keySpanKind = "span.kind"
samplerTypeUnknown = "unknown"
)

Expand All @@ -50,15 +51,15 @@ func (s *Span) Hash(w io.Writer) (err error) {

// HasSpanKind returns true if the span has a `span.kind` tag set to `kind`.
func (s *Span) HasSpanKind(kind trace.SpanKind) bool {
if tag, ok := KeyValues(s.Tags).FindByKey("span.kind"); ok {
if tag, ok := KeyValues(s.Tags).FindByKey(keySpanKind); ok {
return tag.AsString() == kind.String()
}
return false
}

// GetSpanKind returns value of `span.kind` tag and whether the tag can be found
func (s *Span) GetSpanKind() (spanKind string, found bool) {
if tag, ok := KeyValues(s.Tags).FindByKey("span.kind"); ok {
if tag, ok := KeyValues(s.Tags).FindByKey(keySpanKind); ok {
return tag.AsString(), true
}
return trace.SpanKindUnspecified.String(), false
Expand Down

0 comments on commit 0b0c422

Please sign in to comment.