19 #ifndef GRPC_CORE_LIB_CHANNEL_CHANNELZ_H
20 #define GRPC_CORE_LIB_CHANNEL_CHANNELZ_H
42 #define GRPC_ARG_CHANNELZ_CHANNEL_NODE "grpc.channelz_channel_node"
45 #define GRPC_ARG_CHANNELZ_PARENT_UUID "grpc.channelz_parent_uuid"
49 #define GRPC_ENABLE_CHANNELZ_DEFAULT true
55 #define GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT 1024 * 4
69 class CallCountingHelperPeer;
70 class ChannelNodePeer;
101 intptr_t
uuid()
const {
return uuid_; }
150 sizeof(Atomic<gpr_cycle_counter>)];
161 void CollectData(CounterData* out);
164 InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
165 size_t num_cores_ = 0;
190 std::move(referenced_channel));
217 const intptr_t parent_uuid_;
227 std::map<intptr_t, bool> child_channels_;
228 std::map<intptr_t, bool> child_subchannels_;
258 std::move(referenced_channel));
268 std::map<intptr_t, RefCountedPtr<SocketNode>> child_sockets_;
269 std::map<intptr_t, RefCountedPtr<ListenSocketNode>> child_listen_sockets_;
299 Atomic<int64_t> streams_failed_{0};
300 Atomic<int64_t> messages_sent_{0};
301 Atomic<int64_t> messages_received_{0};
302 Atomic<int64_t> keepalives_sent_{0};
303 Atomic<gpr_cycle_counter> last_local_stream_created_cycle_{0};
304 Atomic<gpr_cycle_counter> last_remote_stream_created_cycle_{0};
305 Atomic<gpr_cycle_counter> last_message_sent_cycle_{0};
306 Atomic<gpr_cycle_counter> last_message_received_cycle_{0};
Atomic< int64_t > calls_failed
Definition: channelz.h:11
AtomicCounterData()=default
uint8_t padding[GPR_CACHELINE_SIZE - 3 *sizeof(Atomic< intptr_t >) - sizeof(Atomic< gpr_cycle_counter >)]
Definition: channelz.h:15
Atomic< gpr_cycle_counter > last_call_started_cycle
Definition: channelz.h:12
Atomic< int64_t > calls_started
Definition: channelz.h:9
Atomic< int64_t > calls_succeeded
Definition: channelz.h:10
T FetchAdd(Arg arg, MemoryOrder order=MemoryOrder::SEQ_CST)
Definition: atomic.h:71
Definition: ref_counted.h:248
Definition: ref_counted_ptr.h:35
Definition: channelz.h:74
virtual grpc_json * RenderJson()=0
intptr_t uuid() const
Definition: channelz.h:101
EntityType
Definition: channelz.h:79
EntityType type() const
Definition: channelz.h:100
const std::string & name() const
Definition: channelz.h:102
BaseNode(EntityType type, std::string name)
char * RenderJsonString()
Definition: channelz.h:118
friend class testing::CallCountingHelperPeer
Definition: channelz.h:131
void RecordCallSucceeded()
void PopulateCallCounts(grpc_json *json)
Definition: channelz.h:169
void RemoveChildChannel(intptr_t child_uuid)
void RemoveChildSubchannel(intptr_t child_uuid)
void AddChildSubchannel(intptr_t child_uuid)
void RecordCallStarted()
Definition: channelz.h:192
void AddTraceEventWithReference(ChannelTrace::Severity severity, const grpc_slice &data, RefCountedPtr< BaseNode > referenced_channel)
Definition: channelz.h:186
friend class testing::ChannelNodePeer
Definition: channelz.h:212
intptr_t parent_uuid() const
Definition: channelz.h:178
static const char * GetChannelConnectivityStateChangeString(grpc_connectivity_state state)
void RecordCallFailed()
Definition: channelz.h:193
void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice &data)
Definition: channelz.h:183
void RecordCallSucceeded()
Definition: channelz.h:194
void AddChildChannel(intptr_t child_uuid)
ChannelNode(std::string target, size_t channel_tracer_max_nodes, intptr_t parent_uuid)
grpc_json * RenderJson() override
void SetConnectivityState(grpc_connectivity_state state)
Definition: channel_trace.h:42
Severity
Definition: channel_trace.h:47
void AddTraceEventWithReference(Severity severity, const grpc_slice &data, RefCountedPtr< BaseNode > referenced_entity)
void AddTraceEvent(Severity severity, const grpc_slice &data)
Definition: channelz_registry.h:36
Definition: channelz.h:312
~ListenSocketNode() override
Definition: channelz.h:315
grpc_json * RenderJson() override
ListenSocketNode(std::string local_addr, std::string name)
Definition: channelz.h:232
char * RenderServerSockets(intptr_t start_socket_id, intptr_t max_results)
ServerNode(grpc_server *server, size_t channel_tracer_max_nodes)
void AddChildSocket(RefCountedPtr< SocketNode > node)
void RemoveChildSocket(intptr_t child_uuid)
void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice &data)
Definition: channelz.h:251
void RemoveChildListenSocket(intptr_t child_uuid)
void RecordCallFailed()
Definition: channelz.h:261
void AddTraceEventWithReference(ChannelTrace::Severity severity, const grpc_slice &data, RefCountedPtr< BaseNode > referenced_channel)
Definition: channelz.h:254
void RecordCallSucceeded()
Definition: channelz.h:262
grpc_json * RenderJson() override
void RecordCallStarted()
Definition: channelz.h:260
void AddChildListenSocket(RefCountedPtr< ListenSocketNode > node)
Definition: channelz.h:273
void RecordMessageReceived()
void RecordStreamSucceeded()
Definition: channelz.h:282
SocketNode(std::string local, std::string remote, std::string name)
void RecordStreamFailed()
Definition: channelz.h:285
void RecordStreamStartedFromRemote()
void RecordStreamStartedFromLocal()
const std::string & remote()
Definition: channelz.h:294
void RecordMessagesSent(uint32_t num_sent)
grpc_json * RenderJson() override
void RecordKeepaliveSent()
Definition: channelz.h:290
~SocketNode() override
Definition: channelz.h:276
struct grpc_server grpc_server
A server listens to some port and responds to request calls.
Definition: grpc_types.h:65
grpc_connectivity_state
Connectivity state of a channel.
Definition: connectivity_state.h:27
grpc_arg MakeParentUuidArg(intptr_t parent_uuid)
intptr_t GetParentUuidFromArgs(const grpc_channel_args &args)
Internal thread interface.
Definition: backoff.h:26
MemoryOrder
Definition: atomic.h:30
std::string string
Definition: config.h:35
A single argument...
Definition: grpc_types.h:103
An array of arguments that can be passed around.
Definition: grpc_types.h:132
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:60