All Projects → daedric → commonpp

daedric / commonpp

Licence: BSD-2-Clause license
Small library helping you with basic stuff like getting metrics out of your code, thread naming, etc.

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to commonpp

inspector-metrics
Typescript metrics / monitoring library
Stars: ✭ 19 (-34.48%)
Mutual labels:  counter, influxdb, graphite
Vsphere2metrics
VMware vSphere Performance Metrics Integration with Graphite & InfluxDB
Stars: ✭ 28 (-3.45%)
Mutual labels:  influxdb, graphite
Wizzy
Manage & automate Grafana with easy wizzy
Stars: ✭ 461 (+1489.66%)
Mutual labels:  influxdb, graphite
Influxgraph
Graphite InfluxDB backend. InfluxDB storage finder / plugin for Graphite API.
Stars: ✭ 87 (+200%)
Mutual labels:  influxdb, graphite
Cernan
telemetry aggregation and shipping, last up the ladder
Stars: ✭ 306 (+955.17%)
Mutual labels:  influxdb, graphite
Ceph Dash
Flask based api / dashboard for viewing a ceph clusters overall health status
Stars: ✭ 398 (+1272.41%)
Mutual labels:  influxdb, graphite
Graylog Plugin Metrics Reporter
Graylog Metrics Reporter Plugins
Stars: ✭ 71 (+144.83%)
Mutual labels:  influxdb, graphite
CDT-plusplus
Causal Dynamical Triangulations in C++ using CGAL
Stars: ✭ 49 (+68.97%)
Mutual labels:  boost, tbb
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+6748.28%)
Mutual labels:  influxdb, graphite
Ohmgraphite
Export Open Hardware sensor data to Graphite / InfluxDB / Prometheus / Postgres / Timescaledb
Stars: ✭ 155 (+434.48%)
Mutual labels:  influxdb, graphite
Icingaweb2 Module Grafana
Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
Stars: ✭ 190 (+555.17%)
Mutual labels:  influxdb, graphite
Hastic Server
Hastic data management server for analyzing patterns and anomalies from Grafana
Stars: ✭ 292 (+906.9%)
Mutual labels:  influxdb, graphite
yanic
Yet another node info collector - for respondd to be used with meshviewer to Grafana (with influxdb or graphite)
Stars: ✭ 22 (-24.14%)
Mutual labels:  influxdb, graphite
Victoriametrics
VictoriaMetrics: fast, cost-effective monitoring solution and time series database
Stars: ✭ 5,558 (+19065.52%)
Mutual labels:  influxdb, graphite
request log analyzer
Extract some performance metrics from the request.log of a CQ/AEM instance. It can be used as an alternative to or in addition to `rlog.jar`.
Stars: ✭ 27 (-6.9%)
Mutual labels:  influxdb, graphite
Facette
Time series data visualization software
Stars: ✭ 1,115 (+3744.83%)
Mutual labels:  influxdb, graphite
Icinga2
Icinga is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.
Stars: ✭ 1,670 (+5658.62%)
Mutual labels:  influxdb, graphite
Icinga Vagrant
Vagrant boxes for Icinga 2, Icinga Web 2, modules, themes and integrations (Graphite, InfluxDB, Elastic, Graylog, etc.)
Stars: ✭ 248 (+755.17%)
Mutual labels:  influxdb, graphite
Netdata
Real-time performance monitoring, done right! https://www.netdata.cloud
Stars: ✭ 57,056 (+196644.83%)
Mutual labels:  influxdb, graphite
mongofluxd
Real time sync from MongoDB into InfluxDB
Stars: ✭ 33 (+13.79%)
Mutual labels:  influxdb

Build status

CommonPP

commonpp is a multi purpose library easing very few operations like:

  • Getting metrics out of your program (counter, gauge, statistical description of sample);
  • Naming your threads (and have the custom name appearing in htop, top, gdb);
  • Have a really simple thread pool on top of boost::asio;
  • Quick setup of boost::log;

