Merge pull request #104 from kevpar/etw-nofields

Support ETW events with no data fields
This commit is contained in:
Kevin Parsons
2019-01-08 12:25:37 -08:00
committed by GitHub
+9 -1
View File
@@ -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