Skip to content

Commit c8e801b

Browse files
committed
dataset: allow nil filter settings
If you do no specify filter settings in the trace2receiver config then you hit a null pointer exception at runtime as we try to access the `Keynames` member of a `nil` `*FilterSettings`. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 2a2f265 commit c8e801b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

trace2dataset.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,11 @@ func (tr2 *trace2Dataset) exportTraces() {
522522
return
523523
}
524524

525-
traces := tr2.ToTraces(dl, tr2.rcvr_base.RcvrConfig.filterSettings.Keynames)
525+
var keynames FilterKeynames
526+
if tr2.rcvr_base.RcvrConfig.filterSettings != nil {
527+
keynames = tr2.rcvr_base.RcvrConfig.filterSettings.Keynames
528+
}
529+
traces := tr2.ToTraces(dl, keynames)
526530

527531
err := tr2.rcvr_base.TracesConsumer.ConsumeTraces(tr2.rcvr_base.ctx, traces)
528532
if err != nil {

0 commit comments

Comments
 (0)