Skip to content

Commit

Permalink
Drop HTTP transport (#124)
Browse files Browse the repository at this point in the history
* Drop HTTP transport

* Use Ubunty xenial in travis
  • Loading branch information
awegrzyn authored Feb 20, 2019
1 parent 0779ac9 commit 1eb5b6c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 233 deletions.
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
sudo: required
language: cpp
dist: trusty
matrix:
allow_failures:
- os: linux
Expand All @@ -15,6 +14,7 @@ matrix:
osx_image: xcode10
env: TOOL=test
- os: linux
dist: xenial
env: TOOL=test
addons:
apt:
Expand All @@ -24,11 +24,12 @@ matrix:
- gcc-8
- g++-8
- cmake
- libboost-system1.55-dev
- libboost-filesystem1.55-dev
- libboost-test1.55-dev
- libboost-program-options1.55-dev
- libboost-system1.58-dev
- libboost-filesystem1.58-dev
- libboost-test1.58-dev
- libboost-program-options1.58-dev
- os: linux
dist: xenial
env: TOOL=coverage
addons:
apt:
Expand All @@ -44,10 +45,10 @@ matrix:
- doxygen-latex
- doxygen-gui
- graphviz
- libboost-system1.55-dev
- libboost-filesystem1.55-dev
- libboost-test1.55-dev
- libboost-program-options1.55-dev
- libboost-system1.58-dev
- libboost-filesystem1.58-dev
- libboost-test1.58-dev
- libboost-program-options1.58-dev
branches:
only:
- dev
Expand Down
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(Boost REQUIRED COMPONENTS unit_test_framework program_options system filesystem)
find_package(Git QUIET)
find_package(ApMon MODULE)
find_package(CURL REQUIRED MODULE)


####################################
Expand All @@ -77,7 +76,6 @@ set(SRCS
src/MonitoringFactory.cxx
src/Transports/UDP.cxx
src/Transports/TCP.cxx
src/Transports/HTTP.cxx
src/Transports/Unix.cxx
src/Exceptions/MonitoringException.cxx
)
Expand All @@ -86,7 +84,7 @@ set(SRCS
message(STATUS "Backends")
message(STATUS " Compiling StdCout backend")
message(STATUS " Compiling Flume UDP/JSON backend")
message(STATUS " Compiling InfluxDB HTTP and UDP backend")
message(STATUS " Compiling InfluxDB backend with Unix socket and UDP transport")

# Create library
add_library(Monitoring SHARED ${SRCS} $<$<BOOL:${ApMon_FOUND}>:src/Backends/ApMonBackend.cxx>)
Expand All @@ -104,7 +102,6 @@ target_link_libraries(Monitoring
Boost::boost
PRIVATE
Boost::system
CURL::CURL
$<$<BOOL:${ApMon_FOUND}>:ApMon::ApMon>
)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ See table below to find out how to create `URI` for each backend:
| Backend name | Transport | URI backend[-protocol] | URI query | Default verbosity |
| ------------ |:-----------:|:----------------------:|:----------:| -----------------:|
| InfluxDB | HTTP | `influxdb-http` | `?db=<db>` | `info` |
| No-op | - | `no-op` | | - |
| InfluxDB | UDP | `influxdb-udp` | - | `info` |
| InfluxDB | Unix socket | `influxdb-unix` | - | `info` |
| ApMon | UDP | `apmon` | - | `info` |
| StdOut | - | `stdout`, `infologger` | - | `debug` |
| StdOut | - | `stdout`, `infologger` | [Prefix] | `debug` |
| Flume | UDP | `flume` | - | `info` |
##### StdCout output format
Expand Down
67 changes: 0 additions & 67 deletions cmake/FindCURL.cmake

This file was deleted.

10 changes: 0 additions & 10 deletions src/Backends/InfluxDB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <boost/lexical_cast.hpp>
#include <string>
#include "../Transports/UDP.h"
#include "../Transports/HTTP.h"
#include "../Transports/Unix.h"
#include "../Exceptions/MonitoringException.h"

Expand All @@ -27,15 +26,6 @@ InfluxDB::InfluxDB(const std::string& host, unsigned int port) :
<< " ("<< host << ":" << port << ")" << MonLogger::End();
}

InfluxDB::InfluxDB(const std::string& host, unsigned int port, const std::string& search)
{
mTransport = std::make_unique<transports::HTTP>(
"http://" + host + ":" + std::to_string(port) + "/write?" + search
);
MonLogger::Get() << "InfluxDB/HTTP backend initialized" << " (" << "http://" << host
<< ":" << std::to_string(port) << "/write?" << search << ")" << MonLogger::End();
}

InfluxDB::InfluxDB(const std::string& socketPath) :
mTransport(std::make_unique<transports::Unix>(socketPath))
{
Expand Down
7 changes: 1 addition & 6 deletions src/Backends/InfluxDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ class InfluxDB final : public Backend
/// \param port InfluxDB UDP endpoint port number
InfluxDB(const std::string& host, unsigned int port);

/// Constructor for HTTP transport
/// \param host InfluxDB HTTP endpoint hostname
/// \param port InfluxDB HTTP endpoint port number
/// \param path Query search providing database name
InfluxDB(const std::string& host, unsigned int port, const std::string& search);

/// Constructor for Unix socket transport
InfluxDB(const std::string& socketPath);

/// Default destructor
Expand Down
4 changes: 0 additions & 4 deletions src/MonitoringFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ std::unique_ptr<Backend> getInfluxDb(http::url uri) {
if (uri.protocol == "udp") {
return std::make_unique<backends::InfluxDB>(uri.host, uri.port);
}
if (uri.protocol == "http") {
return std::make_unique<backends::InfluxDB>(uri.host, uri.port, uri.search);
}
if (uri.protocol == "unix") {
std::string path = uri.path;;
auto found = std::find_if(begin(verbosities), end(verbosities),
Expand Down Expand Up @@ -99,7 +96,6 @@ std::unique_ptr<Backend> MonitoringFactory::GetBackend(std::string& url) {
{"infologger", getStdOut},
{"stdout", getStdOut},
{"influxdb-udp", getInfluxDb},
{"influxdb-http", getInfluxDb},
{"influxdb-unix", getInfluxDb},
{"apmon", getApMon},
{"flume", getFlume},
Expand Down
70 changes: 0 additions & 70 deletions src/Transports/HTTP.cxx

This file was deleted.

59 changes: 0 additions & 59 deletions src/Transports/HTTP.h

This file was deleted.

4 changes: 2 additions & 2 deletions test/testMonitoringFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ BOOST_AUTO_TEST_CASE(verbosity)
auto influxDebug = Monitoring::GetBackend(influxDebugUrl);
BOOST_CHECK_EQUAL(static_cast<std::underlying_type<Verbosity>::type>(influxDebug->getVerbosity()), 2);

std::string influxHttpUrl = "influxdb-http://127.0.0.1:1234/?db=test";
auto influxHttp = Monitoring::GetBackend(influxHttpUrl);
std::string influxUnixUrl = "influxdb-unix://127.0.0.1:1234/?db=test";
auto influxHttp = Monitoring::GetBackend(influxUnixUrl);

std::string ilProdUrl = "stdout:///info";
auto ilProd = Monitoring::GetBackend(ilProdUrl);
Expand Down

0 comments on commit 1eb5b6c

Please sign in to comment.