blob: b25c2d5db48491f712a799189d97bb443a411ffc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* @class storage::StatusMetricConsumer
* @ingroup common
*
* @brief Writes metrics to status page.
*/
#pragma once
#include "storagecomponent.h"
#include <vespa/storageframework/generic/status/statusreporter.h>
#include <vespa/vespalib/util/jsonstream.h>
namespace vespalib { class StringTokenizer; }
namespace metrics { class MetricManager; }
namespace storage {
class StatusMetricConsumer : public framework::StatusReporter,
private vespalib::JsonStreamTypes
{
public:
StatusMetricConsumer(StorageComponentRegister&, metrics::MetricManager&, const std::string& name = "status");
~StatusMetricConsumer() override;
// Metric reporting requires the "vespa.content.metrics_api" capability
CapabilitySet required_capabilities() const noexcept override {
return CapabilitySet::of({ Capability::content_metrics_api() });
}
vespalib::string getReportContentType(const framework::HttpUrlPath&) const override;
bool reportStatus(std::ostream& out, const framework::HttpUrlPath&) const override;
private:
metrics::MetricManager& _manager;
StorageComponent _component;
std::string _name;
mutable std::mutex _lock;
};
} // storage
|