aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-11-20 12:26:01 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-11-20 12:43:17 +0300
commit878e26057d11cce46b7bc3a6c838209d4686e28b (patch)
treea0f4616feb52ed3ce0b0e0048fbfd5ac329c881b
parent2d3e35f925595c445a0ff7405eda6c5ed162ab98 (diff)
downloadydb-878e26057d11cce46b7bc3a6c838209d4686e28b.tar.gz
Intermediate changes
commit_hash:c2908947ab85dde6631ac29f6d9fbf43bbb2648d
-rw-r--r--yt/yt/core/rpc/grpc/channel.cpp9
-rw-r--r--yt/yt/core/rpc/grpc/channel.h16
-rw-r--r--yt/yt/core/rpc/grpc/public.h2
-rw-r--r--yt/yt/library/profiling/solomon/cube.cpp8
-rw-r--r--yt/yt/library/profiling/solomon/cube.h1
-rw-r--r--yt/yt/library/profiling/solomon/exporter.cpp11
-rw-r--r--yt/yt/library/profiling/solomon/exporter.h1
7 files changed, 44 insertions, 4 deletions
diff --git a/yt/yt/core/rpc/grpc/channel.cpp b/yt/yt/core/rpc/grpc/channel.cpp
index 81a17d4d01..b6ea1fd384 100644
--- a/yt/yt/core/rpc/grpc/channel.cpp
+++ b/yt/yt/core/rpc/grpc/channel.cpp
@@ -126,7 +126,7 @@ DEFINE_ENUM(EClientCallStage,
);
class TChannel
- : public IChannel
+ : public NYT::NRpc::NGrpc::IGrpcChannel
{
public:
explicit TChannel(TChannelConfigPtr config)
@@ -221,6 +221,11 @@ public:
return MemoryUsageTracker_;
}
+ grpc_connectivity_state CheckConnectivityState(bool tryToConnect) override
+ {
+ return grpc_channel_check_connectivity_state(Channel_.Unwrap(), tryToConnect);
+ }
+
private:
const TChannelConfigPtr Config_;
const TString EndpointAddress_;
@@ -736,7 +741,7 @@ public:
} // namespace
-IChannelPtr CreateGrpcChannel(TChannelConfigPtr config)
+IGrpcChannelPtr CreateGrpcChannel(TChannelConfigPtr config)
{
return New<TChannel>(std::move(config));
}
diff --git a/yt/yt/core/rpc/grpc/channel.h b/yt/yt/core/rpc/grpc/channel.h
index 1a11b35254..9e5c08f655 100644
--- a/yt/yt/core/rpc/grpc/channel.h
+++ b/yt/yt/core/rpc/grpc/channel.h
@@ -3,13 +3,27 @@
#include "public.h"
#include <yt/yt/core/rpc/public.h>
+#include <yt/yt/core/rpc/channel.h>
+
+#include <contrib/libs/grpc/include/grpc/impl/connectivity_state.h>
namespace NYT::NRpc::NGrpc {
////////////////////////////////////////////////////////////////////////////////
+struct IGrpcChannel
+ : public NRpc::IChannel
+{
+public:
+ virtual grpc_connectivity_state CheckConnectivityState(bool tryToConnect) = 0;
+};
+
+DEFINE_REFCOUNTED_TYPE(IGrpcChannel)
+
+////////////////////////////////////////////////////////////////////////////////
+
//! Creates a channel implemented via GRPC.
-NRpc::IChannelPtr CreateGrpcChannel(TChannelConfigPtr config);
+IGrpcChannelPtr CreateGrpcChannel(TChannelConfigPtr config);
//! Returns the factory for creating GRPC channels.
NRpc::IChannelFactoryPtr GetGrpcChannelFactory();
diff --git a/yt/yt/core/rpc/grpc/public.h b/yt/yt/core/rpc/grpc/public.h
index a34e2e768a..7cb846bf33 100644
--- a/yt/yt/core/rpc/grpc/public.h
+++ b/yt/yt/core/rpc/grpc/public.h
@@ -15,6 +15,8 @@ DECLARE_REFCOUNTED_CLASS(TChannelCredentialsConfig)
DECLARE_REFCOUNTED_CLASS(TChannelConfigTemplate)
DECLARE_REFCOUNTED_CLASS(TChannelConfig)
+DECLARE_REFCOUNTED_STRUCT(IGrpcChannel)
+
////////////////////////////////////////////////////////////////////////////////
extern const char* const TracingTraceIdMetadataKey;
diff --git a/yt/yt/library/profiling/solomon/cube.cpp b/yt/yt/library/profiling/solomon/cube.cpp
index 93b54496b2..52a106556f 100644
--- a/yt/yt/library/profiling/solomon/cube.cpp
+++ b/yt/yt/library/profiling/solomon/cube.cpp
@@ -435,7 +435,7 @@ int TCube<T>::ReadSensors(
};
if constexpr (std::is_same_v<T, i64> || std::is_same_v<T, TDuration>) {
- 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<T>::ReadSensors(
} else {
consumer->OnDouble(time, value.SecondsFloat() / options.RateDenominator);
}
+ } else if (options.ConvertCountersToDeltaGauge) {
+ if constexpr (std::is_same_v<T, i64>) {
+ 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<T, i64>) {
diff --git a/yt/yt/library/profiling/solomon/cube.h b/yt/yt/library/profiling/solomon/cube.h
index 39c638fcc0..061ca24bc1 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<bool(const std::string&)> 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 913fbcfe55..225f7682ff 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);
@@ -134,6 +136,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) {
continue;
@@ -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 bd4aa8b7ea..46bb7f37cb 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;