channelz_service_plugin.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <memory>
22 #include <string>
23 
27 #include <grpcpp/server_builder.h>
28 #include <grpcpp/support/config.h>
29 
31 
32 namespace grpc {
33 namespace channelz {
34 namespace experimental {
35 
37  public:
39 
40  std::string name() override { return "channelz_service"; }
41 
42  void InitServer(grpc::ServerInitializer* si) override {
44  }
45 
46  void Finish(grpc::ServerInitializer* /*si*/) override {}
47 
48  void ChangeArguments(const std::string& /*name*/, void* /*value*/) override {}
49 
50  bool has_sync_methods() const override {
51  if (channelz_service_) {
52  return channelz_service_->has_synchronous_methods();
53  }
54  return false;
55  }
56 
57  bool has_async_methods() const override {
58  if (channelz_service_) {
59  return channelz_service_->has_async_methods();
60  }
61  return false;
62  }
63 
64  private:
65  std::shared_ptr<grpc::ChannelzService> channelz_service_;
66 };
67 
68 static std::unique_ptr<grpc::ServerBuilderPlugin>
70  return std::unique_ptr<grpc::ServerBuilderPlugin>(
71  new ChannelzServicePlugin());
72 }
73 
75  static struct Initializer {
76  Initializer() {
79  }
80  } initialize;
81 }
82 
83 } // namespace experimental
84 } // namespace channelz
85 } // namespace grpc
grpc::channelz::experimental::ChannelzServicePlugin::has_async_methods
bool has_async_methods() const override
Definition: channelz_service_plugin.cc:57
grpc::channelz::experimental::ChannelzServicePlugin
Definition: channelz_service_plugin.cc:36
server_initializer.h
grpc::channelz::experimental::ChannelzServicePlugin::ChannelzServicePlugin
ChannelzServicePlugin()
Definition: channelz_service_plugin.cc:38
grpc
Definition: grpcpp/alarm.h:33
initialize
void initialize()
Definition: hello.c:3
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
env.new
def new
Definition: env.py:51
channelz_service_plugin.h
server_builder_plugin.h
grpc::channelz::experimental::ChannelzServicePlugin::Finish
void Finish(grpc::ServerInitializer *) override
Finish will be called at the end of ServerBuilder::BuildAndStart().
Definition: channelz_service_plugin.cc:46
channelz_service.h
grpc::channelz::experimental::ChannelzServicePlugin::has_sync_methods
bool has_sync_methods() const override
Definition: channelz_service_plugin.cc:50
config.h
grpc::channelz::experimental::ChannelzServicePlugin::name
std::string name() override
Definition: channelz_service_plugin.cc:40
grpc::ChannelzService
Definition: channelz_service.h:32
grpc::channelz::experimental::InitChannelzService
void InitChannelzService()
Definition: channelz_service_plugin.cc:74
grpc::channelz::experimental::ChannelzServicePlugin::ChangeArguments
void ChangeArguments(const std::string &, void *) override
Definition: channelz_service_plugin.cc:48
grpc::channelz::experimental::ChannelzServicePlugin::InitServer
void InitServer(grpc::ServerInitializer *si) override
Definition: channelz_service_plugin.cc:42
channelz
void channelz(grpc_end2end_test_config config)
Definition: test/core/end2end/tests/channelz.cc:318
grpc::channelz::experimental::ChannelzServicePlugin::channelz_service_
std::shared_ptr< grpc::ChannelzService > channelz_service_
Definition: channelz_service_plugin.cc:65
grpc::ServerInitializer::RegisterService
bool RegisterService(std::shared_ptr< grpc::Service > service)
Definition: grpcpp/impl/server_initializer.h:35
grpc::ServerBuilder::InternalAddPluginFactory
static void InternalAddPluginFactory(std::unique_ptr< grpc::ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
Definition: server_builder.cc:458
grpc::ServerBuilderPlugin
Definition: grpcpp/impl/server_builder_plugin.h:35
grpc::ServerInitializer
Definition: grpcpp/impl/server_initializer.h:31
grpc::channelz::experimental::CreateChannelzServicePlugin
static std::unique_ptr< grpc::ServerBuilderPlugin > CreateChannelzServicePlugin()
Definition: channelz_service_plugin.cc:69
server_builder.h
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:53