Skip to content

Commit

Permalink
Datadog logging (#375)
Browse files Browse the repository at this point in the history
* Add datadog logging.  Fix some log levels.  Minor fixes

* use browser ingest

* fix tests

* fix ci bug

* fix ci

* add openssl include
  • Loading branch information
MisterTea committed Jan 6, 2021
1 parent da43a44 commit e88afbf
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 56 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ openssh-server
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ openssh-server
- checkout
- run:
name: Set up ssh & known_hosts
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ openssh-server
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ openssh-server
- checkout
- run:
name: Set up ssh & known_hosts
Expand All @@ -72,7 +72,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
- checkout
- run:
name: Init submodules
Expand All @@ -92,7 +92,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
- checkout
- run:
name: Init submodules
Expand All @@ -112,7 +112,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
- checkout
- run:
name: Init submodules
Expand All @@ -132,7 +132,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: apt-get update; apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
command: apt-get update; apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
- checkout
- run:
name: Init submodules
Expand All @@ -152,14 +152,14 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: brew remove python@2; brew upgrade python; brew install cmake; brew install protobuf libsodium gflags
command: brew remove python@2; brew upgrade python; brew install cmake; brew install openssl protobuf libsodium gflags
- checkout
- run:
name: Init submodules
command: if [ $CIRCLE_BRANCH != "release" ]; then git submodule update --init --recursive; fi
- run:
name: Build the project with test
command: mkdir build; cd build; cmake -DSANITIZE_THREAD=ON ../; make -j4
command: mkdir build; cd build; cmake -DSANITIZE_THREAD=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ../; make -j4
- run:
name: Run tests
command: cd build; ./et-test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
Expand All @@ -43,7 +43,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
Expand All @@ -70,7 +70,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
Expand All @@ -97,7 +97,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo apt-get install -y libssl-dev libcurl4-openssl-dev libunwind-dev git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: |
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake; brew install protobuf libsodium
brew install cmake; brew install openssl protobuf libsodium
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git submodule update --init --force --recursive
Expand All @@ -24,7 +24,7 @@ jobs:
run: |
mkdir build
pushd build
cmake -DSANITIZE_UNDEFINED=ON ../
cmake -DSANITIZE_UNDEFINED=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ../
make -j`nproc`
./et-test
popd
Expand All @@ -43,13 +43,13 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake; brew install protobuf libsodium
brew install cmake; brew install openssl protobuf libsodium
- name: Test with asan
run: |
mkdir build
pushd build
cmake -DSANITIZE_ADDRESS=ON ../
cmake -DSANITIZE_ADDRESS=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ../
make -j`nproc`
./et-test
popd
Expand All @@ -68,13 +68,13 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake; brew install protobuf libsodium
brew install cmake; brew install openssl protobuf libsodium
- name: Test with msan
run: |
mkdir build
pushd build
cmake -DSANITIZE_MEMORY=ON ../
cmake -DSANITIZE_MEMORY=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ../
make -j`nproc`
./et-test
popd
Expand All @@ -93,13 +93,13 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake; brew install protobuf libsodium
brew install cmake; brew install openssl protobuf libsodium
- name: Test with tsan
run: |
mkdir build
pushd build
cmake -DSANITIZE_THREAD=ON -DSANITIZE_LINK_STATIC=ON ../
cmake -DSANITIZE_THREAD=ON -DSANITIZE_LINK_STATIC=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ../
make -j`nproc`
./et-test
popd
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "external/sentry-native"]
path = external/sentry-native
url = https://github.com/getsentry/sentry-native.git
[submodule "external/cpp-httplib"]
path = external/cpp-httplib
url = https://github.com/yhirose/cpp-httplib.git
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
cmake_minimum_required (VERSION 3.0.2)

IF(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "")
ENDIF()

project (EternalTCP VERSION 6.0.13)

include(CMakeFindDependencyMacro)
Expand All @@ -8,10 +13,12 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})

# Required packages
find_package(OpenSSL REQUIRED)
FIND_PACKAGE(Sanitizers REQUIRED)
find_package(Threads REQUIRED)
find_package(sodium REQUIRED)
find_package(Protobuf REQUIRED)
find_package(ZLIB REQUIRED)

# Optional packages
find_package(UTempter)
Expand Down Expand Up @@ -119,17 +126,17 @@ add_custom_target(
)

IF(ANDROID)
set(CORE_LIBRARIES util)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB util)
ELSEIF(FREEBSD)
set(CORE_LIBRARIES util execinfo)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB util execinfo)
ELSEIF(NETBSD)
set(CORE_LIBRARIES util resolv execinfo)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB util resolv execinfo)
ELSEIF(WIN32)
set(CORE_LIBRARIES Ws2_32 Shlwapi dbghelp)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB Ws2_32 Shlwapi dbghelp)
ELSEIF(APPLE)
set(CORE_LIBRARIES util resolv)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB util resolv)
ELSE()
set(CORE_LIBRARIES unwind util resolv)
set(CORE_LIBRARIES OpenSSL::SSL ZLIB::ZLIB unwind util resolv)
ENDIF()

MACRO(DECORATE_TARGET TARGET_NAME)
Expand All @@ -149,6 +156,7 @@ include_directories(
external/cxxopts/include
external/msgpack-c/include
external/sentry-native/include
external/cpp-httplib
src/base
src/terminal
src/terminal/forwarding
Expand All @@ -160,6 +168,7 @@ include_directories(
${sodium_INCLUDE_DIR}
${SELINUX_INCLUDE_DIR}
${UTEMPTER_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)

IF(NOT ANDROID)
Expand Down
1 change: 1 addition & 0 deletions external/cpp-httplib
Submodule cpp-httplib added at 3f88a4
2 changes: 1 addition & 1 deletion external/msgpack-c
Submodule msgpack-c updated 119 files
5 changes: 5 additions & 0 deletions src/base/Headers.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#ifndef __ET_HEADERS__
#define __ET_HEADERS__

#define CPPHTTPLIB_ZLIB_SUPPORT (1)
#define CPPHTTPLIB_OPENSSL_SUPPORT (1)
// httplib has to come before windows.h
#include "httplib.h"

#if __FreeBSD__
#define _WITH_GETLINE
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/base/TcpSocketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int TcpSocketHandler::connect(const SocketEndpoint &endpoint) {
}
}
if (sockFd == -1) {
STERROR << "ERROR, no host found";
LOG(INFO) << "No host found";
} else {
initSocket(sockFd);
addToActiveSockets(sockFd);
Expand Down
3 changes: 2 additions & 1 deletion src/base/UnixSocketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ ssize_t UnixSocketHandler::read(int fd, void *buf, size_t count) {
#endif
auto localErrno = errno;
if (readBytes < 0 && localErrno != EAGAIN && localErrno != EWOULDBLOCK) {
STERROR << "Error reading: " << localErrno << " " << strerror(localErrno);
LOG(WARNING) << "Error reading: " << localErrno << " "
<< strerror(localErrno);
}
errno = localErrno;
return readBytes;
Expand Down
Loading

0 comments on commit e88afbf

Please sign in to comment.