mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Use forward declarations of prometheus-cpp types in telemetry::Manager
This commit is contained in:
parent
dd0814c804
commit
9d6ba594b9
2 changed files with 12 additions and 3 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
// CivetServer is from the civetweb submodule in prometheus-cpp
|
// CivetServer is from the civetweb submodule in prometheus-cpp
|
||||||
#include <CivetServer.h>
|
#include <CivetServer.h>
|
||||||
|
#include <prometheus/exposer.h>
|
||||||
|
#include <prometheus/registry.h>
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rapidjson/writer.h>
|
#include <rapidjson/writer.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -25,6 +27,10 @@ namespace zeek::telemetry {
|
||||||
|
|
||||||
Manager::Manager() { prometheus_registry = std::make_shared<prometheus::Registry>(); }
|
Manager::Manager() { prometheus_registry = std::make_shared<prometheus::Registry>(); }
|
||||||
|
|
||||||
|
// This can't be defined as =default because of the use of unique_ptr with a forward-declared type
|
||||||
|
// in Manager.h
|
||||||
|
Manager::~Manager() {}
|
||||||
|
|
||||||
void Manager::InitPostScript() {
|
void Manager::InitPostScript() {
|
||||||
// Metrics port setting is used to calculate a URL for prometheus scraping
|
// Metrics port setting is used to calculate a URL for prometheus scraping
|
||||||
std::string prometheus_url;
|
std::string prometheus_url;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <prometheus/exposer.h>
|
|
||||||
#include <prometheus/registry.h>
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
@ -24,6 +22,11 @@ class RecordVal;
|
||||||
using RecordValPtr = IntrusivePtr<RecordVal>;
|
using RecordValPtr = IntrusivePtr<RecordVal>;
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
||||||
|
namespace prometheus {
|
||||||
|
class Exposer;
|
||||||
|
class Registry;
|
||||||
|
} // namespace prometheus
|
||||||
|
|
||||||
namespace zeek::telemetry {
|
namespace zeek::telemetry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +40,7 @@ public:
|
||||||
|
|
||||||
Manager& operator=(const Manager&) = delete;
|
Manager& operator=(const Manager&) = delete;
|
||||||
|
|
||||||
~Manager() = default;
|
~Manager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization of the manager. This is called late during Zeek's
|
* Initialization of the manager. This is called late during Zeek's
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue