Skip to content

Commit

Permalink
feat(traceql): implement stringer for AttributeScope
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed May 23, 2024
1 parent 91c13d2 commit 4b1d48d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions internal/traceql/attribute.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package traceql

import (
"fmt"
"strings"

"github.com/go-faster/errors"
Expand Down Expand Up @@ -139,4 +140,21 @@ const (
ScopeNone AttributeScope = iota
ScopeResource
ScopeSpan
ScopeInstrumentation
)

// String implements [fmt.Stringer].
func (s AttributeScope) String() string {
switch s {
case ScopeNone:
return "none"
case ScopeResource:
return "resource"
case ScopeSpan:
return "span"
case ScopeInstrumentation:
return "<instrumentation>"
default:
return fmt.Sprintf("unknown scope %d", uint8(s))
}
}
2 changes: 1 addition & 1 deletion internal/traceql/autocomplete.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ParseAutocomplete(input string) (c Autocomplete) {
return c
case !ok:
// Handle cases like `{ .foo = <missing field> && .bar = 10 }`.
op, ok := p.peekBinaryOp()
op, ok = p.peekBinaryOp()
if !ok {
return c
}
Expand Down

0 comments on commit 4b1d48d

Please sign in to comment.