[SERVER-67333] ServerStatusMetric API refresh follow-up Created: 16/Jun/22  Updated: 01/Jul/22  Resolved: 01/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Daniel Morilha (Inactive) Assignee: Daniel Morilha (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-65987 ServerStatusMetric API refresh Closed
Related
related to SERVER-67647 Potentially optimize mongo::MetricTre... Open
related to SERVER-67644 Certain ServerStatusMetricFields can ... Closed
Operating System: ALL
Sprint: Service Arch 2022-06-27, Service Arch 2022-07-11
Participants:

 Description   

During development, I've received the following idea it might be interesting to pursue as a follow-up to the work which has already been done in SERVER-65987.

The argument for it is that the produced version was verbose and may lead to errors. Here's the link for the complete discussion.

/**
 * Mostly can be declarad and used wherever and however
 * a `Counter64` can be used, but it's backed by a metric.
 */
class CounterMetric {
public:
    CounterMetric(std::string name)
        : _counter{makeServerStatusCounter(std::move(name)).value()} {}
    CounterMetric(CounterMetric&) = delete;
    CounterMetric& operator=(CounterMetric&) = delete;
 
    operator Counter64& () { return _counter; }
 
    void increment() { return _counter.increment(); }  // + other common ops.
 
private:
    Counter64& _counter;
};


Generated at Thu Feb 08 06:07:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.