-
Notifications
You must be signed in to change notification settings - Fork 1.9k
plugins: add ZeroBus output plugin #11678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mats16
wants to merge
7
commits into
fluent:master
Choose a base branch
from
mats16:feat/out-zerobus
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+913
−0
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0234fe
plugins: add ZeroBus output plugin
mats16 296caf8
refactor: update ZeroBus plugin to require URL scheme for endpoint
mats16 919de56
fix: update ZeroBus plugin for platform compatibility and enhance cod…
mats16 6dbccf7
refactor: simplify URL scheme handling in ZeroBus plugin
mats16 24f796a
feat: add ZeroBus output plugin support and enable by default
mats16 5843a3d
refactor: update ZeroBus FFI CMake configuration for improved library…
mats16 4729836
fix: enhance ZeroBus FFI CMake configuration for library validation
mats16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Set up the ZeroBus FFI prebuilt static library. | ||
| # | ||
| # If ZEROBUS_LIB_DIR is already set by the user, that path is used as-is. | ||
| # Otherwise the official release tarball is downloaded and the correct | ||
| # platform subdirectory is selected automatically. | ||
| # | ||
| # On unsupported platforms or when the download fails, the plugin is | ||
| # disabled automatically (FLB_OUT_ZEROBUS is set to OFF). | ||
| # | ||
| # After this module runs, ZEROBUS_LIB_DIR points to the directory | ||
| # containing libzerobus_ffi.a for the current platform. | ||
|
|
||
| if(ZEROBUS_LIB_DIR) | ||
| return() | ||
| endif() | ||
|
|
||
| set(_ZEROBUS_URL | ||
| "https://github.com/databricks/zerobus-sdk/releases/download/ffi-v1.0.0/zerobus-ffi-1.0.0.tar.gz") | ||
| set(_ZEROBUS_SHA256 | ||
| "c38609f5bddc160b43b35f9047919b35f66375308be69a0d0d6cd20bc01cee5a") | ||
|
|
||
| # Determine the platform subdirectory inside the tarball | ||
| if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
| if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64") | ||
| set(_ZEROBUS_PLATFORM "linux-aarch64") | ||
| elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") | ||
| set(_ZEROBUS_PLATFORM "linux-x86-64") | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else() | ||
| message(STATUS | ||
| "ZeroBus FFI: unsupported Linux architecture '${CMAKE_SYSTEM_PROCESSOR}', " | ||
| "disabling out_zerobus. " | ||
| "To build manually, set -DZEROBUS_LIB_DIR=/path/to/lib.") | ||
| FLB_OPTION(FLB_OUT_ZEROBUS OFF) | ||
| return() | ||
| endif() | ||
| else() | ||
| message(STATUS | ||
| "ZeroBus FFI: no prebuilt library available for ${CMAKE_SYSTEM_NAME}, " | ||
| "disabling out_zerobus. " | ||
| "To build manually, set -DZEROBUS_LIB_DIR=/path/to/lib.") | ||
| FLB_OPTION(FLB_OUT_ZEROBUS OFF) | ||
| return() | ||
| endif() | ||
|
|
||
| # Download the tarball if not already cached | ||
| set(_ZEROBUS_TARBALL "${CMAKE_BINARY_DIR}/zerobus-ffi-1.0.0.tar.gz") | ||
| if(NOT EXISTS "${_ZEROBUS_TARBALL}") | ||
| message(STATUS "ZeroBus FFI: downloading ${_ZEROBUS_URL}") | ||
| file(DOWNLOAD | ||
| "${_ZEROBUS_URL}" | ||
| "${_ZEROBUS_TARBALL}" | ||
| EXPECTED_HASH "SHA256=${_ZEROBUS_SHA256}" | ||
| SHOW_PROGRESS | ||
| STATUS _DOWNLOAD_STATUS | ||
| ) | ||
| list(GET _DOWNLOAD_STATUS 0 _DOWNLOAD_ERROR) | ||
| if(_DOWNLOAD_ERROR) | ||
| message(STATUS | ||
| "ZeroBus FFI: download failed (${_DOWNLOAD_STATUS}), " | ||
| "disabling out_zerobus. " | ||
| "To build manually, set -DZEROBUS_LIB_DIR=/path/to/lib.") | ||
| file(REMOVE "${_ZEROBUS_TARBALL}") | ||
| FLB_OPTION(FLB_OUT_ZEROBUS OFF) | ||
| return() | ||
| endif() | ||
| endif() | ||
|
|
||
| # Extract the tarball | ||
| set(_ZEROBUS_EXTRACT_DIR "${CMAKE_BINARY_DIR}") | ||
| if(NOT EXISTS "${_ZEROBUS_EXTRACT_DIR}/native") | ||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -E tar xzf "${_ZEROBUS_TARBALL}" | ||
| WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" | ||
| RESULT_VARIABLE _EXTRACT_RESULT | ||
| ) | ||
| if(_EXTRACT_RESULT) | ||
| message(STATUS | ||
| "ZeroBus FFI: extraction failed, disabling out_zerobus.") | ||
| FLB_OPTION(FLB_OUT_ZEROBUS OFF) | ||
| return() | ||
| endif() | ||
| endif() | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| set(ZEROBUS_LIB_DIR "${_ZEROBUS_EXTRACT_DIR}/native/${_ZEROBUS_PLATFORM}" | ||
| CACHE PATH "Path to ZeroBus FFI library directory" FORCE) | ||
|
|
||
| if(NOT EXISTS "${ZEROBUS_LIB_DIR}/libzerobus_ffi.a") | ||
| message(STATUS | ||
| "ZeroBus FFI: libzerobus_ffi.a not found at ${ZEROBUS_LIB_DIR}, " | ||
| "disabling out_zerobus.") | ||
| FLB_OPTION(FLB_OUT_ZEROBUS OFF) | ||
| return() | ||
| endif() | ||
|
|
||
| message(STATUS "ZeroBus FFI library: ${ZEROBUS_LIB_DIR}/libzerobus_ffi.a") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| set(src | ||
| zerobus.c) | ||
|
|
||
| FLB_PLUGIN(out_zerobus "${src}" "") | ||
|
|
||
| # ZEROBUS_LIB_DIR is set automatically by cmake/zerobus-ffi.cmake or | ||
| # can be overridden by the user via -DZEROBUS_LIB_DIR=/path/to/lib. | ||
| if(NOT ZEROBUS_LIB_DIR) | ||
| message(FATAL_ERROR | ||
| "ZEROBUS_LIB_DIR is not set. This should not happen when " | ||
| "FLB_OUT_ZEROBUS is ON — check that cmake/zerobus-ffi.cmake is included.") | ||
| endif() | ||
|
|
||
| target_link_libraries(flb-plugin-out_zerobus ${ZEROBUS_LIB_DIR}/libzerobus_ffi.a) | ||
|
|
||
| # Platform-specific linker flags required by the Rust FFI static library | ||
| if(WIN32) | ||
| message(FATAL_ERROR | ||
| "out_zerobus does not support Windows builds. " | ||
| "Disable it with -DFLB_OUT_ZEROBUS=OFF") | ||
| elseif(APPLE) | ||
| target_link_libraries(flb-plugin-out_zerobus | ||
| "-framework CoreFoundation" | ||
| "-framework Security" | ||
| -liconv) | ||
| elseif(UNIX) | ||
| target_link_libraries(flb-plugin-out_zerobus | ||
| -ldl -lpthread -lm -lresolv -lgcc_s) | ||
| endif() | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.