Skip to content
Merged
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
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <logit/detail/CompressionUtils.hpp>

#ifndef KURLYK_WEBSOCKET_SUPPORT
# define KURLYK_WEBSOCKET_SUPPORT 0
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
23 changes: 0 additions & 23 deletions include/logit_cpp/logit/loggers/otlp/OtlpCompression.hpp

This file was deleted.

20 changes: 20 additions & 0 deletions include/logit_cpp/logit/loggers/otlp/OtlpCompressionType.hpp
Original file line number Diff line number Diff line change
@@ -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
Loading