8000 Add 'cpp-statsd-client' package by rbsheth · Pull Request #291 · cpp-pm/hunter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add 'cpp-statsd-client' package #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ hunter_default_version(class_loader VERSION 0.4.1-p0)
hunter_default_version(cmcstl2 VERSION 0.0.0-bee0705e99)
hunter_default_version(convertutf VERSION 1.0.1)
hunter_default_version(corrade VERSION 2019.10)
hunter_default_version(cpp-statsd-client VERSION 1.0.1-42f02b4-p0)
hunter_default_version(cpp_redis VERSION 3.5.0-h1)
hunter_default_version(cppast VERSION 0.0.0-b155d6a-p0)
hunter_default_version(cppcodec VERSION 0.2-p0)
Expand Down
24 changes: 24 additions & 0 deletions cmake/projects/cpp-statsd-client/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

include(hunter_add_version)
include(hunter_cacheable)
include(hunter_download)
include(hunter_pick_scheme)

hunter_add_version(
PACKAGE_NAME
cpp-statsd-client
VERSION
1.0.1-42f02b4-p0
URL
"https://github.com/cpp-pm/cpp-statsd-client/archive/v1.0.1-42f02b4-p0.tar.gz"
SHA1
a94f56a498defe4836f7bf605351924eb9c8e683
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(cpp-statsd-client)
hunter_download(PACKAGE_NAME cpp-statsd-client)
23 changes: 23 additions & 0 deletions docs/packages/pkg/cpp-statsd-client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. spelling::

cpp
statsd
client

.. index::
single: networking ; cpp-statsd-client

.. _pkg.cpp-statsd-client:

cpp-statsd-client
=================

- `Official <https://github.com/vthiery/cpp-statsd-client>`__
- `Hunterized <https://github.com/cpp-pm/cpp-statsd-client>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/cpp-statsd-client/CMakeLists.txt>`__
- Added by `Rahul Sheth <https://github.com/rbsheth>`__ (`pr-291 <https://github.com/cpp-pm/hunter/pull/291>`__)

.. literalinclude:: /../examples/cpp-statsd-client/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
22 changes: 22 additions & 0 deletions examples/cpp-statsd-client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.2)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
BAE4 include("../common.cmake")

project(download-cpp-statsd-client)

# DOCUMENTATION_START {
hunter_add_package(cpp-statsd-client)
find_package(cpp-statsd-client CONFIG REQUIRED)

add_executable(boo boo.cpp)
#For mingw/msys
if(WIN32)
target_compile_definitions(boo PRIVATE _WIN32_WINNT=0x601)
endif()
target_link_libraries(boo PUBLIC cpp-statsd-client::cpp-statsd-client)
# DOCUMENTATION_END }
26 changes: 26 additions & 0 deletions examples/cpp-statsd-client/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <cpp-statsd-client/StatsdClient.hpp>
using namespace Statsd;

int main()
{
// Define the client on localhost, with port 8080, using a prefix and a batching size of 20 bytes
StatsdClient client{ "127.0.0.1", 8080, "myPrefix.", 20 };

// Increment the metric "coco"
client.increment("coco");

// Decrement the metric "kiki"
client.decrement("kiki");

// Adjusts "toto" by +3
client.count("toto", 2, 0.1f);

// Record a gauge "titi" to 3
client.gauge("titi", 3);

// Record a timing of 2ms for "myTiming"
client.timing("myTiming", 2, 0.1f);

// Send a metric explicitly
client.send("tutu", 4, "c", 2.0f);
}
0