diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17c9250..99ee176 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,6 +139,44 @@ jobs: build-mdbx/Testing/Temporary/LastTest.log if-no-files-found: ignore + linux-otlp: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - run: git submodule update --init --recursive + - name: Install OTLP build dependencies + run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev + - name: Configure OTLP + run: >- + cmake -S . -B build-otlp + -DLOGIT_CPP_BUILD_TESTS=ON + -DLOGIT_WITH_OTLP=ON + -DLOGIT_USE_SUBMODULES=ON + -DKURLYK_USE_FALLBACK_ASIO=ON + -DKURLYK_USE_FALLBACK_SIMPLE_WS_SERVER=ON + -DKURLYK_AUTH_SUPPORT=OFF + -DKURLYK_OAUTH_SUPPORT=OFF + -DLOGIT_WITH_SYSLOG=OFF + -DLOGIT_WITH_WIN_EVENT_LOG=OFF + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_CXX_STANDARD=17 + - name: Build OTLP tests + run: cmake --build build-otlp --parallel 2 + - name: Run OTLP tests + run: ctest --test-dir build-otlp --output-on-failure -R '^otlp_' + - name: Upload OTLP logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: logs-otlp + path: | + build-otlp/CMakeFiles/CMakeOutput.log + build-otlp/Testing/Temporary/LastTest.log + if-no-files-found: ignore + windows: runs-on: windows-latest strategy: diff --git a/include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp b/include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp index 37861bc..11ea2a5 100644 --- a/include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp +++ b/include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp @@ -10,10 +10,11 @@ #endif #include "ILogger.hpp" -#include "otlp/OtlpCompression.hpp" +#include "otlp/OtlpCompressionType.hpp" #include "otlp/OtlpJsonFormatConfig.hpp" #include "otlp/OtlpJsonSerializer.hpp" #include "otlp/OtlpPayloadSplitter.hpp" +#include #ifndef KURLYK_WEBSOCKET_SUPPORT # define KURLYK_WEBSOCKET_SUPPORT 0 @@ -350,7 +351,7 @@ namespace logit { kurlyk::Headers chunk_headers = headers; if (m_config.compression == OtlpCompression::Gzip) { - if (!compress_string_gzip(chunk, post_content, m_config.compression_level)) { + if (!detail::compress_string_gzip(chunk, post_content, m_config.compression_level)) { // Compression failed: fallback to uncompressed payload. // Count this as a failed export attempt so operators can observe compression issues. m_state->failed_exports.fetch_add(1); @@ -359,7 +360,7 @@ namespace logit { chunk_headers.emplace("Content-Encoding", "gzip"); } } else if (m_config.compression == OtlpCompression::Zstd) { - if (!compress_string_zstd(chunk, post_content, m_config.compression_level)) { + if (!detail::compress_string_zstd(chunk, post_content, m_config.compression_level)) { // Compression failed: fallback to uncompressed payload. // Count this as a failed export attempt so operators can observe compression issues. m_state->failed_exports.fetch_add(1); diff --git a/include/logit_cpp/logit/loggers/otlp/OtlpCompression.hpp b/include/logit_cpp/logit/loggers/otlp/OtlpCompression.hpp deleted file mode 100644 index d6f4d80..0000000 --- a/include/logit_cpp/logit/loggers/otlp/OtlpCompression.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSION_HPP_INCLUDED -#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSION_HPP_INCLUDED - -/// \file OtlpCompression.hpp -/// \brief Backward-compatible forwarding header for shared compression helpers. -/// -/// New code should include `` directly. -/// This header is kept for existing OTLP headers that include it. - -#include "../../detail/CompressionUtils.hpp" - -namespace logit { - -enum class OtlpCompression { None, Gzip, Zstd }; - -// Forward declarations: the actual implementations live in detail:: -using detail::compress_string_gzip; -using detail::compress_string_zstd; - -} // namespace logit - -#endif // LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSION_HPP_INCLUDED diff --git a/include/logit_cpp/logit/loggers/otlp/OtlpCompressionType.hpp b/include/logit_cpp/logit/loggers/otlp/OtlpCompressionType.hpp new file mode 100644 index 0000000..d6c8238 --- /dev/null +++ b/include/logit_cpp/logit/loggers/otlp/OtlpCompressionType.hpp @@ -0,0 +1,20 @@ +#pragma once +#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSIONTYPE_HPP_INCLUDED +#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSIONTYPE_HPP_INCLUDED + +/// \file OtlpCompressionType.hpp +/// \brief Compression algorithm selected for OTLP/HTTP payloads. + +namespace logit { + +/// \enum OtlpCompression +/// \brief Compression algorithm used for an OTLP/HTTP request payload. +enum class OtlpCompression { + None, + Gzip, + Zstd +}; + +} // namespace logit + +#endif // LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_OTLP_OTLPCOMPRESSIONTYPE_HPP_INCLUDED