@@ -116,9 +116,15 @@ namespace NMonitoring {
116
116
class TDecoderUnistat {
117
117
private:
118
118
public:
119
- explicit TDecoderUnistat (IMetricConsumer* consumer, IInputStream* is, TStringBuf metricNameLabel, TInstant ts)
119
+ explicit TDecoderUnistat (
120
+ IMetricConsumer* consumer,
121
+ IInputStream* is,
122
+ TStringBuf metricNameLabel,
123
+ TStringBuf metricNamePrefix,
124
+ TInstant ts)
120
125
: Consumer_{consumer},
121
- MetricNameLabel (metricNameLabel),
126
+ MetricNameLabel_ (metricNameLabel),
127
+ MetricNamePrefix_ (metricNamePrefix),
122
128
Timestamp_{ts} {
123
129
ReadJsonTree (is, &Json_, /* throw */ true );
124
130
}
@@ -252,7 +258,7 @@ namespace NMonitoring {
252
258
Consumer_->OnMetricBegin (MetricContext_.Type );
253
259
254
260
Consumer_->OnLabelsBegin ();
255
- Consumer_->OnLabel (MetricNameLabel, TString{ MetricContext_.Name } );
261
+ Consumer_->OnLabel (MetricNameLabel_, TStringBuilder{} << MetricNamePrefix_ << MetricContext_.Name );
256
262
for (auto && l : MetricContext_.Labels ) {
257
263
Consumer_->OnLabel (l.Name (), l.Value ());
258
264
}
@@ -284,7 +290,8 @@ namespace NMonitoring {
284
290
private:
285
291
IMetricConsumer* Consumer_;
286
292
NJson::TJsonValue Json_;
287
- TStringBuf MetricNameLabel;
293
+ TStringBuf MetricNameLabel_;
294
+ TStringBuf MetricNamePrefix_;
288
295
TInstant Timestamp_;
289
296
290
297
struct {
@@ -299,15 +306,27 @@ namespace NMonitoring {
299
306
300
307
}
301
308
302
- void DecodeUnistat (TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel, TInstant ts) {
303
- c->OnStreamBegin ();
304
- DecodeUnistatToStream (data, c, metricNameLabel, ts);
305
- c->OnStreamEnd ();
309
+ void DecodeUnistat (
310
+ TStringBuf data,
311
+ IMetricConsumer* c,
312
+ TStringBuf metricNameLabel,
313
+ TStringBuf metricNamePrefix,
314
+ TInstant ts)
315
+ {
316
+ c->OnStreamBegin ();
317
+ DecodeUnistatToStream (data, c, metricNameLabel, metricNamePrefix, ts);
318
+ c->OnStreamEnd ();
306
319
}
307
320
308
- void DecodeUnistatToStream (TStringBuf data, IMetricConsumer* c, TStringBuf metricNameLabel, TInstant ts) {
309
- TMemoryInput in{data.data (), data.size ()};
310
- TDecoderUnistat decoder (c, &in, metricNameLabel, ts);
311
- decoder.Decode ();
321
+ void DecodeUnistatToStream (
322
+ TStringBuf data,
323
+ IMetricConsumer* c,
324
+ TStringBuf metricNameLabel,
325
+ TStringBuf metricNamePrefix,
326
+ TInstant ts)
327
+ {
328
+ TMemoryInput in{data.data (), data.size ()};
329
+ TDecoderUnistat decoder (c, &in, metricNameLabel, metricNamePrefix, ts);
330
+ decoder.Decode ();
312
331
}
313
332
}
0 commit comments