Documentation ¶
Overview ¶
Package metric is a generated protocol buffer package.
It is generated from these files:
polaris_metric.proto polaris_metric_api.proto polaris_ratelimit.proto
It has these top-level messages:
MetricDimension MetricKey MetricInitRequest MetricQueryRequest MetricRequest MetricResponse RateLimitRequest RateLimitResponse Limiter
Package metric is a generated protocol buffer package.
It is generated from these files:
polaris_ratelimit.proto
It has these top-level messages:
RateLimitRequest RateLimitResponse Limiter
Index ¶
- Constants
- Variables
- func Code2HTTPStatus(code Code) int
- func RegisterMetricGRPCServer(s *grpc.Server, srv MetricGRPCServer)
- func RegisterRateLimitGRPCServer(s *grpc.Server, srv RateLimitGRPCServer)
- type Code
- type Limiter
- func (*Limiter) Descriptor() ([]byte, []int)
- func (m *Limiter) GetAmount() *google_protobuf.UInt32Value
- func (m *Limiter) GetDuration() *google_protobuf1.Duration
- func (m *Limiter) GetLimited() *google_protobuf.UInt32Value
- func (*Limiter) ProtoMessage()
- func (m *Limiter) Reset()
- func (m *Limiter) String() string
- type MetricDimension
- type MetricGRPCClient
- type MetricGRPCServer
- type MetricGRPC_QueryClient
- type MetricGRPC_QueryServer
- type MetricGRPC_ReportClient
- type MetricGRPC_ReportServer
- type MetricInitRequest
- func (*MetricInitRequest) Descriptor() ([]byte, []int)
- func (m *MetricInitRequest) GetDimensions() []*MetricDimension
- func (m *MetricInitRequest) GetKey() *MetricKey
- func (m *MetricInitRequest) GetMsgId() *google_protobuf.Int64Value
- func (m *MetricInitRequest) GetWindows() []*MetricInitRequest_MetricWindow
- func (*MetricInitRequest) ProtoMessage()
- func (m *MetricInitRequest) Reset()
- func (m *MetricInitRequest) String() string
- type MetricInitRequest_MetricWindow
- func (*MetricInitRequest_MetricWindow) Descriptor() ([]byte, []int)
- func (m *MetricInitRequest_MetricWindow) GetDuration() int64
- func (m *MetricInitRequest_MetricWindow) GetPrecision() uint32
- func (*MetricInitRequest_MetricWindow) ProtoMessage()
- func (m *MetricInitRequest_MetricWindow) Reset()
- func (m *MetricInitRequest_MetricWindow) String() string
- type MetricKey
- func (*MetricKey) Descriptor() ([]byte, []int)
- func (m *MetricKey) GetLabels() string
- func (m *MetricKey) GetNamespace() string
- func (m *MetricKey) GetRole() MetricKey_Role
- func (m *MetricKey) GetService() string
- func (m *MetricKey) GetSubset() string
- func (*MetricKey) ProtoMessage()
- func (m *MetricKey) Reset()
- func (m *MetricKey) String() string
- type MetricKey_Role
- type MetricQueryRequest
- func (*MetricQueryRequest) Descriptor() ([]byte, []int)
- func (m *MetricQueryRequest) GetDimensions() []*MetricDimension
- func (m *MetricQueryRequest) GetDuration() int64
- func (m *MetricQueryRequest) GetKey() *MetricKey
- func (m *MetricQueryRequest) GetMsgId() *google_protobuf.Int64Value
- func (*MetricQueryRequest) ProtoMessage()
- func (m *MetricQueryRequest) Reset()
- func (m *MetricQueryRequest) String() string
- type MetricRequest
- func (*MetricRequest) Descriptor() ([]byte, []int)
- func (m *MetricRequest) GetIncrements() []*MetricRequest_MetricIncrement
- func (m *MetricRequest) GetKey() *MetricKey
- func (m *MetricRequest) GetMsgId() *google_protobuf.Int64Value
- func (m *MetricRequest) GetTimestamp() *google_protobuf.Int64Value
- func (*MetricRequest) ProtoMessage()
- func (m *MetricRequest) Reset()
- func (m *MetricRequest) String() string
- type MetricRequest_MetricIncrement
- func (*MetricRequest_MetricIncrement) Descriptor() ([]byte, []int)
- func (m *MetricRequest_MetricIncrement) GetDuration() int64
- func (m *MetricRequest_MetricIncrement) GetPrecision() uint32
- func (m *MetricRequest_MetricIncrement) GetValues() []*MetricRequest_MetricIncrement_Values
- func (*MetricRequest_MetricIncrement) ProtoMessage()
- func (m *MetricRequest_MetricIncrement) Reset()
- func (m *MetricRequest_MetricIncrement) String() string
- type MetricRequest_MetricIncrement_Values
- func (*MetricRequest_MetricIncrement_Values) Descriptor() ([]byte, []int)
- func (m *MetricRequest_MetricIncrement_Values) GetDimension() *MetricDimension
- func (m *MetricRequest_MetricIncrement_Values) GetValues() []int64
- func (*MetricRequest_MetricIncrement_Values) ProtoMessage()
- func (m *MetricRequest_MetricIncrement_Values) Reset()
- func (m *MetricRequest_MetricIncrement_Values) String() string
- type MetricResponse
- func (*MetricResponse) Descriptor() ([]byte, []int)
- func (m *MetricResponse) GetCode() *google_protobuf.UInt32Value
- func (m *MetricResponse) GetInfo() *google_protobuf.StringValue
- func (m *MetricResponse) GetMsgId() *google_protobuf.Int64Value
- func (m *MetricResponse) GetSummaries() []*MetricResponse_MetricSum
- func (m *MetricResponse) GetTimestamp() *google_protobuf.Int64Value
- func (*MetricResponse) ProtoMessage()
- func (m *MetricResponse) Reset()
- func (m *MetricResponse) String() string
- type MetricResponse_MetricSum
- func (*MetricResponse_MetricSum) Descriptor() ([]byte, []int)
- func (m *MetricResponse_MetricSum) GetDuration() int64
- func (m *MetricResponse_MetricSum) GetValues() []*MetricResponse_MetricSum_Value
- func (*MetricResponse_MetricSum) ProtoMessage()
- func (m *MetricResponse_MetricSum) Reset()
- func (m *MetricResponse_MetricSum) String() string
- type MetricResponse_MetricSum_Value
- func (*MetricResponse_MetricSum_Value) Descriptor() ([]byte, []int)
- func (m *MetricResponse_MetricSum_Value) GetDimension() *MetricDimension
- func (m *MetricResponse_MetricSum_Value) GetValue() int64
- func (*MetricResponse_MetricSum_Value) ProtoMessage()
- func (m *MetricResponse_MetricSum_Value) Reset()
- func (m *MetricResponse_MetricSum_Value) String() string
- type MetricType
- type RateLimitGRPCClient
- type RateLimitGRPCServer
- type RateLimitGRPC_AcquireQuotaClient
- type RateLimitGRPC_AcquireQuotaServer
- type RateLimitRequest
- func (*RateLimitRequest) Descriptor() ([]byte, []int)
- func (m *RateLimitRequest) GetKey() *google_protobuf.StringValue
- func (m *RateLimitRequest) GetNamespace() *google_protobuf.StringValue
- func (m *RateLimitRequest) GetService() *google_protobuf.StringValue
- func (m *RateLimitRequest) GetTimestamp() *google_protobuf.Int64Value
- func (m *RateLimitRequest) GetTotals() []*Limiter
- func (m *RateLimitRequest) GetUseds() []*Limiter
- func (*RateLimitRequest) ProtoMessage()
- func (m *RateLimitRequest) Reset()
- func (m *RateLimitRequest) String() string
- type RateLimitResponse
- func (*RateLimitResponse) Descriptor() ([]byte, []int)
- func (m *RateLimitResponse) GetCode() *google_protobuf.UInt32Value
- func (m *RateLimitResponse) GetInfo() *google_protobuf.StringValue
- func (m *RateLimitResponse) GetKey() *google_protobuf.StringValue
- func (m *RateLimitResponse) GetSumUseds() []*Limiter
- func (m *RateLimitResponse) GetTimestamp() *google_protobuf.Int64Value
- func (*RateLimitResponse) ProtoMessage()
- func (m *RateLimitResponse) Reset()
- func (m *RateLimitResponse) String() string
Constants ¶
View Source
const ( ExecuteSuccess Code = 200000 ParseException = 400001 InvalidRatelimitKey = 400101 InvalidServiceName = 400102 InvalidNamespace = 400103 InvalidTotalLimit = 400104 InvalidUsedLimit = 400105 InvalidTimestamp = 400106 NotFoundLimiter = 404001 CreateLimiterError = 500001 AcquireQuotaError = 500002 )
Variables ¶
View Source
var Code2Info = map[Code]*wrappers.StringValue{ ExecuteSuccess: {Value: "execute success"}, ParseException: {Value: "parse request body exception"}, InvalidRatelimitKey: {Value: "invalid ratelimiting key"}, InvalidServiceName: {Value: "invalid service name"}, InvalidNamespace: {Value: "invalid namespace"}, InvalidTotalLimit: {Value: "invalid total limit"}, InvalidUsedLimit: {Value: "invalid used limit"}, InvalidTimestamp: {Value: "invalid timestamp"}, NotFoundLimiter: {Value: "not found the key limiter, initialize firstly"}, CreateLimiterError: {Value: "create ratelimiter error"}, AcquireQuotaError: {Value: "acquire quota error"}, }
code -> info
View Source
var MetricKey_Role_name = map[int32]string{
0: "Caller",
1: "Callee",
}
View Source
var MetricKey_Role_value = map[string]int32{
"Caller": 0,
"Callee": 1,
}
View Source
var MetricType_name = map[int32]string{
0: "ReqCount",
1: "LimitCount",
2: "ReqCountByDelay",
3: "ErrorCount",
4: "ErrorCountByType",
}
View Source
var MetricType_value = map[string]int32{
"ReqCount": 0,
"LimitCount": 1,
"ReqCountByDelay": 2,
"ErrorCount": 3,
"ErrorCountByType": 4,
}
View Source
var WrapperCode = map[Code]*wrappers.UInt32Value{ ExecuteSuccess: {Value: uint32(ExecuteSuccess)}, ParseException: {Value: uint32(ParseException)}, InvalidRatelimitKey: {Value: uint32(InvalidRatelimitKey)}, InvalidServiceName: {Value: uint32(InvalidServiceName)}, InvalidNamespace: {Value: uint32(InvalidNamespace)}, InvalidTotalLimit: {Value: uint32(InvalidTotalLimit)}, InvalidUsedLimit: {Value: uint32(InvalidUsedLimit)}, InvalidTimestamp: {Value: uint32(InvalidTimestamp)}, NotFoundLimiter: {Value: uint32(NotFoundLimiter)}, CreateLimiterError: {Value: uint32(CreateLimiterError)}, AcquireQuotaError: {Value: uint32(AcquireQuotaError)}, }
code -> apiCode
Functions ¶
func RegisterMetricGRPCServer ¶
func RegisterMetricGRPCServer(s *grpc.Server, srv MetricGRPCServer)
func RegisterRateLimitGRPCServer ¶
func RegisterRateLimitGRPCServer(s *grpc.Server, srv RateLimitGRPCServer)
Types ¶
type Limiter ¶
type Limiter struct { Amount *google_protobuf.UInt32Value `protobuf:"bytes,1,opt,name=amount" json:"amount,omitempty"` Duration *google_protobuf1.Duration `protobuf:"bytes,2,opt,name=duration" json:"duration,omitempty"` Limited *google_protobuf.UInt32Value `protobuf:"bytes,3,opt,name=limited" json:"limited,omitempty"` }
func (*Limiter) Descriptor ¶
func (*Limiter) GetAmount ¶
func (m *Limiter) GetAmount() *google_protobuf.UInt32Value
func (*Limiter) GetDuration ¶
func (m *Limiter) GetDuration() *google_protobuf1.Duration
func (*Limiter) GetLimited ¶
func (m *Limiter) GetLimited() *google_protobuf.UInt32Value
func (*Limiter) ProtoMessage ¶
func (*Limiter) ProtoMessage()
type MetricDimension ¶
type MetricDimension struct { // 维度类型 Type MetricType `protobuf:"varint,1,opt,name=type,enum=metric.MetricType" json:"type,omitempty"` // 维度的具体值,比如具体错误类型 Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` }
统计维度 这里直接使用基础类型可以避免转换过程
func (*MetricDimension) Descriptor ¶
func (*MetricDimension) Descriptor() ([]byte, []int)
func (*MetricDimension) GetType ¶
func (m *MetricDimension) GetType() MetricType
func (*MetricDimension) GetValue ¶
func (m *MetricDimension) GetValue() string
func (*MetricDimension) ProtoMessage ¶
func (*MetricDimension) ProtoMessage()
func (*MetricDimension) Reset ¶
func (m *MetricDimension) Reset()
func (*MetricDimension) String ¶
func (m *MetricDimension) String() string
type MetricGRPCClient ¶
type MetricGRPCClient interface { // 初始化统计周期 Init(ctx context.Context, in *MetricInitRequest, opts ...grpc.CallOption) (*MetricResponse, error) // 查询汇总统计数据 Query(ctx context.Context, opts ...grpc.CallOption) (MetricGRPC_QueryClient, error) // 上报统计数据,并返回上报状态(成功or失败) Report(ctx context.Context, opts ...grpc.CallOption) (MetricGRPC_ReportClient, error) }
func NewMetricGRPCClient ¶
func NewMetricGRPCClient(cc *grpc.ClientConn) MetricGRPCClient
type MetricGRPCServer ¶
type MetricGRPCServer interface { // 初始化统计周期 Init(context.Context, *MetricInitRequest) (*MetricResponse, error) // 查询汇总统计数据 Query(MetricGRPC_QueryServer) error // 上报统计数据,并返回上报状态(成功or失败) Report(MetricGRPC_ReportServer) error }
type MetricGRPC_QueryClient ¶
type MetricGRPC_QueryClient interface { Send(*MetricQueryRequest) error Recv() (*MetricResponse, error) grpc.ClientStream }
type MetricGRPC_QueryServer ¶
type MetricGRPC_QueryServer interface { Send(*MetricResponse) error Recv() (*MetricQueryRequest, error) grpc.ServerStream }
type MetricGRPC_ReportClient ¶
type MetricGRPC_ReportClient interface { Send(*MetricRequest) error Recv() (*MetricResponse, error) grpc.ClientStream }
type MetricGRPC_ReportServer ¶
type MetricGRPC_ReportServer interface { Send(*MetricResponse) error Recv() (*MetricRequest, error) grpc.ServerStream }
type MetricInitRequest ¶
type MetricInitRequest struct { // 消息ID,用于和应答相对应 MsgId *google_protobuf.Int64Value `protobuf:"bytes,1,opt,name=msgId" json:"msgId,omitempty"` // 标识 Key *MetricKey `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` // 统计类型 Dimensions []*MetricDimension `protobuf:"bytes,3,rep,name=dimensions" json:"dimensions,omitempty"` Windows []*MetricInitRequest_MetricWindow `protobuf:"bytes,4,rep,name=windows" json:"windows,omitempty"` }
统计初始化请求
func (*MetricInitRequest) Descriptor ¶
func (*MetricInitRequest) Descriptor() ([]byte, []int)
func (*MetricInitRequest) GetDimensions ¶
func (m *MetricInitRequest) GetDimensions() []*MetricDimension
func (*MetricInitRequest) GetKey ¶
func (m *MetricInitRequest) GetKey() *MetricKey
func (*MetricInitRequest) GetMsgId ¶
func (m *MetricInitRequest) GetMsgId() *google_protobuf.Int64Value
func (*MetricInitRequest) GetWindows ¶
func (m *MetricInitRequest) GetWindows() []*MetricInitRequest_MetricWindow
func (*MetricInitRequest) ProtoMessage ¶
func (*MetricInitRequest) ProtoMessage()
func (*MetricInitRequest) Reset ¶
func (m *MetricInitRequest) Reset()
func (*MetricInitRequest) String ¶
func (m *MetricInitRequest) String() string
type MetricInitRequest_MetricWindow ¶
type MetricInitRequest_MetricWindow struct { // 滑窗统计周期,单位ms Duration int64 `protobuf:"varint,1,opt,name=duration" json:"duration,omitempty"` // 滑窗统计精度 Precision uint32 `protobuf:"varint,2,opt,name=precision" json:"precision,omitempty"` }
统计滑窗
func (*MetricInitRequest_MetricWindow) Descriptor ¶
func (*MetricInitRequest_MetricWindow) Descriptor() ([]byte, []int)
func (*MetricInitRequest_MetricWindow) GetDuration ¶
func (m *MetricInitRequest_MetricWindow) GetDuration() int64
func (*MetricInitRequest_MetricWindow) GetPrecision ¶
func (m *MetricInitRequest_MetricWindow) GetPrecision() uint32
func (*MetricInitRequest_MetricWindow) ProtoMessage ¶
func (*MetricInitRequest_MetricWindow) ProtoMessage()
func (*MetricInitRequest_MetricWindow) Reset ¶
func (m *MetricInitRequest_MetricWindow) Reset()
func (*MetricInitRequest_MetricWindow) String ¶
func (m *MetricInitRequest_MetricWindow) String() string
type MetricKey ¶
type MetricKey struct { // 服务名 Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` // 命名空间 Namespace string `protobuf:"bytes,2,opt,name=namespace" json:"namespace,omitempty"` // 服务子集群,格式为key1:value1|key2:value2 // 如果要查询服务下面所有的subSet信息,subset字段可以填* Subset string `protobuf:"bytes,3,opt,name=subset" json:"subset,omitempty"` // 业务标签信息,格式为key1:value1|key2:value2 // 如果要查询服务下面所有的labels信息,labels字段可以填* Labels string `protobuf:"bytes,4,opt,name=labels" json:"labels,omitempty"` Role MetricKey_Role `protobuf:"varint,5,opt,name=role,enum=metric.MetricKey_Role" json:"role,omitempty"` }
统计标识,用于唯一关联一种类型的统计滑窗 这里直接使用基础类型可以避免转换过程
func (*MetricKey) Descriptor ¶
func (*MetricKey) GetNamespace ¶
func (*MetricKey) GetRole ¶
func (m *MetricKey) GetRole() MetricKey_Role
func (*MetricKey) GetService ¶
func (*MetricKey) ProtoMessage ¶
func (*MetricKey) ProtoMessage()
type MetricKey_Role ¶
type MetricKey_Role int32
当前上报的角色类型,主调或者被调
const ( // 主调 MetricKey_Caller MetricKey_Role = 0 // 被调 MetricKey_Callee MetricKey_Role = 1 )
func (MetricKey_Role) EnumDescriptor ¶
func (MetricKey_Role) EnumDescriptor() ([]byte, []int)
func (MetricKey_Role) String ¶
func (x MetricKey_Role) String() string
type MetricQueryRequest ¶
type MetricQueryRequest struct { // 消息ID,用于和应答相对应 MsgId *google_protobuf.Int64Value `protobuf:"bytes,1,opt,name=msgId" json:"msgId,omitempty"` // 标识 Key *MetricKey `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` // 统计类型 Dimensions []*MetricDimension `protobuf:"bytes,3,rep,name=dimensions" json:"dimensions,omitempty"` // 查询周期,单位ms // 该查询周期必须不大于初始化时候给的window信息,按最近的一个精度滑窗向上取整 Duration int64 `protobuf:"varint,4,opt,name=duration" json:"duration,omitempty"` }
统计查询请求
func (*MetricQueryRequest) Descriptor ¶
func (*MetricQueryRequest) Descriptor() ([]byte, []int)
func (*MetricQueryRequest) GetDimensions ¶
func (m *MetricQueryRequest) GetDimensions() []*MetricDimension
func (*MetricQueryRequest) GetDuration ¶
func (m *MetricQueryRequest) GetDuration() int64
func (*MetricQueryRequest) GetKey ¶
func (m *MetricQueryRequest) GetKey() *MetricKey
func (*MetricQueryRequest) GetMsgId ¶
func (m *MetricQueryRequest) GetMsgId() *google_protobuf.Int64Value
func (*MetricQueryRequest) ProtoMessage ¶
func (*MetricQueryRequest) ProtoMessage()
func (*MetricQueryRequest) Reset ¶
func (m *MetricQueryRequest) Reset()
func (*MetricQueryRequest) String ¶
func (m *MetricQueryRequest) String() string
type MetricRequest ¶
type MetricRequest struct { // 消息ID,用于和应答相对应 MsgId *google_protobuf.Int64Value `protobuf:"bytes,1,opt,name=msgId" json:"msgId,omitempty"` // 标识 Key *MetricKey `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` Increments []*MetricRequest_MetricIncrement `protobuf:"bytes,3,rep,name=increments" json:"increments,omitempty"` // 上报数据最后发生的时间(统计server绝对时间),单位unixnano Timestamp *google_protobuf.Int64Value `protobuf:"bytes,4,opt,name=timestamp" json:"timestamp,omitempty"` }
周期统计上报请求
func (*MetricRequest) Descriptor ¶
func (*MetricRequest) Descriptor() ([]byte, []int)
func (*MetricRequest) GetIncrements ¶
func (m *MetricRequest) GetIncrements() []*MetricRequest_MetricIncrement
func (*MetricRequest) GetKey ¶
func (m *MetricRequest) GetKey() *MetricKey
func (*MetricRequest) GetMsgId ¶
func (m *MetricRequest) GetMsgId() *google_protobuf.Int64Value
func (*MetricRequest) GetTimestamp ¶
func (m *MetricRequest) GetTimestamp() *google_protobuf.Int64Value
func (*MetricRequest) ProtoMessage ¶
func (*MetricRequest) ProtoMessage()
func (*MetricRequest) Reset ¶
func (m *MetricRequest) Reset()
func (*MetricRequest) String ¶
func (m *MetricRequest) String() string
type MetricRequest_MetricIncrement ¶
type MetricRequest_MetricIncrement struct { // 滑窗统计周期,单位ms Duration int64 `protobuf:"varint,1,opt,name=duration" json:"duration,omitempty"` Values []*MetricRequest_MetricIncrement_Values `protobuf:"bytes,2,rep,name=values" json:"values,omitempty"` // 滑窗统计精度 Precision uint32 `protobuf:"varint,3,opt,name=precision" json:"precision,omitempty"` }
上报的数据 可一次同时上报多种类型的统计数据
func (*MetricRequest_MetricIncrement) Descriptor ¶
func (*MetricRequest_MetricIncrement) Descriptor() ([]byte, []int)
func (*MetricRequest_MetricIncrement) GetDuration ¶
func (m *MetricRequest_MetricIncrement) GetDuration() int64
func (*MetricRequest_MetricIncrement) GetPrecision ¶
func (m *MetricRequest_MetricIncrement) GetPrecision() uint32
func (*MetricRequest_MetricIncrement) GetValues ¶
func (m *MetricRequest_MetricIncrement) GetValues() []*MetricRequest_MetricIncrement_Values
func (*MetricRequest_MetricIncrement) ProtoMessage ¶
func (*MetricRequest_MetricIncrement) ProtoMessage()
func (*MetricRequest_MetricIncrement) Reset ¶
func (m *MetricRequest_MetricIncrement) Reset()
func (*MetricRequest_MetricIncrement) String ¶
func (m *MetricRequest_MetricIncrement) String() string
type MetricRequest_MetricIncrement_Values ¶
type MetricRequest_MetricIncrement_Values struct { // 统计类型 Dimension *MetricDimension `protobuf:"bytes,1,opt,name=dimension" json:"dimension,omitempty"` // 上报的统计值,按步长为最小单位,包含2次上报之间的增量数据 // 下标越小,则数据是越近 Values []int64 `protobuf:"varint,2,rep,packed,name=values" json:"values,omitempty"` }
单次上报的统计数据
func (*MetricRequest_MetricIncrement_Values) Descriptor ¶
func (*MetricRequest_MetricIncrement_Values) Descriptor() ([]byte, []int)
func (*MetricRequest_MetricIncrement_Values) GetDimension ¶
func (m *MetricRequest_MetricIncrement_Values) GetDimension() *MetricDimension
func (*MetricRequest_MetricIncrement_Values) GetValues ¶
func (m *MetricRequest_MetricIncrement_Values) GetValues() []int64
func (*MetricRequest_MetricIncrement_Values) ProtoMessage ¶
func (*MetricRequest_MetricIncrement_Values) ProtoMessage()
func (*MetricRequest_MetricIncrement_Values) Reset ¶
func (m *MetricRequest_MetricIncrement_Values) Reset()
func (*MetricRequest_MetricIncrement_Values) String ¶
func (m *MetricRequest_MetricIncrement_Values) String() string
type MetricResponse ¶
type MetricResponse struct { // 返回码 Code *google_protobuf.UInt32Value `protobuf:"bytes,1,opt,name=code" json:"code,omitempty"` // 返回码详情 Info *google_protobuf.StringValue `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` // 消息ID,用于和应答相对应 MsgId *google_protobuf.Int64Value `protobuf:"bytes,3,opt,name=msgId" json:"msgId,omitempty"` Summaries []*MetricResponse_MetricSum `protobuf:"bytes,4,rep,name=summaries" json:"summaries,omitempty"` // 统计server绝对时间,单位unixnano Timestamp *google_protobuf.Int64Value `protobuf:"bytes,5,opt,name=timestamp" json:"timestamp,omitempty"` }
统计应答
func (*MetricResponse) Descriptor ¶
func (*MetricResponse) Descriptor() ([]byte, []int)
func (*MetricResponse) GetCode ¶
func (m *MetricResponse) GetCode() *google_protobuf.UInt32Value
func (*MetricResponse) GetInfo ¶
func (m *MetricResponse) GetInfo() *google_protobuf.StringValue
func (*MetricResponse) GetMsgId ¶
func (m *MetricResponse) GetMsgId() *google_protobuf.Int64Value
func (*MetricResponse) GetSummaries ¶
func (m *MetricResponse) GetSummaries() []*MetricResponse_MetricSum
func (*MetricResponse) GetTimestamp ¶
func (m *MetricResponse) GetTimestamp() *google_protobuf.Int64Value
func (*MetricResponse) ProtoMessage ¶
func (*MetricResponse) ProtoMessage()
func (*MetricResponse) Reset ¶
func (m *MetricResponse) Reset()
func (*MetricResponse) String ¶
func (m *MetricResponse) String() string
type MetricResponse_MetricSum ¶
type MetricResponse_MetricSum struct { // 滑窗统计周期,单位ms Duration int64 `protobuf:"varint,1,opt,name=duration" json:"duration,omitempty"` Values []*MetricResponse_MetricSum_Value `protobuf:"bytes,2,rep,name=values" json:"values,omitempty"` }
统计滑窗汇总值
func (*MetricResponse_MetricSum) Descriptor ¶
func (*MetricResponse_MetricSum) Descriptor() ([]byte, []int)
func (*MetricResponse_MetricSum) GetDuration ¶
func (m *MetricResponse_MetricSum) GetDuration() int64
func (*MetricResponse_MetricSum) GetValues ¶
func (m *MetricResponse_MetricSum) GetValues() []*MetricResponse_MetricSum_Value
func (*MetricResponse_MetricSum) ProtoMessage ¶
func (*MetricResponse_MetricSum) ProtoMessage()
func (*MetricResponse_MetricSum) Reset ¶
func (m *MetricResponse_MetricSum) Reset()
func (*MetricResponse_MetricSum) String ¶
func (m *MetricResponse_MetricSum) String() string
type MetricResponse_MetricSum_Value ¶
type MetricResponse_MetricSum_Value struct { // 统计类型 Dimension *MetricDimension `protobuf:"bytes,1,opt,name=dimension" json:"dimension,omitempty"` // 上报的统计值,按步长为最小单位,包含2次上报之间的增量数据 Value int64 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"` }
单次上报的统计数据 一次可以同时上报多种类型的统计数据
func (*MetricResponse_MetricSum_Value) Descriptor ¶
func (*MetricResponse_MetricSum_Value) Descriptor() ([]byte, []int)
func (*MetricResponse_MetricSum_Value) GetDimension ¶
func (m *MetricResponse_MetricSum_Value) GetDimension() *MetricDimension
func (*MetricResponse_MetricSum_Value) GetValue ¶
func (m *MetricResponse_MetricSum_Value) GetValue() int64
func (*MetricResponse_MetricSum_Value) ProtoMessage ¶
func (*MetricResponse_MetricSum_Value) ProtoMessage()
func (*MetricResponse_MetricSum_Value) Reset ¶
func (m *MetricResponse_MetricSum_Value) Reset()
func (*MetricResponse_MetricSum_Value) String ¶
func (m *MetricResponse_MetricSum_Value) String() string
type MetricType ¶
type MetricType int32
统计类型
const ( // 请求数 MetricType_ReqCount MetricType = 0 // 被限流数 MetricType_LimitCount MetricType = 1 // 按时延来进行上报 MetricType_ReqCountByDelay MetricType = 2 // 通用错误数 MetricType_ErrorCount MetricType = 3 // 通过错误类型来统计上报 MetricType_ErrorCountByType MetricType = 4 )
func (MetricType) EnumDescriptor ¶
func (MetricType) EnumDescriptor() ([]byte, []int)
func (MetricType) String ¶
func (x MetricType) String() string
type RateLimitGRPCClient ¶
type RateLimitGRPCClient interface { // 限流KEY初始化 InitializeQuota(ctx context.Context, in *RateLimitRequest, opts ...grpc.CallOption) (*RateLimitResponse, error) // 获取限流配额 AcquireQuota(ctx context.Context, opts ...grpc.CallOption) (RateLimitGRPC_AcquireQuotaClient, error) }
func NewRateLimitGRPCClient ¶
func NewRateLimitGRPCClient(cc *grpc.ClientConn) RateLimitGRPCClient
type RateLimitGRPCServer ¶
type RateLimitGRPCServer interface { // 限流KEY初始化 InitializeQuota(context.Context, *RateLimitRequest) (*RateLimitResponse, error) // 获取限流配额 AcquireQuota(RateLimitGRPC_AcquireQuotaServer) error }
type RateLimitGRPC_AcquireQuotaClient ¶
type RateLimitGRPC_AcquireQuotaClient interface { Send(*RateLimitRequest) error Recv() (*RateLimitResponse, error) grpc.ClientStream }
type RateLimitGRPC_AcquireQuotaServer ¶
type RateLimitGRPC_AcquireQuotaServer interface { Send(*RateLimitResponse) error Recv() (*RateLimitRequest, error) grpc.ServerStream }
type RateLimitRequest ¶
type RateLimitRequest struct { Key *google_protobuf.StringValue `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` Service *google_protobuf.StringValue `protobuf:"bytes,2,opt,name=service" json:"service,omitempty"` Namespace *google_protobuf.StringValue `protobuf:"bytes,3,opt,name=namespace" json:"namespace,omitempty"` Timestamp *google_protobuf.Int64Value `protobuf:"bytes,4,opt,name=timestamp" json:"timestamp,omitempty"` Totals []*Limiter `protobuf:"bytes,5,rep,name=totals" json:"totals,omitempty"` Useds []*Limiter `protobuf:"bytes,6,rep,name=useds" json:"useds,omitempty"` }
func (*RateLimitRequest) Descriptor ¶
func (*RateLimitRequest) Descriptor() ([]byte, []int)
func (*RateLimitRequest) GetKey ¶
func (m *RateLimitRequest) GetKey() *google_protobuf.StringValue
func (*RateLimitRequest) GetNamespace ¶
func (m *RateLimitRequest) GetNamespace() *google_protobuf.StringValue
func (*RateLimitRequest) GetService ¶
func (m *RateLimitRequest) GetService() *google_protobuf.StringValue
func (*RateLimitRequest) GetTimestamp ¶
func (m *RateLimitRequest) GetTimestamp() *google_protobuf.Int64Value
func (*RateLimitRequest) GetTotals ¶
func (m *RateLimitRequest) GetTotals() []*Limiter
func (*RateLimitRequest) GetUseds ¶
func (m *RateLimitRequest) GetUseds() []*Limiter
func (*RateLimitRequest) ProtoMessage ¶
func (*RateLimitRequest) ProtoMessage()
func (*RateLimitRequest) Reset ¶
func (m *RateLimitRequest) Reset()
func (*RateLimitRequest) String ¶
func (m *RateLimitRequest) String() string
type RateLimitResponse ¶
type RateLimitResponse struct { Code *google_protobuf.UInt32Value `protobuf:"bytes,1,opt,name=code" json:"code,omitempty"` Info *google_protobuf.StringValue `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` Key *google_protobuf.StringValue `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` Timestamp *google_protobuf.Int64Value `protobuf:"bytes,4,opt,name=timestamp" json:"timestamp,omitempty"` SumUseds []*Limiter `protobuf:"bytes,5,rep,name=sum_useds,json=sumUseds" json:"sum_useds,omitempty"` }
func (*RateLimitResponse) Descriptor ¶
func (*RateLimitResponse) Descriptor() ([]byte, []int)
func (*RateLimitResponse) GetCode ¶
func (m *RateLimitResponse) GetCode() *google_protobuf.UInt32Value
func (*RateLimitResponse) GetInfo ¶
func (m *RateLimitResponse) GetInfo() *google_protobuf.StringValue
func (*RateLimitResponse) GetKey ¶
func (m *RateLimitResponse) GetKey() *google_protobuf.StringValue
func (*RateLimitResponse) GetSumUseds ¶
func (m *RateLimitResponse) GetSumUseds() []*Limiter
func (*RateLimitResponse) GetTimestamp ¶
func (m *RateLimitResponse) GetTimestamp() *google_protobuf.Int64Value
func (*RateLimitResponse) ProtoMessage ¶
func (*RateLimitResponse) ProtoMessage()
func (*RateLimitResponse) Reset ¶
func (m *RateLimitResponse) Reset()
func (*RateLimitResponse) String ¶
func (m *RateLimitResponse) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.