summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7b7903a)
raw | patch | inline | side by side (parent: 7b7903a)
author | Florian Forster <octo@collectd.org> | |
Sun, 28 Aug 2016 19:36:15 +0000 (21:36 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 28 Aug 2016 19:36:18 +0000 (21:36 +0200) |
This is done to use a naming closer to that of the unixsock and exec
plugins.
plugins.
proto/collectd.proto | patch | blob | history | |
src/grpc.cc | patch | blob | history |
diff --git a/proto/collectd.proto b/proto/collectd.proto
index 917c5deb679985dd90388176f7e9449569e3ef37..614d1bd00acf03106f50f732c8a244c69bca0055 100644 (file)
--- a/proto/collectd.proto
+++ b/proto/collectd.proto
import "types.proto";
service Collectd {
- // DispatchValues reads the value lists from the DispatchValuesRequest stream.
+ // PutValues reads the value lists from the PutValuesRequest stream.
// The gRPC server embedded into collectd will inject them into the system
// just like the network plugin.
- rpc DispatchValues(stream DispatchValuesRequest)
- returns (DispatchValuesResponse);
+ rpc PutValues(stream PutValuesRequest)
+ returns (PutValuesResponse);
// QueryValues returns a stream of matching value lists from collectd's
// internal cache.
rpc QueryValues(QueryValuesRequest) returns (stream QueryValuesResponse);
}
-// The arguments to DispatchValues.
-message DispatchValuesRequest {
+// The arguments to PutValues.
+message PutValuesRequest {
// value_list is the metric to be sent to the server.
collectd.types.ValueList value_list = 1;
}
-// The response from DispatchValues.
-message DispatchValuesResponse {}
+// The response from PutValues.
+message PutValuesResponse {}
// The arguments to QueryValues.
message QueryValuesRequest {
diff --git a/src/grpc.cc b/src/grpc.cc
index 8b76954d6748090a795d2eaf09fcfe7a8110f7c0..3b1891fa10485cc46f819a5fe777f26f62c9dae5 100644 (file)
--- a/src/grpc.cc
+++ b/src/grpc.cc
using collectd::Collectd;
-using collectd::DispatchValuesRequest;
-using collectd::DispatchValuesResponse;
+using collectd::PutValuesRequest;
+using collectd::PutValuesResponse;
using collectd::QueryValuesRequest;
using collectd::QueryValuesResponse;
return status;
}
- grpc::Status DispatchValues(grpc::ServerContext *ctx,
- grpc::ServerReader<DispatchValuesRequest> *reader,
- DispatchValuesResponse *res) override {
- DispatchValuesRequest req;
+ grpc::Status PutValues(grpc::ServerContext *ctx,
+ grpc::ServerReader<PutValuesRequest> *reader,
+ PutValuesResponse *res) override {
+ PutValuesRequest req;
while (reader->Read(&req)) {
value_list_t vl = VALUE_LIST_INIT;
CollectdClient(std::shared_ptr<grpc::ChannelInterface> channel) : stub_(Collectd::NewStub(channel)) {
}
- int DispatchValues(value_list_t const *vl) {
+ int PutValues(value_list_t const *vl) {
grpc::ClientContext ctx;
- DispatchValuesRequest req;
+ PutValuesRequest req;
auto status = marshal_value_list(vl, req.mutable_value_list());
if (!status.ok()) {
ERROR("grpc: Marshalling value_list_t failed.");
return -1;
}
- DispatchValuesResponse res;
- auto stream = stub_->DispatchValues(&ctx, &res);
+ PutValuesResponse res;
+ auto stream = stub_->PutValues(&ctx, &res);
if (!stream->Write(req)) {
NOTICE("grpc: Broken stream.");
/* intentionally not returning. */
}
return 0;
- } /* int DispatchValues */
+ } /* int PutValues */
private:
std::unique_ptr<Collectd::Stub> stub_;
value_list_t const *vl,
user_data_t *ud) {
CollectdClient *c = (CollectdClient *) ud->data;
- return c->DispatchValues(vl);
+ return c->PutValues(vl);
}
static int c_grpc_config_listen(oconfig_item_t *ci)