mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 20:48:21 +00:00
Fix race condition by pre-building the cluster json data for services.json
This commit is contained in:
parent
00b24b043a
commit
f55c0a5292
2 changed files with 11 additions and 8 deletions
|
@ -200,7 +200,7 @@ public:
|
|||
* @return A JSON description of the cluster configuration for reporting
|
||||
* to Prometheus for service discovery requests.
|
||||
*/
|
||||
std::string GetClusterJson() const;
|
||||
std::string GetClusterJson() const { return cluster_json; }
|
||||
|
||||
/**
|
||||
* @return The pointer to the prometheus-cpp registry used by the telemetry
|
||||
|
@ -230,6 +230,7 @@ protected:
|
|||
|
||||
private:
|
||||
RecordValPtr GetMetricOptsRecord(const prometheus::MetricFamily& metric_family);
|
||||
void BuildClusterJson();
|
||||
|
||||
std::map<std::string, std::shared_ptr<MetricFamily>> families;
|
||||
std::map<std::string, RecordValPtr> opts_records;
|
||||
|
@ -242,11 +243,10 @@ private:
|
|||
GaugePtr cpu_gauge;
|
||||
GaugePtr fds_gauge;
|
||||
|
||||
std::string endpoint_name;
|
||||
std::vector<std::string> export_prefixes;
|
||||
|
||||
std::shared_ptr<prometheus::Registry> prometheus_registry;
|
||||
std::unique_ptr<prometheus::Exposer> prometheus_exposer;
|
||||
|
||||
std::string cluster_json;
|
||||
};
|
||||
|
||||
} // namespace zeek::telemetry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue