Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions cmake/plugins_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,63 @@ macro(DEFINE_OPTION option_name description default_value)
if(FLB_MINIMAL)
set(temp_value OFF)
endif()
string(TOLOWER "${FLB_GROUP_OVERRIDE}" group_override)
if(NOT group_override STREQUAL "inherit")
set(temp_value ${FLB_GROUP_OVERRIDE})
endif()

if(temp_value)
set(temp_value ON)
else()
set(temp_value OFF)
endif()

get_property(option_type CACHE ${option_name} PROPERTY TYPE)
if(option_type STREQUAL "UNINITIALIZED")
set(_FLB_PINNED_${option_name} ON CACHE INTERNAL "")
endif()

option(${option_name} "${description}" ${temp_value})

if(NOT DEFINED _FLB_INHERITED_${option_name})
set(_FLB_INHERITED_${option_name} "${${option_name}}" CACHE INTERNAL "")
else()
if(NOT _FLB_PINNED_${option_name} AND
NOT "${${option_name}}" STREQUAL "${_FLB_INHERITED_${option_name}}")
set(_FLB_PINNED_${option_name} ON CACHE INTERNAL "")
endif()
if(NOT _FLB_PINNED_${option_name} AND "${${option_name}}" STREQUAL "${_FLB_INHERITED_${option_name}}")
set(${option_name} ${temp_value} CACHE BOOL "${description}" FORCE)
endif()
set(_FLB_INHERITED_${option_name} ${temp_value} CACHE INTERNAL "")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
endif()
endmacro()

# Add the FLB_MINIMAL option
option(FLB_MINIMAL "Enable minimal build configuration" No)

# Add options to enable/disable plugins at a group granularity
set(FLB_ALL_INPUTS "Inherit" CACHE STRING "Enable/Disable all Input plugins (On, Off, Inherit)")
set(FLB_ALL_PROCESSORS "Inherit" CACHE STRING "Enable/Disable all Processor plugins (On, Off, Inherit)")
set(FLB_ALL_FILTERS "Inherit" CACHE STRING "Enable/Disable all Filter plugins (On, Off, Inherit)")
set(FLB_ALL_OUTPUTS "Inherit" CACHE STRING "Enable/Disable all Output plugins (On, Off, Inherit)")
Comment on lines +42 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply group settings after Windows defaults

On Windows with the default FLB_WINDOWS_DEFAULTS=On, these new controls do not govern most inputs, outputs, or filters: CMakeLists.txt:441-444 includes cmake/windows-setup.cmake later, whose lines 51-143 unconditionally reset many individual plugin variables. Consequently, for example, a fresh -DFLB_ALL_INPUTS=Off configuration still enables the default Windows inputs, while On still leaves several inputs disabled. Apply the group override after the platform defaults or make those defaults respect the selected group value.

AGENTS.md reference: AGENTS.md:L11-L15

Useful? React with 👍 / 👎.

set_property(CACHE FLB_ALL_INPUTS PROPERTY STRINGS "On;Off;Inherit")
set_property(CACHE FLB_ALL_PROCESSORS PROPERTY STRINGS "On;Off;Inherit")
set_property(CACHE FLB_ALL_FILTERS PROPERTY STRINGS "On;Off;Inherit")
set_property(CACHE FLB_ALL_OUTPUTS PROPERTY STRINGS "On;Off;Inherit")
Comment thread
coderabbitai[bot] marked this conversation as resolved.

foreach(group_option FLB_ALL_INPUTS FLB_ALL_PROCESSORS FLB_ALL_FILTERS FLB_ALL_OUTPUTS)
string(TOLOWER "${${group_option}}" group_value)
if(NOT group_value MATCHES "^(on|off|inherit)$")
message(FATAL_ERROR
"${group_option} must be one of On, Off or Inherit "
"(got '${${group_option}}')")
endif()
endforeach()

# Inputs (sources, data collectors)
# =================================
set(FLB_GROUP_OVERRIDE ${FLB_ALL_INPUTS})
DEFINE_OPTION(FLB_IN_BLOB "Enable Blob input plugin" ON)
DEFINE_OPTION(FLB_IN_CALYPTIA_FLEET "Enable Calyptia Fleet input plugin" ON)
DEFINE_OPTION(FLB_IN_COLLECTD "Enable Collectd input plugin" ON)
Expand Down Expand Up @@ -70,6 +119,7 @@ DEFINE_OPTION(FLB_IN_EBPF "Enable Linux eBPF input plugin"

# Processors
# ==========
set(FLB_GROUP_OVERRIDE ${FLB_ALL_PROCESSORS})
DEFINE_OPTION(FLB_PROCESSOR_CONTENT_MODIFIER "Enable content modifier processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_CUMULATIVE_TO_DELTA "Enable cumulative to delta metrics processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_LABELS "Enable metrics label manipulation processor" ON)
Expand All @@ -81,6 +131,7 @@ DEFINE_OPTION(FLB_PROCESSOR_TDA "Enable TDA processor"

# Filters
# =======
set(FLB_GROUP_OVERRIDE ${FLB_ALL_FILTERS})
DEFINE_OPTION(FLB_FILTER_ALTER_SIZE "Enable alter_size filter" ON)
DEFINE_OPTION(FLB_FILTER_AWS "Enable aws filter" ON)
DEFINE_OPTION(FLB_FILTER_CHECKLIST "Enable checklist filter" ON)
Expand Down Expand Up @@ -108,6 +159,7 @@ DEFINE_OPTION(FLB_FILTER_WASM "Enable WASM filter"

# Outputs (destinations)
# ======================
set(FLB_GROUP_OVERRIDE ${FLB_ALL_OUTPUTS})
DEFINE_OPTION(FLB_OUT_AZURE "Enable Azure output plugin" ON)
DEFINE_OPTION(FLB_OUT_AZURE_BLOB "Enable Azure output plugin" ON)
DEFINE_OPTION(FLB_OUT_AZURE_KUSTO "Enable Azure Kusto output plugin" ON)
Expand Down Expand Up @@ -156,3 +208,5 @@ DEFINE_OPTION(FLB_OUT_TCP "Enable TCP output plugin"
DEFINE_OPTION(FLB_OUT_UDP "Enable UDP output plugin" ON)
DEFINE_OPTION(FLB_OUT_VIVO_EXPORTER "Enable Vivo exporter output plugin" ON)
DEFINE_OPTION(FLB_OUT_WEBSOCKET "Enable Websocket output plugin" ON)

unset(FLB_GROUP_OVERRIDE)