Protocol Buffer 时间类型定义

时间:2023-03-10 05:54:54
Protocol Buffer 时间类型定义
ProtoBuf3中新增了TimeStamp类型,使用示例如下:
syntax = "proto3";
import public "google/protobuf/timestamp.proto"; message MonitorData {
google.protobuf.Timestamp Time = ;//收集时间
int64 LongValue = ;//监控值--长整型
string MetaData = ;//监控元数据ID
string Ins = ;//监控元数据实例
string Host = ;//应用节点ApplicationNode
string ServiceHost = ;//服务宿主ApplicationHost
string StringValue = ;//监控值--字符串
double DoubleValue = ;//监控值--浮点型
map<string, string> Tags = ;//监控数据维度字典
map<string, string> Ext = ;//扩展属性
string Cluster = ;//集群
string RowKey = ;//RowKey
}

根据.proto文件生成对应的Java类:

D:\tmp>protoc.exe -I=d:/tmp --java_out=d:/tmp d:/tmp/monitordata.proto

注:protoc下载:

http://repo1.maven.org/maven2/com/google/protobuf/protoc/