Skip to content

Commit d6a2528

Browse files
authored
Merge pull request #9970 from Icinga/2142backport
Log HTTP request processing time and ship Boost 1.84 on Windows
2 parents 37d9ae7 + fd5f3c5 commit d6a2528

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

doc/21-development.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -477,18 +477,18 @@ File Type: EXECUTABLE IMAGE
477477
478478
Image has the following dependencies:
479479
480-
boost_coroutine-vc142-mt-gd-x64-1_83.dll
481-
boost_date_time-vc142-mt-gd-x64-1_83.dll
482-
boost_filesystem-vc142-mt-gd-x64-1_83.dll
483-
boost_thread-vc142-mt-gd-x64-1_83.dll
484-
boost_regex-vc142-mt-gd-x64-1_83.dll
480+
boost_coroutine-vc142-mt-gd-x64-1_84.dll
481+
boost_date_time-vc142-mt-gd-x64-1_84.dll
482+
boost_filesystem-vc142-mt-gd-x64-1_84.dll
483+
boost_thread-vc142-mt-gd-x64-1_84.dll
484+
boost_regex-vc142-mt-gd-x64-1_84.dll
485485
libssl-3_0-x64.dll
486486
libcrypto-3_0-x64.dll
487487
WS2_32.dll
488488
dbghelp.dll
489489
SHLWAPI.dll
490490
msi.dll
491-
boost_unit_test_framework-vc142-mt-gd-x64-1_83.dll
491+
boost_unit_test_framework-vc142-mt-gd-x64-1_84.dll
492492
KERNEL32.dll
493493
SHELL32.dll
494494
ADVAPI32.dll
@@ -1763,7 +1763,7 @@ mkdir build
17631763
cd .\build\
17641764
17651765
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" `
1766-
-DICINGA2_UNITY_BUILD=OFF -DBoost_INCLUDE_DIR=C:\local\boost_1_83_0-Win64 `
1766+
-DICINGA2_UNITY_BUILD=OFF -DBoost_INCLUDE_DIR=C:\local\boost_1_84_0-Win64 `
17671767
-DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe `
17681768
-DFLEX_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe ..
17691769
@@ -1935,29 +1935,29 @@ Download the [boost-binaries](https://sourceforge.net/projects/boost/files/boost
19351935
- 64 for 64 bit builds
19361936

19371937
```
1938-
https://sourceforge.net/projects/boost/files/boost-binaries/1.82.0/boost_1_83_0-msvc-14.2-64.exe/download
1938+
https://sourceforge.net/projects/boost/files/boost-binaries/1.82.0/boost_1_84_0-msvc-14.2-64.exe/download
19391939
```
19401940

1941-
Run the installer and leave the default installation path in `C:\local\boost_1_83_0`.
1941+
Run the installer and leave the default installation path in `C:\local\boost_1_84_0`.
19421942

19431943

19441944
##### Source & Compile
19451945

19461946
In order to use the boost development header and library files you need to [download](https://www.boost.org/users/download/)
1947-
Boost and then extract it to e.g. `C:\local\boost_1_83_0`.
1947+
Boost and then extract it to e.g. `C:\local\boost_1_84_0`.
19481948

19491949
> **Note**
19501950
>
19511951
> Just use `C:\local`, the zip file already contains the sub folder. Extraction takes a while,
19521952
> the archive contains more than 70k files.
19531953
19541954
In order to integrate Boost into Visual Studio, open the `Developer Command Prompt` from the start menu,
1955-
and navigate to `C:\local\boost_1_83_0`.
1955+
and navigate to `C:\local\boost_1_84_0`.
19561956

19571957
Execute `bootstrap.bat` first.
19581958

19591959
```
1960-
cd C:\local\boost_1_83_0
1960+
cd C:\local\boost_1_84_0
19611961
bootstrap.bat
19621962
```
19631963

@@ -2040,8 +2040,8 @@ You need to specify the previously installed component paths.
20402040

20412041
Variable | Value | Description
20422042
----------------------|----------------------------------------------------------------------|-------------------------------------------------------
2043-
`BOOST_ROOT` | `C:\local\boost_1_83_0` | Root path where you've extracted and compiled Boost.
2044-
`BOOST_LIBRARYDIR` | Binary: `C:\local\boost_1_83_0\lib64-msvc-14.2`, Source: `C:\local\boost_1_83_0\stage` | Path to the static compiled Boost libraries, directory must contain `lib`.
2043+
`BOOST_ROOT` | `C:\local\boost_1_84_0` | Root path where you've extracted and compiled Boost.
2044+
`BOOST_LIBRARYDIR` | Binary: `C:\local\boost_1_84_0\lib64-msvc-14.2`, Source: `C:\local\boost_1_84_0\stage` | Path to the static compiled Boost libraries, directory must contain `lib`.
20452045
`BISON_EXECUTABLE` | `C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe` | Path to the Bison executable.
20462046
`FLEX_EXECUTABLE` | `C:\ProgramData\chocolatey\lib\winflexbison\tools\win_flex.exe` | Path to the Flex executable.
20472047
`ICINGA2_UNITY_BUILD` | OFF | Disable unity builds for development environments.
@@ -2076,8 +2076,8 @@ $env:ICINGA2_INSTALLPATH = 'C:\Program Files\Icinga2-debug'
20762076
$env:ICINGA2_BUILDPATH='debug'
20772077
$env:CMAKE_BUILD_TYPE='Debug'
20782078
$env:OPENSSL_ROOT_DIR='C:\OpenSSL-Win64'
2079-
$env:BOOST_ROOT='C:\local\boost_1_83_0'
2080-
$env:BOOST_LIBRARYDIR='C:\local\boost_1_83_0\lib64-msvc-14.2'
2079+
$env:BOOST_ROOT='C:\local\boost_1_84_0'
2080+
$env:BOOST_LIBRARYDIR='C:\local\boost_1_84_0\lib64-msvc-14.2'
20812081
```
20822082