License

I chose the BSD 2-clause license, so the library can be used in any project, however I'd appreciate any bug fix, pull request and comment.

Dependencies

commonpp depends on Boost and TBB, a C++11 compiler and CMake to be built. It builds on Mac OS X and Linux. It probably build on *BSD but I did not test (yet).

Building

$> make cmake
$> make
$> make test

On windows

commonpp can be built and used on windows. The prefered way is to use vcpkg.

The required dependencies can be installed using the following command:

$> .\vcpkg.exe install boost:x64-windows tbb:x64-windows hwloc:x64-windows

Then you can generate a Visual Studio solution giving the vcpkg toolchain file.

Please note that only VS2017 has been tested. Also, static TBB installation cannot be done, so the DLL will need to be in the path to execute binaries depending on commonpp.

Why?

Although Boost and TBB are very complete low-level libraries, there are still basic features missing, the biggest being getting out metrics out of your code. commonpp will never replace Boost or TBB but instead adds some features that integrate well.

Libraries

Core

The core part is mostly utility functions or class.

  • ExecuteOnScopeExit: executes a callable on scope exit. It can be canceled;
  • LoggingInterface: It is a header containing several logging function on top of boost::log. Every record produced with commonpp is tagged so that it can be used in a project already using boost::log (therefore init_logging should not be called).
  • RandomValuePicker: select a random value in a read only container;
  • FloatingArithmeticTools: Knuth's double comparison functions;
  • Options: an utility class working along with an enum to offer a simple interface to manage options, see the test;
  • There are several string functions to stringify, encode, join, or get a formatted date.

Thread

The thread library is quite small:

  • Thread.hpp contains a function to get/set the current thread name;

  • ThreadPool is a class managing several threads calling the boost::asio::io_service::run member function:

    * It can schedule a callable to be called periodically;
    * It supports several `io_service`;
    * A function can be called on thread startup to setup any thread specific
      data;
    
  • Spinlock: should be obvious

  • ThreadTimer: it allows one to get the load of the current thread. This is experimental;

Metrics

This is the main reason this commonpp exists. I often found myself struggling to get metrics out of my code to monitor performances, behavior, resource usage, etc. Most of the library counters are based on the RRD ones, the ExponentiallyDecayingReservoir is based on the implementation in Codahale as well as the test.

  • Metrics.hpp is the entry point of the metric library; one should use it to register counters;
  • MetricTag: This represents the metadata associated with a counter; for instance if you use Graphite, the tag will be converted in a path (concatenation of all the value separated by a point), if you use InfluxDB, it will be converted in a list of tag;
  • MetricValue: This holds the actual value(s) of a counter.

The counters

There are 3 types of counter:

  • Counter or SharedCounter should be used to represent a value that always increases and never goes back like a request counter. The actual value sent is the rate at which the counter increases. The SharedCounter can be shared among several thread safely.
  • Gauge: It represents an absolute value like a number of active connections.
  • DescStat: Associated with a reservoir, it will describe the distribution of the values, for instance, one can use a reservoir to push the time a function X takes to run, and the StatDesc will give several information like the min, max, variance, quantile, mean, etc.

There is also a helper:

  • TimeScope is an helper to measure the time we spent in the current scope.

Examples

There is a complete example how to use the metric library here

The reservoirs

Currently only one is implemented: ExponentiallyDecayingReservoir. Documentation can be found there.

The sinks

  • Graphite: It sends a list of MetricTag and MetricValue pair in a format understood by Graphite (actually Carbon). As stated before, the values are concatenated to form the metric path, therefore the order used to insert the tag is important.
  • InfluxDB: It sends the measure name along with all the tags and the value as described in the documentation. The MetricTag and MetricValue class were designed with InfluxDB primarely in mind.

Net

This library for now consist in a HTTP request generator and parser and URL encode and decode functions.

Next step

  • Migrate my other project HTTPP to use commonpp;
  • Add tests.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].