Skip to content

Commit

Permalink
Fix/simplify value store span attribute setup
Browse files Browse the repository at this point in the history
This bug has been here for a while, prior to the environment refactoring.
The extra negation on IsSample check meant that we were setting up span
attribute on only non-sampled transactions.  Nothing got logged.
  • Loading branch information
pattyshack committed Dec 19, 2022
1 parent 5b2986f commit 980c43c
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions fvm/environment/value_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,7 @@ func (store *valueStore) GetValue(

var valueByteSize int
span := store.tracer.StartSpanFromRoot(trace.FVMEnvGetValue)
defer func() {
if !trace.IsSampled(span) {
span.SetAttributes(
attribute.String("owner", hex.EncodeToString(owner)),
attribute.String("key", key),
attribute.Int("valueByteSize", valueByteSize),
)
}
span.End()
}()
defer span.End()

address := flow.BytesToAddress(owner)
if state.IsFVMStateKey(string(owner), key) {
Expand Down Expand Up @@ -162,12 +153,6 @@ func (store *valueStore) SetValue(
key := string(keyBytes)

span := store.tracer.StartSpanFromRoot(trace.FVMEnvSetValue)
if !trace.IsSampled(span) {
span.SetAttributes(
attribute.String("owner", hex.EncodeToString(owner)),
attribute.String("key", key),
)
}
defer span.End()

address := flow.BytesToAddress(owner)
Expand Down

0 comments on commit 980c43c

Please sign in to comment.