Skip to content

feat(libsinsp): expose the operators and argument types of each field in JSON - #3151

Open
legobrick wants to merge 5 commits into
falcosecurity:masterfrom
legobrick:feat/field-operators-json
Open

legobrick wants to merge 5 commits into
falcosecurity:masterfrom
legobrick:feat/field-operators-json

Conversation

@legobrick

@legobrick legobrick commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area libsinsp

Does this PR require a change in the driver versions?

No.

What this PR does / why we need it:

Follow-up to #2837. filter_fieldclass_info::as_json() exports the field metadata, but not which operators each field supports, so tools that suggest operators (e.g. rule editors) have to guess them from the data type, and get some of them wrong. This adds them, opt-in through include_operators (default false, so existing output is unchanged).

The general case

filter_field_info now keeps the raw ppm_param_type (it only had a display string). flt_supported_cmpops() (new, filter_compare.cpp) tries every operator against flt_is_comparable, the check the filter compiler itself runs, so the JSON follows the compiler's rules and can't drift from them, whatever the type (numeric, bool, string, buffer, ip/net or list). Per field:

  • operators: what the compiler accepts.
  • modifier_operators: those that can be followed by oneof / anyof / allof (the parser's modifier-capable operators, narrowed by the type rules).
  • transformers: for fields that accept transformers, each applicable one (len, tolower, toupper, basename, b64) with the resulting type, is_list, operators and modifier_operators. A transformer changes the type the compiler checks (len() turns a string into a number), and this is derived from each transformer's own transform_type().
{
  "name": "proc.name",
  "type": "CHARBUF",
  "operators": ["=", "!=", "<", "<=", ">", ">=", "contains", "in", "exists", "icontains", "startswith", "glob", "pmatch", "endswith", "intersects", "iglob", "regex"],
  "modifier_operators": ["=", "!=", "contains", "icontains", "startswith", "glob", "endswith", "iglob", "regex"],
  "transformers": {
    "len": { "type": "UINT64", "is_list": false, "operators": ["=", "!=", "<", "<=", ">", ">=", "in", "exists", "intersects"], "modifier_operators": ["=", "!="] },
    "tolower": { "type": "CHARBUF", "is_list": false, "operators": [...], "modifier_operators": [...] }
  }
}

Edge cases

Case Behavior
List fields, with or without an index argument Only in, intersects, exists; no modifiers.
Fields typed PT_DYN (evt.rawarg) operators / modifier_operators are null: the type is only known once the argument is parsed.
Fields with EPF_NO_TRANSFORMER No transformers key.
Transformers that don't apply to the type Left out.
Fields that support fewer operators than their type A per-field operator mask, see below.

Fields supporting fewer operators than their type

Some filterchecks override compare_nocache and don't evaluate every operator their type allows. Two optional masks in filtercheck_field_info (0 = no restriction) cover the two behaviors:

  • m_allowed_ops (advisory): the other operators compile but don't work when the filter is evaluated: compare_ip and compare_port throw (e.g. fd.port intersects (80) fails with unsupported port comparison operator) and compare_net never matches. They're reported as suppressed_operators / suppressed_modifier_operators (all modifiers, since these compare paths only compare the first value). Set for fd.ip, fd.net, fd.port and fd.proto. Compiler behavior is unchanged.
  • m_enforced_ops (enforced): evt.around only supports =. Listing the others as suppressed would be misleading, as they're a compile error. The compiler (check_op_type_compatibility) now rejects anything outside the mask, and any modifier, and the JSON lists just the enforced operators. This replaces the ad-hoc check in the field's value parsing.

fd.*ip.name has no mask on purpose: when a name is known for the IP every operator works, otherwise only =, != and in do (the others throw) as they go through the DNS manager. What works depends on runtime state, which a static list can't express, so the JSON reports the plain type-based operators and the caveat is in the field descriptions instead.

Argument types of the built-in fields

The JSON already has an argument object (required, type), but type was always [] for the built-in fields: they parse their argument by hand and only set EPF_ARG_ALLOWED / EPF_ARG_REQUIRED, so EPF_ARG_INDEX / EPF_ARG_KEY were only ever set for plugin fields. They are now set to match what each parser accepts (fd.types and proc.a*: index, proc.aenv / evt.arg: index or key, proc.env: key, thread.cgroup / evt.rawarg / evt.type.is / evt.abspath: key, evt.around: index). For built-ins the flags are metadata only, so evaluation doesn't change. A test requires every field that supports an argument to declare its type.

Some old fields take the argument as field.argument instead of field[argument] (evt.type.is, evt.arg, evt.rawarg, evt.abspath, thread.cgroup), which a tool building filters can't tell. The new EPF_ARG_DOTTED flag marks them and the JSON reports it as argument.dotted. It is meant for these existing fields only: plugin fields never get it and new fields must use brackets, so a test pins the list of fields allowed to carry it.

{ "name": "evt.type.is", "argument": { "required": true, "type": ["KEY"], "dotted": true } }

Not covered

Chained transformers (len(basename(x))) and the multivalue ones (join, concat, getopt) are not described, and only the fd.* fields and evt.around were audited for custom operator handling.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

Behavior change: evt.around[T] exists and evt.around[T] = anyof (...) used to compile, with a meaningless result, and are now rejected. The error for the other operators is now the generic '<op>' operator not supported for field 'evt.around'.

Tests are in filter_fields_info.ut.cpp: operators by type, list fields, suppressed and enforced operators, transformers, dynamic types, how the compiler treats evt.around, a guard that every mask is a subset of the type-based operators on the real field tables, and a test that evaluates real filters for fd.ip, fd.net, fd.port and fd.proto against a socket event: the operators reported as suppressed must not match (or fail) and the others must match, and the modifiers only compare the first value, so the JSON can't drift from the compare functions.

Does this PR introduce a user-facing change?:

new(libsinsp): `filter_fieldclass_info::as_json()` can list the operators supported by each field (opt-in through `include_operators`), reports the argument type of the built-in fields and flags the ones taking a dotted argument (`argument.dotted`); `evt.around` now rejects every operator but `=` and any modifier when the filter is compiled

filter_fieldclass_info::as_json() can now list, for every field, the
comparison operators the filter compiler accepts, so that tools which
suggest operators (e.g. rule editors) don't have to guess them from the
data type.

It is opt-in through include_operators. Each field gets:
- operators and modifier_operators, derived from flt_is_comparable so
  they follow the compiler's type rules
- suppressed_operators / suppressed_modifier_operators, for operators
  accepted for the type that the field can't use
- transformers: the resulting type and operators for each transformer
  that applies to the field (e.g. len() turns a string into a number)

Fields supporting fewer operators than their type get a mask in
filtercheck_field_info. m_allowed_ops is advisory (fd.ip, fd.net,
fd.port and fd.proto compile other operators but fail or never match
when evaluated). m_enforced_ops is enforced by the compiler: evt.around
only accepts '=', and now rejects exists and modifiers too.

:robot_face: Generated using AI

Co-Authored-By: Paolo Polidori <paolo.polidori@sysdig.com>
Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
@poiana

poiana commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: legobrick
Once this PR has been reviewed and has the lgtm label, please assign mstemm for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.54378% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.51%. Comparing base (f13bc24) to head (961f606).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/test/filter_fields_info.ut.cpp 96.10% 13 Missing ⚠️
...serspace/libsinsp/test/filtercheck_has_args.ut.cpp 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3151      +/-   ##
==========================================
+ Coverage   79.95%   80.51%   +0.55%     
==========================================
  Files         309      309              
  Lines       36550    37031     +481     
  Branches     5190     5222      +32     
==========================================
+ Hits        29223    29814     +591     
+ Misses       7327     7217     -110     
Flag Coverage Δ
libsinsp 80.51% <96.54%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Perf diff from master - unit tests

     2.29%     -1.13%  [.] sinsp_threadinfo::get_main_thread()
     1.09%     +1.12%  [.] thread_group_info::get_first_thread() const
     6.15%     -0.65%  [.] sinsp::next(sinsp_evt**)
     1.33%     -0.51%  [.] sinsp_evt_param::used_legacy_null_encoding() const
     1.59%     -0.44%  [.] std::_Hashtable<conversion_key, std::pair<conversion_key const, conversion_info>, std::allocator<std::pair<conversion_key const, conversion_info> >, std::__detail::_Select1st, std::equal_to<conversion_key>, std::hash<conversion_key>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::find(conversion_key const&) const
     1.47%     -0.40%  [.] read_block_header
     1.39%     -0.32%  [.] sinsp_evt::has_return_value()
     3.62%     -0.28%  [.] convert_event(std::unordered_map<unsigned long, std::shared_ptr<ppm_evt_hdr>, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> > > >&, ppm_evt_hdr*, ppm_evt_hdr*, conversion_info const&, unsigned long, char*)
     0.64%     -0.27%  [.] std::__detail::_Map_base<conversion_key, std::pair<conversion_key const, conversion_info>, std::allocator<std::pair<conversion_key const, conversion_info> >, std::__detail::_Select1st, std::equal_to<conversion_key>, std::hash<conversion_key>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::at(conversion_key const&) const
     3.31%     +0.26%  [.] sinsp_parser::reset(sinsp_evt&) const

Heap diff from master - unit tests

peak heap memory consumption: -5.96K
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: -700B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Overall geomean of the CPU time: -1.2%.

The spread is the coefficient of variation (stddev / mean) of the repetitions. A change is noisy if the spread of either run is above 5%. A benchmark is listed here if the U test p-value of its CPU time is below 0.05.

BM_plugin_field_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
floor 96.9 → 98.3 ms +1.4% 0.67% → 0.50% <0.001
raw_pid 96.6 → 98 ms +1.4% 0.51% → 0.39% <0.001
raw_name 101 → 101 ms +0.6% 0.48% → 0.56% <0.001
evtnum 113 → 114 ms +0.7% 0.59% → 0.43% <0.001
proc_name 120 → 122 ms +1.4% 0.57% → 0.36% <0.001
proc_bool 116 → 116 ms +0.6% 0.44% → 0.33% <0.001
proc_fspath 114 → 113 ms -1.0% 0.50% → 0.65% <0.001
proc_glob 131 → 130 ms -1.3% 0.33% → 0.51% <0.001
proc_in 122 → 119 ms -2.1% 0.48% → 0.41% <0.001
proc_uid 131 → 130 ms -0.8% 0.35% → 0.25% <0.001
proc_pid_x2 120 → 120 ms -0.5% 0.47% → 0.41% 0.005
proc_pid_x8 136 → 136 ms +0.5% 0.30% → 0.48% 0.008
proc_pid_ors_x8 140 → 141 ms +0.9% 0.31% → 0.59% <0.001
proc_pid_deep_x6 136 → 138 ms +1.1% 0.43% → 0.38% <0.001
proc_pid_nots_x4 126 → 127 ms +1.2% 0.31% → 0.26% <0.001
proc_pid_group_x4 125 → 126 ms +0.5% 0.29% → 0.31% <0.001
proc_mixed_x4 147 → 149 ms +1.4% 0.42% → 0.40% <0.001
v3_pid 151 → 147 ms -2.6% 0.25% → 0.24% <0.001
v3_name 157 → 153 ms -2.5% 0.35% → 0.36% <0.001
v3_const 135 → 132 ms -1.9% 0.43% → 0.25% <0.001
v3_ip 135 → 133 ms -1.4% 0.46% → 0.35% <0.001
v3_net 125 → 124 ms -0.7% 0.39% → 0.38% <0.001

BM_walk_dead_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
lazy/0 4721 → 4736 ns +0.3% 0.17% → 0.11% <0.001
lazy/1 4710 → 4724 ns +0.3% 0.14% → 0.15% <0.001
lazy/4 4674 → 4685 ns +0.3% 0.10% → 0.15% <0.001

BM_clone_after_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
dead_ancestors/dead:0/kernel_reaper:0/iterations:300 40294 → 38337 ns -4.9% 0.16% → 0.53% <0.001
dead_ancestors/dead:1/kernel_reaper:0/iterations:300 39347 → 37355 ns -5.1% 0.38% → 0.34% <0.001
dead_ancestors/dead:4/kernel_reaper:0/iterations:300 38333 → 36375 ns -5.1% 0.51% → 0.46% <0.001
dead_ancestors/dead:8/kernel_reaper:0/iterations:300 37063 → 35059 ns -5.4% 0.62% → 0.25% <0.001
dead_ancestors/dead:15/kernel_reaper:0/iterations:300 34258 → 32071 ns -6.4% 0.39% → 0.30% <0.001
dead_ancestors/dead:0/kernel_reaper:1/iterations:300 40216 → 38223 ns -5.0% 0.94% → 0.39% <0.001
dead_ancestors/dead:1/kernel_reaper:1/iterations:300 39577 → 37304 ns -5.7% 0.19% → 0.20% <0.001
dead_ancestors/dead:4/kernel_reaper:1/iterations:300 38494 → 36373 ns -5.5% 0.52% → 0.42% <0.001
dead_ancestors/dead:8/kernel_reaper:1/iterations:300 37075 → 35102 ns -5.3% 0.59% → 0.23% <0.001
dead_ancestors/dead:15/kernel_reaper:1/iterations:300 34444 → 32231 ns -6.4% 0.38% → 0.22% <0.001
fork_exit_chain/dead:0/kernel_reaper:0/iterations:300 29794 → 28083 ns -5.7% 0.51% → 0.36% <0.001
fork_exit_chain/dead:1/kernel_reaper:0/iterations:300 29654 → 27992 ns -5.6% 0.58% → 0.30% <0.001
fork_exit_chain/dead:4/kernel_reaper:0/iterations:300 30118 → 28285 ns -6.1% 0.23% → 0.20% <0.001
fork_exit_chain/dead:8/kernel_reaper:0/iterations:300 30299 → 28550 ns -5.8% 0.96% → 0.42% <0.001
fork_exit_chain/dead:64/kernel_reaper:0/iterations:300 30359 → 28552 ns -6.0% 1.1% → 0.47% <0.001
fork_exit_chain/dead:0/kernel_reaper:1/iterations:300 29784 → 28047 ns -5.8% 0.30% → 0.43% <0.001
fork_exit_chain/dead:1/kernel_reaper:1/iterations:300 29746 → 28018 ns -5.8% 0.39% → 0.42% <0.001
fork_exit_chain/dead:4/kernel_reaper:1/iterations:300 30143 → 28356 ns -5.9% 0.21% → 0.47% <0.001
fork_exit_chain/dead:8/kernel_reaper:1/iterations:300 30281 → 28486 ns -5.9% 0.36% → 0.31% <0.001
fork_exit_chain/dead:64/kernel_reaper:1/iterations:300 30370 → 28665 ns -5.6% 0.51% → 0.34% <0.001

BM_execve_after_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
dead_ancestors/dead:0/kernel_reaper:0/iterations:300 32929 → 32386 ns -1.6% 0.38% → 0.40% <0.001
dead_ancestors/dead:1/kernel_reaper:0/iterations:300 32590 → 31953 ns -2.0% 0.24% → 0.21% <0.001
dead_ancestors/dead:4/kernel_reaper:0/iterations:300 31606 → 30969 ns -2.0% 1.8% → 0.36% <0.001
dead_ancestors/dead:8/kernel_reaper:0/iterations:300 30213 → 30621 ns +1.4% 0.30% → 0.68% <0.001
dead_ancestors/dead:15/kernel_reaper:0/iterations:300 26679 → 27213 ns +2.0% 0.23% → 0.26% <0.001
dead_ancestors/dead:0/kernel_reaper:1/iterations:300 32964 → 33167 ns +0.6% 0.57% → 0.41% <0.001
dead_ancestors/dead:1/kernel_reaper:1/iterations:300 32688 → 32944 ns +0.8% 0.22% → 0.39% <0.001
dead_ancestors/dead:4/kernel_reaper:1/iterations:300 31635 → 31933 ns +0.9% 0.49% → 0.43% <0.001
dead_ancestors/dead:15/kernel_reaper:1/iterations:300 26768 → 26406 ns -1.4% 0.25% → 0.43% <0.001
fork_exit_chain/dead:0/kernel_reaper:0/iterations:300 22758 → 22469 ns -1.3% 0.29% → 0.35% <0.001
fork_exit_chain/dead:1/kernel_reaper:0/iterations:300 23433 → 22808 ns -2.7% 1.1% → 0.41% <0.001
fork_exit_chain/dead:4/kernel_reaper:0/iterations:300 23926 → 23169 ns -3.2% 0.47% → 0.33% <0.001
fork_exit_chain/dead:8/kernel_reaper:0/iterations:300 23582 → 23301 ns -1.2% 1.2% → 0.42% <0.001
fork_exit_chain/dead:64/kernel_reaper:0/iterations:300 23612 → 23377 ns -1.0% 0.68% → 0.37% <0.001
fork_exit_chain/dead:0/kernel_reaper:1/iterations:300 22693 → 22381 ns -1.4% 0.33% → 0.38% <0.001
fork_exit_chain/dead:1/kernel_reaper:1/iterations:300 22996 → 22761 ns -1.0% 0.46% → 0.39% <0.001
fork_exit_chain/dead:4/kernel_reaper:1/iterations:300 23854 → 23155 ns -2.9% 0.91% → 0.30% <0.001
fork_exit_chain/dead:8/kernel_reaper:1/iterations:300 24038 → 23293 ns -3.1% 0.58% → 0.38% <0.001
fork_exit_chain/dead:64/kernel_reaper:1/iterations:300 23660 → 23325 ns -1.4% 0.90% → 0.37% <0.001

BM_sinsp_concatenate_paths_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
relative_path 56.4 → 59.8 ns +6.0% 2.5% → 0.62% <0.001
empty_path 40.3 → 43.8 ns +8.7% 0.05% → 0.04% <0.001
absolute_path 57.2 → 59.1 ns +3.3% 0.70% → 0.37% <0.001
too_long_path 3240 → 3236 ns -0.1% 0.02% → 0.04% <0.001
beyond_scratch 46.5 → 47.3 ns +1.9% 0.03% → 0.53% <0.001

BM_sinsp_utf8_sanitize_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
fast_path_ascii_long 67.8 → 67.8 ns 0.0% 0.05% → 0.04% 0.006
fast_path_multibyte_short 14.2 → 14.8 ns +4.1% 1.9% → 0.40% <0.001
fast_path_mixed_long 2009 → 2074 ns +3.2% 0.09% → 0.71% <0.001
slow_path_c1_controls_long_noalloc 1150 → 1150 ns 0.0% 0.05% → 0.39% 0.003
slow_path_sparse_invalid_long_alloc 243 → 239 ns -1.7% 1.5% → 0.67% 0.003
slow_path_sparse_invalid_long_noalloc 137 → 134 ns -2.3% 0.44% → 0.75% <0.001
slow_path_all_invalid_long_alloc 11921 → 11310 ns -5.1% 0.09% → 0.70% <0.001
slow_path_all_invalid_long_noalloc 11715 → 11110 ns -5.2% 0.09% → 2.3% <0.001

Other

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
BM_walk_full/1 4500 → 4496 ns -0.1% 0.09% → 0.09% 0.001
BM_walk_full/4 4545 → 4556 ns +0.2% 0.11% → 0.15% <0.001
BM_walk_full/16 4722 → 4739 ns +0.4% 0.09% → 0.19% <0.001
BM_walk_full/64 5646 → 5677 ns +0.5% 0.20% → 0.49% <0.001
BM_walk_nth/1 4500 → 4474 ns -0.6% 0.10% → 0.07% <0.001
BM_walk_nth/2 4504 → 4479 ns -0.5% 0.09% → 0.10% <0.001
BM_walk_nth/4 4543 → 4506 ns -0.8% 0.07% → 0.08% <0.001
BM_walk_nth/8 4587 → 4561 ns -0.6% 0.18% → 0.13% <0.001
BM_walk_dead/0 4714 → 4725 ns +0.2% 0.13% → 0.11% <0.001
BM_walk_dead/4 4681 → 4691 ns +0.2% 0.17% → 0.10% <0.001
BM_walk_dead/8 4617 → 4624 ns +0.2% 0.09% → 0.17% 0.008
BM_walk_dead/15 4512 → 4526 ns +0.3% 0.08% → 0.17% <0.001
BM_exit/0/iterations:2000 7012 → 7046 ns +0.5% 0.20% → 0.15% <0.001
BM_exit/100/iterations:2000 7685 → 7557 ns -1.7% 0.63% → 0.46% <0.001
BM_exit/1000/iterations:2000 8417 → 8791 ns +4.4% 1.8% → 2.3% 0.006
BM_sinsp_split 239 → 234 ns -2.2% 0.66% → 0.44% <0.001
14 benchmark(s) with no statistically significant change

BM_plugin_field_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
proc_pid 115 → 115 ms 0.0% 0.56% → 0.43% 0.598
rawarg_int 116 → 116 ms -0.1% 0.46% → 0.26% 0.114
proc_icontains 133 → 134 ms +0.3% 0.47% → 0.45% 0.425
proc_pid_x4 125 → 125 ms -0.1% 0.36% → 0.25% 0.181

BM_walk_dead_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
lazy/8 4619 → 4616 ns -0.1% 0.13% → 0.13% 0.172
lazy/15 4521 → 4521 ns 0.0% 0.10% → 0.14% 0.839

BM_execve_after_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
dead_ancestors/dead:8/kernel_reaper:1/iterations:300 30278 → 30217 ns -0.2% 0.27% → 2.2% 1.000

BM_sinsp_concatenate_paths_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
long_normalizing_path 669 → 669 ns -0.1% 0.23% → 0.26% 0.968

BM_sinsp_utf8_sanitize_*

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
fast_path_ascii_short 17.5 → 17.5 ns 0.0% 0.12% → 0.04% 0.818
fast_path_multibyte_long 5164 → 4863 ns -5.8% 2.9% → 0.03% 0.081
slow_path_c1_controls_long_alloc 1454 → 1454 ns 0.0% (noisy) 10.9% → 6.8% 0.273

Other

Benchmark Median CPU time, master → PR Change Spread (cv) p-value
BM_walk_dead/1 4721 → 4723 ns 0.0% 0.10% → 0.14% 0.337
BM_exit/1/iterations:2000 7018 → 7016 ns 0.0% 0.20% → 0.17% 0.273
BM_exit/10/iterations:2000 7165 → 7156 ns -0.1% 0.18% → 0.23% 0.081

Built-in fields that take an argument (fd.types[0], proc.env[HOME],
thread.cgroup.cpu, evt.arg.fd, ...) only set EPF_ARG_ALLOWED or
EPF_ARG_REQUIRED, never EPF_ARG_INDEX or EPF_ARG_KEY, because they
parse their argument by hand. As a result the JSON field info always
reported an empty argument "type" list for them, while plugin fields
reported it correctly.

Set the flags to match what each parser accepts. They are only
metadata for built-in fields (the generic parsing that reads them is
plugin-only), so evaluation does not change. A test now requires every
field that supports an argument to declare its type.

:robot_face: Generated using AI

Co-Authored-By: Paolo Polidori <paolo.polidori@sysdig.com>
Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
Some old fields take their argument as 'field.argument' instead of 'field[argument]': evt.type.is, evt.arg, evt.rawarg, evt.abspath and thread.cgroup. Tools that build filters from the field list can't tell which syntax to use.

Add EPF_ARG_DOTTED and report it as argument.dotted in the JSON. The flag is meant for these existing fields only: plugin fields never get it and new fields must use brackets. A test lists the fields allowed to carry it, so adding one has to be deliberate.

:robot_face: Generated using AI

Co-Authored-By: Paolo Polidori <paolo.polidori@sysdig.com>
Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
@legobrick legobrick changed the title feat(libsinsp): expose the supported operators of each field in JSON feat(libsinsp): expose the operators and argument types of each field in JSON Nov 9, 2026
proc.env[N] parses a numeric argument but the extraction ignores it and only uses the variable name, so the field must not advertise an index. proc.aenv[N] does use it as the ancestor level.

:robot_face: Generated using AI

Co-Authored-By: Paolo Polidori <paolo.polidori@sysdig.com>
Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
Comment thread userspace/libsinsp/filter_compare.cpp Resolved
:robot_face: Generated using AI

Co-Authored-By: Paolo Polidori <paolo.polidori@sysdig.com>

Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants