aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/prometheus
diff options
context:
space:
mode:
authorgusev-p <gusev-p@yandex-team.ru>2022-02-10 16:47:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:20 +0300
commit47af3b5bf148ddab250833ec454d30d7c4930c31 (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/monlib/encode/prometheus
parent1715700d00b30399d3648be821fd585ae552365e (diff)
downloadydb-47af3b5bf148ddab250833ec454d30d7c4930c31.tar.gz
Restoring authorship annotation for <gusev-p@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/prometheus')
-rw-r--r--library/cpp/monlib/encode/prometheus/prometheus.h4
-rw-r--r--library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp16
-rw-r--r--library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp14
3 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/monlib/encode/prometheus/prometheus.h b/library/cpp/monlib/encode/prometheus/prometheus.h
index 21248f5fef..2e7fa31c28 100644
--- a/library/cpp/monlib/encode/prometheus/prometheus.h
+++ b/library/cpp/monlib/encode/prometheus/prometheus.h
@@ -11,8 +11,8 @@ namespace NMonitoring {
class TPrometheusDecodeException: public yexception {
};
- IMetricEncoderPtr EncoderPrometheus(IOutputStream* out, TStringBuf metricNameLabel = "sensor");
+ IMetricEncoderPtr EncoderPrometheus(IOutputStream* out, TStringBuf metricNameLabel = "sensor");
- void DecodePrometheus(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel = "sensor");
+ void DecodePrometheus(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel = "sensor");
}
diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
index 5dc0bc8033..7e81357dbd 100644
--- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
+++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
@@ -168,10 +168,10 @@ namespace NMonitoring {
///////////////////////////////////////////////////////////////////////
class TPrometheusReader {
public:
- TPrometheusReader(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel)
+ TPrometheusReader(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel)
: Data_(data)
, Consumer_(c)
- , MetricNameLabel_(metricNameLabel)
+ , MetricNameLabel_(metricNameLabel)
{
}
@@ -516,12 +516,12 @@ namespace NMonitoring {
}
void ConsumeLabels(TStringBuf name, const TLabelsMap& labels) {
- Y_PARSER_ENSURE(labels.count(MetricNameLabel_) == 0,
- "label name '" << MetricNameLabel_ <<
+ Y_PARSER_ENSURE(labels.count(MetricNameLabel_) == 0,
+ "label name '" << MetricNameLabel_ <<
"' is reserved, but is used with metric: " << name << LabelsToStr(labels));
Consumer_->OnLabelsBegin();
- Consumer_->OnLabel(MetricNameLabel_, TString(name)); // TODO: remove this string allocation
+ Consumer_->OnLabel(MetricNameLabel_, TString(name)); // TODO: remove this string allocation
for (const auto& it: labels) {
Consumer_->OnLabel(it.first, it.second);
}
@@ -579,7 +579,7 @@ namespace NMonitoring {
private:
TStringBuf Data_;
IMetricConsumer* Consumer_;
- TStringBuf MetricNameLabel_;
+ TStringBuf MetricNameLabel_;
THashMap<TString, EPrometheusMetricType> SeenTypes_;
THistogramBuilder HistogramBuilder_;
@@ -589,8 +589,8 @@ namespace NMonitoring {
};
} // namespace
-void DecodePrometheus(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel) {
- TPrometheusReader reader(data, c, metricNameLabel);
+void DecodePrometheus(TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel) {
+ TPrometheusReader reader(data, c, metricNameLabel);
reader.Read();
}
diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
index c370fd2b6e..15efeb8c03 100644
--- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
+++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
@@ -249,9 +249,9 @@ namespace NMonitoring {
///////////////////////////////////////////////////////////////////////
class TPrometheusEncoder final: public IMetricEncoder {
public:
- explicit TPrometheusEncoder(IOutputStream* out, TStringBuf metricNameLabel)
+ explicit TPrometheusEncoder(IOutputStream* out, TStringBuf metricNameLabel)
: Writer_(out)
- , MetricNameLabel_(metricNameLabel)
+ , MetricNameLabel_(metricNameLabel)
{
}
@@ -358,10 +358,10 @@ namespace NMonitoring {
MetricState_.Labels.Add(l.Name(), l.Value());
}
- TMaybe<TLabel> nameLabel = MetricState_.Labels.Extract(MetricNameLabel_);
+ TMaybe<TLabel> nameLabel = MetricState_.Labels.Extract(MetricNameLabel_);
Y_ENSURE(nameLabel,
"labels " << MetricState_.Labels <<
- " does not contain label '" << MetricNameLabel_ << '\'');
+ " does not contain label '" << MetricNameLabel_ << '\'');
const TString& metricName = ToString(nameLabel->Value());
if (MetricState_.Type != EMetricType::DSUMMARY) {
@@ -399,15 +399,15 @@ namespace NMonitoring {
private:
TEncoderState State_;
TPrometheusWriter Writer_;
- TString MetricNameLabel_;
+ TString MetricNameLabel_;
TInstant CommonTime_ = TInstant::Zero();
TLabels CommonLabels_;
TMetricState MetricState_;
};
}
- IMetricEncoderPtr EncoderPrometheus(IOutputStream* out, TStringBuf metricNameLabel) {
- return MakeHolder<TPrometheusEncoder>(out, metricNameLabel);
+ IMetricEncoderPtr EncoderPrometheus(IOutputStream* out, TStringBuf metricNameLabel) {
+ return MakeHolder<TPrometheusEncoder>(out, metricNameLabel);
}
} // namespace NMonitoring