Telemetry framework: move BIFs to the primary-bif stage

This moves the Telemetry framework's BIF-defined functionalit from the
secondary-BIFs stage to the primary one. That is, this functionality is now
available from the end of init-bare.zeek, not only after the end of
init-frameworks-and-bifs.zeek.

This allows us to use script-layer telemetry in our Zeek's own code that get
pulled in during init-frameworks-and-bifs.

This change splits up the BIF features into functions, constants, and types,
because that's the granularity most workable in Func.cc and NetVar. It also now
defines the Telemetry::MetricsType enum once, not redundantly in BIFs and script
layer.

Due to subtle load ordering issues between the telemetry and cluster frameworks
this pushes the redef stage of Telemetry::metrics_port and address into
base/frameworks/telemetry/options.zeek, which is loaded sufficiently late in
init-frameworks-and-bifs.zeek to sidestep those issues. (When not doing this,
the effect is that the redef in telemetry/main.zeek doesn't yet find the
cluster-provided values, and Zeek does not end up listening on these ports.)

The need to add basic Zeek headers in script_opt/ZAM/ZBody.cc as a side-effect
of this is curious, but looks harmless.

Also includes baseline updates for the usual btests and adds a few doc strings.

(cherry picked from commit 71f7e89974)
This commit is contained in:
Christian Kreibich 2024-10-17 15:25:24 -07:00
parent 5503688758
commit 2ad80f8fb2
20 changed files with 99 additions and 63 deletions

View file

@ -24,6 +24,8 @@ scripts/base/init-bare.zeek
build/scripts/base/bif/plugins/Zeek_SNMP.types.bif.zeek
build/scripts/base/bif/plugins/Zeek_KRB.types.bif.zeek
build/scripts/base/bif/event.bif.zeek
build/scripts/base/bif/telemetry_functions.bif.zeek
build/scripts/base/bif/telemetry_types.bif.zeek
scripts/base/packet-protocols/__load__.zeek
scripts/base/packet-protocols/main.zeek
scripts/base/frameworks/analyzer/main.zeek
@ -146,8 +148,7 @@ scripts/base/init-frameworks-and-bifs.zeek
scripts/base/frameworks/files/magic/__load__.zeek
scripts/base/frameworks/telemetry/options.zeek
build/scripts/base/bif/__load__.zeek
build/scripts/base/bif/consts.bif.zeek
build/scripts/base/bif/telemetry.bif.zeek
build/scripts/base/bif/telemetry_consts.bif.zeek
build/scripts/base/bif/zeekygen.bif.zeek
build/scripts/base/bif/pcap.bif.zeek
build/scripts/base/bif/bloom-filter.bif.zeek