20832083
#### Icinga 2 in Visual Studio

doc/win-dev.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function ThrowOnNativeFailure {
1313

1414
$VsVersion = 2019
1515
$MsvcVersion = '14.2'
16-
$BoostVersion = @(1, 83, 0)
16+
$BoostVersion = @(1, 84, 0)
1717
$OpensslVersion = '3_0_12'
1818

1919
switch ($Env:BITS) {

lib/remote/httpserverconnection.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "base/timer.hpp"
1919
#include "base/tlsstream.hpp"
2020
#include "base/utility.hpp"
21+
#include <chrono>
2122
#include <limits>
2223
#include <memory>
2324
#include <stdexcept>
@@ -493,6 +494,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
493494
{
494495
namespace beast = boost::beast;
495496
namespace http = beast::http;
497+
namespace ch = std::chrono;
496498

497499
try {
498500
/* Do not reset the buffer in the state machine.
@@ -518,6 +520,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
518520
}
519521

520522
m_Seen = Utility::GetTime();
523+
auto start (ch::steady_clock::now());
521524

522525
auto& request (parser.get());
523526

@@ -541,13 +544,14 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
541544

542545
Log logMsg (LogInformation, "HttpServerConnection");
543546

544-
logMsg << "Request: " << request.method_string() << ' ' << request.target()
547+
logMsg << "Request " << request.method_string() << ' ' << request.target()
545548
<< " (from " << m_PeerAddress
546549
<< "), user: " << (authenticatedUser ? authenticatedUser->GetName() : "<unauthenticated>")
547550
<< ", agent: " << request[http::field::user_agent]; //operator[] - Returns the value for a field, or "" if it does not exist.
548551

549-
Defer addRespCode ([&response, &logMsg]() {
550-
logMsg << ", status: " << response.result() << ").";
552+
Defer addRespCode ([&response, start, &logMsg]() {
553+
logMsg << ", status: " << response.result() << ") took "
554+
<< ch::duration_cast<ch::milliseconds>(ch::steady_clock::now() - start).count() << "ms.";
551555
});
552556

553557
if (!HandleAccessControl(*m_Stream, request, response, yc)) {

tools/win32/configure-dev.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
3131
$env:OPENSSL_ROOT_DIR = 'c:\local\OpenSSL-Win64'
3232
}
3333
if (-not (Test-Path env:BOOST_ROOT)) {
34-
$env:BOOST_ROOT = 'c:\local\boost_1_83_0'
34+
$env:BOOST_ROOT = 'c:\local\boost_1_84_0'
3535
}
3636
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
37-
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_83_0\lib64-msvc-14.2'
37+
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_84_0\lib64-msvc-14.2'
3838
}
3939
if (-not (Test-Path env:FLEX_BINARY)) {
4040
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'

tools/win32/configure.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
3333
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_3_0_12-Win${env:BITS}"
3434
}
3535
if (-not (Test-Path env:BOOST_ROOT)) {
36-
$env:BOOST_ROOT = "c:\local\boost_1_83_0-Win${env:BITS}"
36+
$env:BOOST_ROOT = "c:\local\boost_1_84_0-Win${env:BITS}"
3737
}
3838
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
39-
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_83_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
39+
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_84_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
4040
}
4141
if (-not (Test-Path env:FLEX_BINARY)) {
4242
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'

0 commit comments

Comments
 (0)