diff --git a/yt/yt/library/profiling/solomon/cube.cpp b/yt/yt/library/profiling/solomon/cube.cpp index 93b54496b..52a106556 100644 --- a/yt/yt/library/profiling/solomon/cube.cpp +++ b/yt/yt/library/profiling/solomon/cube.cpp @@ -435,7 +435,7 @@ int TCube::ReadSensors( }; if constexpr (std::is_same_v || std::is_same_v) { - if (options.ConvertCountersToRateGauge) { + if (options.ConvertCountersToRateGauge || options.ConvertCountersToDeltaGauge) { consumer->OnMetricBegin(NMonitoring::EMetricType::GAUGE); } else { consumer->OnMetricBegin(NMonitoring::EMetricType::RATE); @@ -455,6 +455,12 @@ int TCube::ReadSensors( } else { consumer->OnDouble(time, value.SecondsFloat() / options.RateDenominator); } + } else if (options.ConvertCountersToDeltaGauge) { + if constexpr (std::is_same_v) { + consumer->OnDouble(time, value); + } else { + consumer->OnDouble(time, value.SecondsFloat()); + } } else { // TODO(prime@): RATE is incompatible with windowed read. if constexpr (std::is_same_v) { diff --git a/yt/yt/library/profiling/solomon/cube.h b/yt/yt/library/profiling/solomon/cube.h index 39c638fcc..061ca24bc 100644 --- a/yt/yt/library/profiling/solomon/cube.h +++ b/yt/yt/library/profiling/solomon/cube.h @@ -24,6 +24,7 @@ struct TReadOptions std::function SensorFilter; bool ConvertCountersToRateGauge = false; + bool ConvertCountersToDeltaGauge = false; bool RenameConvertedCounters = true; double RateDenominator = 1.0; bool EnableHistogramCompat = false; diff --git a/yt/yt/library/profiling/solomon/exporter.cpp b/yt/yt/library/profiling/solomon/exporter.cpp index 913fbcfe5..225f7682f 100644 --- a/yt/yt/library/profiling/solomon/exporter.cpp +++ b/yt/yt/library/profiling/solomon/exporter.cpp @@ -79,6 +79,8 @@ void TSolomonExporterConfig::Register(TRegistrar registrar) .Default(true); registrar.Parameter("rename_converted_counters", &TThis::RenameConvertedCounters) .Default(true); + registrar.Parameter("convert_counters_to_delta_gauge", &TThis::ConvertCountersToDeltaGauge) + .Default(false); registrar.Parameter("export_summary", &TThis::ExportSummary) .Default(false); @@ -133,6 +135,12 @@ void TSolomonExporterConfig::Register(TRegistrar registrar) } }); + registrar.Postprocessor([] (TThis* config) { + if (config->ConvertCountersToRateForSolomon && config->ConvertCountersToDeltaGauge) { + THROW_ERROR_EXCEPTION("\"convert_counters_to_rate_for_solomon\" and \"convert_counters_to_delta_gauge\" both set to true"); + } + }); + registrar.Postprocessor([] (TThis* config) { for (const auto& [name, shard] : config->Shards) { if (!shard->GridStep) { @@ -780,6 +788,9 @@ void TSolomonExporter::DoHandleShard( options.RateDenominator = readGridStep->SecondsFloat(); } } + if (Config_->ConvertCountersToDeltaGauge && outputEncodingContext.IsSolomonPull) { + options.ConvertCountersToDeltaGauge = true; + } options.EnableSolomonAggregationWorkaround = outputEncodingContext.IsSolomonPull; options.Times = readWindow; diff --git a/yt/yt/library/profiling/solomon/exporter.h b/yt/yt/library/profiling/solomon/exporter.h index bd4aa8b7e..46bb7f37c 100644 --- a/yt/yt/library/profiling/solomon/exporter.h +++ b/yt/yt/library/profiling/solomon/exporter.h @@ -55,6 +55,7 @@ struct TSolomonExporterConfig bool ConvertCountersToRateForSolomon; bool RenameConvertedCounters; + bool ConvertCountersToDeltaGauge; bool ExportSummary; bool ExportSummaryAsMax;