mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
832 B
C++
41 lines
832 B
C++
5 years ago
|
#ifndef LLARP_METRICS_JSON_PUBLISHER_HPP
|
||
|
#define LLARP_METRICS_JSON_PUBLISHER_HPP
|
||
6 years ago
|
|
||
5 years ago
|
#include <util/fs.hpp>
|
||
5 years ago
|
#include <util/metrics/core.hpp>
|
||
6 years ago
|
|
||
5 years ago
|
#include <nlohmann/json.hpp>
|
||
6 years ago
|
|
||
5 years ago
|
#include <functional>
|
||
6 years ago
|
#include <iosfwd>
|
||
5 years ago
|
#include <utility>
|
||
6 years ago
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
namespace metrics
|
||
|
{
|
||
6 years ago
|
class JsonPublisher final : public Publisher
|
||
|
{
|
||
|
public:
|
||
|
using PublishFunction = std::function< void(const nlohmann::json&) >;
|
||
|
|
||
|
private:
|
||
|
PublishFunction m_publish;
|
||
|
|
||
|
public:
|
||
5 years ago
|
JsonPublisher(PublishFunction publish) : m_publish(std::move(publish))
|
||
6 years ago
|
{
|
||
|
}
|
||
|
|
||
5 years ago
|
~JsonPublisher() override = default;
|
||
6 years ago
|
|
||
|
void
|
||
|
publish(const Sample& values) override;
|
||
|
|
||
|
static void
|
||
6 years ago
|
directoryPublisher(const nlohmann::json& result, const fs::path& path);
|
||
6 years ago
|
};
|
||
6 years ago
|
} // namespace metrics
|
||
|
} // namespace llarp
|
||
|
#endif
|