MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / mapValuer

Method mapValuer

pkg/filter/filter.go:495–518  ·  view source on GitHub ↗

mapValuer for each field present in the AST, we run the accessors and extract the field values that are supplied to the valuer. The valuer feeds the expression with correct values.

(evt *event.Event)

Source from the content-addressed store, hash-verified

493// supplied to the valuer. The valuer feeds the
494// expression with correct values.
495func (f *filter) mapValuer(evt *event.Event) map[string]any {
496 valuer := valuerPool.Get().(map[string]any)
497 for _, field := range f.fields {
498 for _, accessor := range f.accessors {
499 if !accessor.IsFieldAccessible(evt) {
500 continue
501 }
502 v, err := accessor.Get(field, evt)
503 if v == nil || err != nil {
504 if v == nil {
505 valuer[field.String()] = defaultAccessorValue(field)
506 }
507 if err != nil && !errs.IsParamNotFound(err) {
508 valuer[field.String()] = defaultAccessorValue(field)
509 accessorErrors.Add(err.Error(), 1)
510 }
511 continue
512 }
513 valuer[field.String()] = v
514 break
515 }
516 }
517 return valuer
518}
519
520// addField appends a new field to the filter fields list.
521func (f *filter) addField(field *ql.FieldLiteral) {

Callers 2

RunMethod · 0.95
RunSequenceMethod · 0.95

Calls 6

defaultAccessorValueFunction · 0.85
GetMethod · 0.65
IsFieldAccessibleMethod · 0.65
StringMethod · 0.65
AddMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected