File: resource_usage_agent.proto

package info (click to toggle)
golang-github-pingcap-kvproto 6.1.0~alpha-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,040 kB
  • sloc: sh: 111; makefile: 34
file content (50 lines) | stat: -rw-r--r-- 1,522 bytes parent folder | download
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
syntax = "proto3";

package resource_usage_agent;

import "gogoproto/gogo.proto";
import "rustproto.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;

option java_package = "org.tikv.kvproto";

// ResourceUsageAgent is the service for storing resource usage records.
service ResourceUsageAgent {
    // Report the resource usage records. By default, the records with the same
    // resource group tag will be batched by minute.
    rpc Report(stream ResourceUsageRecord) returns (EmptyResponse) {}
}

// TiKV implements ResourceMeteringPubSub service for clients to subscribe to resource metering records.
service ResourceMeteringPubSub {
    // Clients subscribe to resource metering records through this RPC, and TiKV periodically (e.g. per minute)
    // publishes resource metering records to clients via gRPC stream.
    rpc Subscribe(ResourceMeteringRequest) returns (stream ResourceUsageRecord) {}
}

message ResourceMeteringRequest {}

message EmptyResponse {}

message ResourceUsageRecord {
    oneof record_oneof {
        GroupTagRecord record = 1;
    }
}

// GroupTagRecord is a set of resource usage data grouped by resource_group_tag.
message GroupTagRecord {
    bytes resource_group_tag = 1;
    repeated GroupTagRecordItem items = 2;
}

message GroupTagRecordItem {
    uint64 timestamp_sec = 1;
    uint32 cpu_time_ms = 2;
    uint32 read_keys = 3;
    uint32 write_keys = 4;
}