Skip to content

Commit

Permalink
Add detail on empty attribute key error (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacd authored Oct 5, 2022
1 parent 3a6bc96 commit 00dc01a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lightstep/sdk/metric/internal/viewstate/base_instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (metric *instrumentBase[N, Storage, Auxiliary, Methods]) applyKeysFilter(kv
kv := iter.Attribute()
if !isValidAttribute(kv) {
doevery.TimePeriod(time.Minute, func() {
otel.Handle(fmt.Errorf("use of empty attribute key, e.g., with value %q", kv.Value.Emit()))
otel.Handle(fmt.Errorf("use of empty attribute key, e.g., metric name %q with value %q", metric.desc.Name, kv.Value.Emit()))
})
invalidFilter = true
break
Expand Down
2 changes: 1 addition & 1 deletion lightstep/sdk/metric/internal/viewstate/viewstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ func TestEmptyKeyFilter(t *testing.T) {
)

require.Equal(t, 1, len(*errs))
require.Equal(t, "use of empty attribute key, e.g., with value \"1value\"", (*errs)[0].Error())
require.Equal(t, "use of empty attribute key, e.g., metric name \"foo\" with value \"1value\"", (*errs)[0].Error())
}

// TestEmptyKeyFilterAndView ensures no empty keys are used (with a view config).
Expand Down

0 comments on commit 00dc01a

Please sign in to comment.