1
1
#include " shard_impl.h"
2
2
#include " log.h"
3
+ #include < library/cpp/json/json_writer.h>
3
4
4
5
namespace NKikimr {
5
6
namespace NGraph {
@@ -102,7 +103,7 @@ class TTxMonitoring : public TTransactionBase<TGraphShard> {
102
103
if (wasLine) {
103
104
html << " <br>" ;
104
105
}
105
- html << " arithmetic " << name << " " << value.ValueA << " " << value.Op << " " << value.ValueB ;
106
+ html << " arithmetic " << name << " " << value.ValueA << " " << value.Op << " " << value.ValueB ;
106
107
wasLine = true ;
107
108
}
108
109
html << " </td></tr>" ;
@@ -113,6 +114,45 @@ class TTxMonitoring : public TTransactionBase<TGraphShard> {
113
114
}
114
115
};
115
116
117
+ class TTxMonitoringGetSettings : public TTransactionBase <TGraphShard> {
118
+ private:
119
+ NMon::TEvRemoteHttpInfo::TPtr Event;
120
+
121
+ public:
122
+ TTxMonitoringGetSettings (TGraphShard* shard, NMon::TEvRemoteHttpInfo::TPtr ev)
123
+ : TBase(shard)
124
+ , Event(std::move(ev))
125
+ {}
126
+
127
+ TTxType GetTxType () const override { return NGraphShard::TXTYPE_MONITORING; }
128
+
129
+ bool Execute (TTransactionContext&, const TActorContext&) override {
130
+ BLOG_D (" TTxMonitoringGetSettings::Execute" );
131
+ return true ;
132
+ }
133
+
134
+ void Complete (const TActorContext& ctx) override {
135
+ BLOG_D (" TTxMonitoringGetSettings::Complete" );
136
+ NJson::TJsonValue json;
137
+ switch (Self->BackendType ) {
138
+ case EBackendType::Memory:
139
+ json[" backend" ] = " Memory" ;
140
+ json[" metrics_size" ] = Self->MemoryBackend .MetricsIndex .size ();
141
+ json[" records_size" ] = Self->MemoryBackend .MetricsValues .size ();
142
+ break ;
143
+ case EBackendType::Local:
144
+ json[" backend" ] = " Local" ;
145
+ json[" metrics_size" ] = Self->LocalBackend .MetricsIndex .size ();
146
+ break ;
147
+ case EBackendType::External:
148
+ json[" backend" ] = " External" ;
149
+ break ;
150
+ }
151
+ ctx.Send (Event->Sender , new NMon::TEvRemoteJsonInfoRes (NJson::WriteJson (json, false )));
152
+ }
153
+ };
154
+
155
+
116
156
void TGraphShard::ExecuteTxMonitoring (NMon::TEvRemoteHttpInfo::TPtr ev) {
117
157
if (ev->Get ()->Cgi ().Has (" action" )) {
118
158
if (ev->Get ()->Cgi ().Get (" action" ) == " change_backend" ) {
@@ -123,6 +163,10 @@ void TGraphShard::ExecuteTxMonitoring(NMon::TEvRemoteHttpInfo::TPtr ev) {
123
163
return ;
124
164
}
125
165
}
166
+ if (ev->Get ()->Cgi ().Get (" action" ) == " get_settings" ) {
167
+ Execute (new TTxMonitoringGetSettings (this , std::move (ev)));
168
+ return ;
169
+ }
126
170
Send (ev->Sender , new NMon::TEvRemoteHttpInfoRes (" <html><p>bad parameters</p></html>" ));
127
171
return ;
128
172
}
0 commit comments