Skip to content

Commit

Permalink
Fix set_info for Rate Metric (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Parente authored Jan 11, 2023
1 parent 3274caf commit 2c94ae6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Metric

virtual ~Metric() = default;

void set_info(std::string schema_key, std::initializer_list<std::string> names, const std::string &desc)
virtual void set_info(std::string schema_key, std::initializer_list<std::string> names, const std::string &desc)
{
_name.clear();
_name = names;
Expand Down Expand Up @@ -886,8 +886,19 @@ class Rate final : public Metric

void to_json(json &j, bool include_live) const;

void set_info(std::string schema_key, std::initializer_list<std::string> names, const std::string &desc) override
{
_name.clear();
_name = names;
_desc = desc;
_schema_key = schema_key;
_check_names();
_quantile.set_info(schema_key, names, desc);
}

// Metric
void to_json(json &j) const override;

void to_prometheus(std::stringstream &out, Metric::LabelMap add_labels = {}) const override;
void to_opentelemetry(metrics::v1::ScopeMetrics &scope, timespec &start, timespec &end, LabelMap add_labels = {}) const override;
};
Expand Down

0 comments on commit 2c94ae6

Please sign in to comment.