Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions cmake/plugins_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ DEFINE_OPTION(FLB_IN_EBPF "Enable Linux eBPF input plugin"
# ==========
DEFINE_OPTION(FLB_PROCESSOR_CONTENT_MODIFIER "Enable content modifier processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_LABELS "Enable metrics label manipulation processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_LOG_SAMPLING "Enable log sampling processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_METRICS_SELECTOR "Enable metrics selector processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_OPENTELEMETRY_ENVELOPE "Enable OpenTelemetry envelope processor" ON)
DEFINE_OPTION(FLB_PROCESSOR_SQL "Enable SQL processor" ON)
Expand Down
1 change: 1 addition & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ REGISTER_IN_PLUGIN("in_random")
# ==========
REGISTER_PROCESSOR_PLUGIN("processor_content_modifier")
REGISTER_PROCESSOR_PLUGIN("processor_labels")
REGISTER_PROCESSOR_PLUGIN("processor_log_sampling")
REGISTER_PROCESSOR_PLUGIN("processor_metrics_selector")
REGISTER_PROCESSOR_PLUGIN("processor_opentelemetry_envelope")
REGISTER_PROCESSOR_PLUGIN("processor_sampling")
Expand Down
1 change: 1 addition & 0 deletions plugins/processor_log_sampling/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Link with libm when needed (pow) to avoid unresolved symbol errors

The implementation calls pow() (see log_sampling.c exponential strategy). On Unix-like systems, that usually requires linking libm. Consider conditionally adding m to deps.

Option A (simple; may fail on non-libm platforms):

-FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
+FLB_PLUGIN(processor_log_sampling "log_sampling.c" "m")

Option B (portable; detects libm presence):

include(CheckLibraryExists)
check_library_exists(m pow "" HAVE_LIBM)
if(HAVE_LIBM)
  FLB_PLUGIN(processor_log_sampling "log_sampling.c" "m")
else()
  FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
endif()

To verify current need for libm and pow usage across the tree, run:


🏁 Script executed:

#!/bin/bash
# Find pow() usage and any explicit -lm linkage in CMake files
rg -n "pow\\(" -g '!build' -S
rg -n --glob '!build' '\-lm| target_link_libraries\\([^)]*\\bm\\b' **/CMakeLists.txt

Length of output: 10968


Link libm for processor_log_sampling (pow used in log_sampling.c)

log_sampling.c calls pow() (plugins/processor_log_sampling/log_sampling.c:154). Add libm to the plugin link on platforms that require it.

Files to change:

  • plugins/processor_log_sampling/log_sampling.c — uses pow()
  • plugins/processor_log_sampling/CMakeLists.txt — update plugin linkage

Recommended (portable) change — detect libm and add "m" only when present:

+ include(CheckLibraryExists)
+ check_library_exists(m pow "" HAVE_LIBM)
+ if(HAVE_LIBM)
- FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
+   FLB_PLUGIN(processor_log_sampling "log_sampling.c" "m")
+ else()
+   FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
+ endif()

Simpler alternative (may be fine on most Unix-like systems):

-FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
+FLB_PLUGIN(processor_log_sampling "log_sampling.c" "m")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
include(CheckLibraryExists)
check_library_exists(m pow "" HAVE_LIBM)
if(HAVE_LIBM)
FLB_PLUGIN(processor_log_sampling "log_sampling.c" "m")
else()
FLB_PLUGIN(processor_log_sampling "log_sampling.c" "")
endif()

Loading
Loading