drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::plugin::PromExporter Class Reference

The PromExporter plugin implements a prometheus exporter. The json configuration is as follows: More...

#include <drogon/plugins/PromExporter.h>

Inheritance diagram for drogon::plugin::PromExporter:
Collaboration diagram for drogon::plugin::PromExporter:

Public Member Functions

void initAndStart (const Json::Value &config) override
void shutdown () override
void registerCollector (const std::shared_ptr< drogon::monitoring::CollectorBase > &collector) override
std::shared_ptr< drogon::monitoring::CollectorBase > getCollector (const std::string &name) const noexcept(false)
template<typename T>
std::shared_ptr< drogon::monitoring::Collector< T > > getCollector (const std::string &name) const
Public Member Functions inherited from drogon::PluginBase
void initialize ()
 This method must be called by drogon.
Public Member Functions inherited from drogon::DrObject< PromExporter >
const std::string & className () const override
 Get the class name.
bool isClass (const std::string &class_name) const override
 Return true if the class name is 'class_name'.

Additional Inherited Members

Static Public Member Functions inherited from drogon::DrObject< PromExporter >
static const std::string & classTypeName ()

Detailed Description

The PromExporter plugin implements a prometheus exporter. The json configuration is as follows:

{
"name": "drogon::plugin::PromExporter",
"dependencies": [],
"config": {
// The path of the metrics. the default value is "/metrics".
"path": "/metrics",
// The list of collectors.
"collectors":[
{
// The name of the collector.
"name": "http_requests_total",
// The help message of the collector.
"help": "The total number of http requests",
// The type of the collector. The default value is "counter".
// The other possible value is as following:
// "gauge", "histogram".
"type": "counter",
// The labels of the collector.
"labels": ["method", "status"]
}
]
}
}

Member Function Documentation

◆ initAndStart()

void drogon::plugin::PromExporter::initAndStart ( const Json::Value & config)
overridevirtual

This method must be called by drogon to initialize and start the plugin. It must be implemented by the user.

Implements drogon::PluginBase.

◆ shutdown()

void drogon::plugin::PromExporter::shutdown ( )
inlineoverridevirtual

This method must be called by drogon to shutdown the plugin. It must be implemented by the user.

Implements drogon::PluginBase.


The documentation for this class was generated from the following file: