1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
#pragma once
#include "codegen.h"
#include "duration_histogram.h"
#include "message_counter.h"
#include "message_status_counter.h"
#include "queue_config.h"
#include "session_config.h"
#include <library/cpp/messagebus/actor/executor.h>
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
namespace NBus {
class TConnectionStatusMonRecord;
}
namespace NBus {
namespace NPrivate {
#define WRITER_STATE_MAP(XX) \
XX(WRITER_UNKNOWN) \
XX(WRITER_FILLING) \
XX(WRITER_FLUSHING) \
/**/
// TODO: move elsewhere
enum EWriterState {
WRITER_STATE_MAP(ENUM_VALUE_GEN_NO_VALUE)
};
ENUM_TO_STRING(EWriterState, WRITER_STATE_MAP)
#define STRUCT_FIELD_ADD(name, type, func) func(name, that.name);
template <typename T>
void Reset(T& t) {
t.~T();
new (&t) T();
}
#define DURATION_COUNTER_MAP(XX, comma) \
XX(Count, unsigned, Add) \
comma \
XX(SumDuration, TDuration, Add) comma \
XX(MaxDuration, TDuration, Max) /**/
struct TDurationCounter {
DURATION_COUNTER_MAP(STRUCT_FIELD_GEN, )
TDuration AvgDuration() const;
TDurationCounter();
void AddDuration(TDuration d) {
Count += 1;
SumDuration += d;
if (d > MaxDuration) {
MaxDuration = d;
}
}
TDurationCounter& operator+=(const TDurationCounter&);
TString ToString() const;
};
#define REMOTE_CONNECTION_STATUS_BASE_MAP(XX, comma) \
XX(ConnectionId, ui64, AssertZero) \
comma \
XX(Fd, SOCKET, AssertZero) comma \
XX(Acts, ui64, Add) comma \
XX(BufferSize, ui64, Add) /**/
struct TRemoteConnectionStatusBase {
REMOTE_CONNECTION_STATUS_BASE_MAP(STRUCT_FIELD_GEN, )
TRemoteConnectionStatusBase& operator+=(const TRemoteConnectionStatusBase&);
TRemoteConnectionStatusBase();
};
#define REMOTE_CONNECTION_INCREMENTAL_STATUS_BASE_MAP(XX, comma) \
XX(BufferDrops, unsigned, Add) \
comma \
XX(NetworkOps, unsigned, Add) /**/
struct TRemoteConnectionIncrementalStatusBase {
REMOTE_CONNECTION_INCREMENTAL_STATUS_BASE_MAP(STRUCT_FIELD_GEN, )
TRemoteConnectionIncrementalStatusBase& operator+=(const TRemoteConnectionIncrementalStatusBase&);
TRemoteConnectionIncrementalStatusBase();
};
#define REMOTE_CONNECTION_READER_INCREMENTAL_STATUS_MAP(XX, comma) \
XX(MessageCounter, TMessageCounter, Add) \
comma \
XX(StatusCounter, TMessageStatusCounter, Add) /**/
struct TRemoteConnectionReaderIncrementalStatus: public TRemoteConnectionIncrementalStatusBase {
REMOTE_CONNECTION_READER_INCREMENTAL_STATUS_MAP(STRUCT_FIELD_GEN, )
TRemoteConnectionReaderIncrementalStatus& operator+=(const TRemoteConnectionReaderIncrementalStatus&);
TRemoteConnectionReaderIncrementalStatus();
};
#define REMOTE_CONNECTION_READER_STATUS_MAP(XX, comma) \
XX(QuotaMsg, size_t, Add) \
comma \
XX(QuotaBytes, size_t, Add) comma \
XX(QuotaExhausted, size_t, Add) comma \
XX(Incremental, TRemoteConnectionReaderIncrementalStatus, Add) /**/
struct TRemoteConnectionReaderStatus: public TRemoteConnectionStatusBase {
REMOTE_CONNECTION_READER_STATUS_MAP(STRUCT_FIELD_GEN, )
TRemoteConnectionReaderStatus& operator+=(const TRemoteConnectionReaderStatus&);
TRemoteConnectionReaderStatus();
};
#define REMOTE_CONNECTION_WRITER_INCREMENTAL_STATUS(XX, comma) \
XX(MessageCounter, TMessageCounter, Add) \
comma \
XX(StatusCounter, TMessageStatusCounter, Add) comma \
XX(ProcessDurationHistogram, TDurationHistogram, Add) /**/
struct TRemoteConnectionWriterIncrementalStatus: public TRemoteConnectionIncrementalStatusBase {
REMOTE_CONNECTION_WRITER_INCREMENTAL_STATUS(STRUCT_FIELD_GEN, )
TRemoteConnectionWriterIncrementalStatus& operator+=(const TRemoteConnectionWriterIncrementalStatus&);
TRemoteConnectionWriterIncrementalStatus();
};
#define REMOTE_CONNECTION_WRITER_STATUS(XX, comma) \
XX(Connected, bool, AssertZero) \
comma \
XX(ConnectTime, TInstant, AssertZero) comma /* either connect time on client or accept time on server */ \
XX(ConnectError, int, AssertZero) comma \
XX(ConnectSyscalls, unsigned, Add) comma \
XX(PeerAddr, TNetAddr, AssertZero) comma \
XX(MyAddr, TNetAddr, AssertZero) comma \
XX(State, EWriterState, AssertZero) comma \
XX(SendQueueSize, size_t, Add) comma \
XX(AckMessagesSize, size_t, Add) comma /* client only */ \
XX(DurationCounter, TDurationCounter, Add) comma /* server only */ \
XX(DurationCounterPrev, TDurationCounter, Add) comma /* server only */ \
XX(Incremental, TRemoteConnectionWriterIncrementalStatus, Add) comma \
XX(ReaderWakeups, size_t, Add) /**/
struct TRemoteConnectionWriterStatus: public TRemoteConnectionStatusBase {
REMOTE_CONNECTION_WRITER_STATUS(STRUCT_FIELD_GEN, )
TRemoteConnectionWriterStatus();
TRemoteConnectionWriterStatus& operator+=(const TRemoteConnectionWriterStatus&);
size_t GetInFlight() const;
};
#define REMOTE_CONNECTION_STATUS_MAP(XX, comma) \
XX(Summary, bool) \
comma \
XX(Server, bool) /**/
struct TRemoteConnectionStatus {
REMOTE_CONNECTION_STATUS_MAP(STRUCT_FIELD_GEN, )
TRemoteConnectionReaderStatus ReaderStatus;
TRemoteConnectionWriterStatus WriterStatus;
TRemoteConnectionStatus();
TString PrintToString() const;
TConnectionStatusMonRecord GetStatusProtobuf() const;
};
struct TBusSessionStatus {
size_t InFlightCount;
size_t InFlightSize;
bool InputPaused;
TBusSessionStatus();
};
struct TSessionDumpStatus {
bool Shutdown;
TString Head;
TString Acceptors;
TString ConnectionsSummary;
TString Connections;
TBusSessionStatus Status;
TRemoteConnectionStatus ConnectionStatusSummary;
TBusSessionConfig Config;
TSessionDumpStatus()
: Shutdown(false)
{
}
TString PrintToString() const;
};
// without sessions
struct TBusMessageQueueStatus {
NActor::NPrivate::TExecutorStatus ExecutorStatus;
TBusQueueConfig Config;
TString PrintToString() const;
};
}
}
|