prometheus exporter using workflow HTTP server

Overview

wfprometheus

This is a light prometheus exporter using workflow HTTP server. This project is currently in the development stage, and the first version will be released soon.

Installation

Make sure you have already installed Workflow

make

Now you can run the default example by:

./build.make/example

Check by yourself

The default port is 8080 and the path to collect is /metrics:

curl localhost:8080/metrics

may get the following data, which is consistent with Prometheus data model.

# HELP workflow_metrics_count help info 1
# TYPE workflow_metrics_count gauge
workflow_metrics_count 79
# HELP request_method help info 2
# TYPE request_method counter
request_method{method="POST"} 150
request_method{method="GET"} 75

Check by Prometheus

Run a Prometheus and collect the metrics data:

workflow-prometheus

Easy demo

It`s very simple to make your own Exporter, try it !!!

increase(); task->get_resp()->append_output_body(VarsGlobal::expose()); }); if (server.start(8080) == 0) { getchar(); server.stop(); } return 0; } ">
using namespace prometheus;                                                        
                                                                                   
int main()                                                                         
{                                                                                  
    GaugeVars<int> gauge("workflow_metrics_count", "help info");                   
                                                                                   
    WFHttpServer server([](WFHttpTask *task) {                                     
        VarsLocal::var("workflow_metrics_count")->increase();                      
        task->get_resp()->append_output_body(VarsGlobal::expose());                
    });                                                                            
                                                                                   
    if (server.start(8080) == 0)                                                   
    {                                                                              
        getchar();                                                                 
        server.stop();                                                             
    }                                                                              
                                                                                   
    return 0;                                                                      
} 
You might also like...
A C++ header-only HTTP/HTTPS server and client library
A C++ header-only HTTP/HTTPS server and client library

cpp-httplib A C++11 single-file header-only cross platform HTTP/HTTPS library. It's extremely easy to setup. Just include the httplib.h file in your c

Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

C++ library for creating an embedded Rest HTTP server (and more)

The libhttpserver reference manual Tl;dr libhttpserver is a C++ library for building high performance RESTful web servers. libhttpserver is built upon

Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket,  MQTT built-in protocols, async DNS resolver, and non-blocking API.
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

cherry: A Minimal HTTP Server
cherry: A Minimal HTTP Server

cherry: A Minimal HTTP Server Inspired by the Capriccio project and the Zaver HTTP server, cherry started out as an experimental project trying to inc

http server code by c
http server code by c

Lamphttp HTTP服务 Lamphttp是使用c语言实现的http服务,目前市面上有非常多的http服务,比如大名鼎鼎的Nginx 那么对于Lamphttp存在的意义是什么呢?对于Lamphttp主要是为了理解了tcp/ip到http的中间 这一层的实现,说白了就是当作学习用的. 虽然Lam

Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

kleinsHTTP: A stupid stupidly simple http server.

kleinsHTTP: A stupid stupidly simple http server. About I wanted to create an api server using C++ as it is my favorite language however i was unable

websocket and http client and server library, coming with ws, a command line swiss army knife utility

Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use an

Comments
  • Support Summary

    Support Summary

    Support Summary and some update

    • Support Summary with template<double> temporarily;
    • Fix the release of vars;
    • Update some codes;

    1. Create

    VarFactory::create_summary<double>("response_body_size", "help info 4", {{0.5, 0.05}, {0.9, 0.01}});
    

    2. Usage

    VarFactory::summary<double>("response_body_size")->observe(body.length());
    

    3. Collect

    # HELP response_body_size help info 4
    # TYPE response_body_size summary
    response_body_size{quantile="0.500000"} 3872.000000
    response_body_size{quantile="0.900000"} 3872.000000
    response_body_size_sum 3872.000000
    response_body_size_count 5
    

    ( P.S. This example will get the response with the same value and just for test.)

    opened by holmes1412 0
  • change project name to wf-prometheus and add Histogram

    change project name to wf-prometheus and add Histogram

    Support Histogram.

    1. Create

    VarFactory::create_histogram<double>("request_latency", "help info 3", {0.1, 1.0, 10.0});
    

    2. Usage

    VarFactory::histogram<double>("request_latency")->observe(REQUEST_COST);/* 0.1, 0.2, ...*/
    

    3. Collect

    Prometheus will get the following data model in example exporter:

    # HELP request_latency help info 3
    # TYPE request_latency histogram
    request_latency_bucket{le="0.100000"} 2
    request_latency_bucket{le="1.000000"} 4
    request_latency_bucket{le="10.000000"} 23
    request_latency_bucket{le="+Inf"} 23
    request_latency_sum 117.000000
    request_latency_count 23
    
    opened by holmes1412 0
Owner
Sogou Open Source
Sogou Open Source
A collection of C++ HTTP libraries including an easy to use HTTP server.

Proxygen: Facebook's C++ HTTP Libraries This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis fo

Facebook 7.7k Jan 4, 2023
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.2k Jan 2, 2023
Gromox - Groupware server backend with MAPI/HTTP, RPC/HTTP, IMAP, POP3 and PHP-MAPI support for grommunio

Gromox is the central groupware server component of grommunio. It is capable of serving as a replacement for Microsoft Exchange and compatibles. Conne

grommunio 139 Dec 26, 2022
A project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server.

PS4 Server 9.00 This is a project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server. this is fo

null 14 Nov 28, 2022
RPC based on C++ Workflow. Supports Baidu bRPC, Tencent tRPC, thrift protocols.

中文版入口 SRPC Introduction SRPC is an RPC system developed by Sogou. Its main features include: Base on Sogou C++ Workflow, with the following features:

C++ Workflow Project and Ecosystem 1.5k Jan 3, 2023
Tiny HTTP Server on C, using only standard libraries

hell_o Linux only. Tiny HTTP Server on C, using only standard libraries. It is unfinished yet, going to add working interface and rewrite handler late

null 3 Feb 1, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.4k Dec 23, 2022
tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)

PicoHTTPParser Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari PicoHTTPParser is a tiny, primitive, fast HTTP r

H2O 1.6k Jan 1, 2023
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 29 Dec 17, 2022
Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Stiffstream 924 Jan 6, 2023