Skip to content

Commit

Permalink
Merge pull request #104 from kevpar/etw-nofields
Browse files Browse the repository at this point in the history
Support ETW events with no data fields
  • Loading branch information
kevpar authored Jan 8, 2019
2 parents f8ca910 + b080430 commit a0ca357
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/etw/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,15 @@ func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpt
opt(em, ed)
}

return provider.WriteEventRaw(options.descriptor, nil, nil, [][]byte{em.Bytes()}, [][]byte{ed.Bytes()})
// Don't pass a data blob if there is no event data. There will always be
// event metadata (e.g. for the name) so we don't need to do this check for
// the metadata.
dataBlobs := [][]byte{}
if len(ed.Bytes()) > 0 {
dataBlobs = [][]byte{ed.Bytes()}
}

return provider.WriteEventRaw(options.descriptor, nil, nil, [][]byte{em.Bytes()}, dataBlobs)
}

// WriteEventRaw writes a single ETW event from the provider. This function is
Expand Down

0 comments on commit a0ca357

Please sign in to comment.