Export the traces using gzip format

This commit is contained in:
emeric
2024-04-05 14:10:02 +02:00
parent 8438da9fde
commit aff46065b0
5 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(Filesystem REQUIRED) find_package(Filesystem REQUIRED)
find_package(Boost REQUIRED COMPONENTS system program_options) find_package(Boost REQUIRED COMPONENTS system program_options iostreams)
find_package(Wt REQUIRED COMPONENTS Wt Dbo DboSqlite3 HTTP) find_package(Wt REQUIRED COMPONENTS Wt Dbo DboSqlite3 HTTP)
pkg_check_modules(Taglib REQUIRED IMPORTED_TARGET taglib) pkg_check_modules(Taglib REQUIRED IMPORTED_TARGET taglib)
pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++) pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
+1
View File
@@ -147,6 +147,7 @@ ARG RUNTIME_PACKAGES=" \
lame-libs \ lame-libs \
zlib \ zlib \
boost-filesystem \ boost-filesystem \
boost-iostreams \
boost-program_options \ boost-program_options \
boost-system \ boost-system \
boost-thread \ boost-thread \
-1
View File
@@ -174,4 +174,3 @@ namespace lms::db::utils
Wt::WDateTime normalizeDateTime(const Wt::WDateTime& dateTime); Wt::WDateTime normalizeDateTime(const Wt::WDateTime& dateTime);
} }
+3 -2
View File
@@ -58,6 +58,9 @@ target_include_directories(lms PRIVATE
) )
target_link_libraries(lms PRIVATE target_link_libraries(lms PRIVATE
Boost::iostreams
Wt::Wt
Wt::HTTP
lmsav lmsav
lmsauth lmsauth
lmsdatabase lmsdatabase
@@ -68,8 +71,6 @@ target_link_libraries(lms PRIVATE
lmsservice-cover lmsservice-cover
lmssubsonic lmssubsonic
lmscore lmscore
Wt::Wt
Wt::HTTP
) )
install(TARGETS lms DESTINATION bin) install(TARGETS lms DESTINATION bin)
+11 -3
View File
@@ -19,6 +19,9 @@
#include "TracingView.hpp" #include "TracingView.hpp"
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <Wt/Http/Response.h> #include <Wt/Http/Response.h>
#include <Wt/WDateTime.h> #include <Wt/WDateTime.h>
#include <Wt/WPushButton.h> #include <Wt/WPushButton.h>
@@ -46,9 +49,14 @@ namespace lms::ui
void handleRequest(const Wt::Http::Request&, Wt::Http::Response& response) void handleRequest(const Wt::Http::Request&, Wt::Http::Response& response)
{ {
suggestFileName(core::stringUtils::toISO8601String(Wt::WDateTime::currentDateTime()) + "-traces.json"); response.setMimeType("application/gzip");
response.setMimeType("application/json"); suggestFileName(core::stringUtils::toISO8601String(Wt::WDateTime::currentDateTime()) + "-traces.json.gz");
_traceLogger.dumpCurrentBuffer(response.out());
boost::iostreams::filtering_ostream gzipStream;
gzipStream.push(boost::iostreams::gzip_compressor{});
gzipStream.push(response.out());
_traceLogger.dumpCurrentBuffer(gzipStream);
} }
private: private: