Documentation
¶
Index ¶
- Variables
- func RegisterCountServiceServer(s grpc.ServiceRegistrar, srv CountServiceServer)
- type AddRequest
- func (*AddRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddRequest) GetMethod() Method
- func (x *AddRequest) GetPath() string
- func (x *AddRequest) GetRequestTimestamp() *timestamppb.Timestamp
- func (*AddRequest) ProtoMessage()
- func (x *AddRequest) ProtoReflect() protoreflect.Message
- func (x *AddRequest) Reset()
- func (x *AddRequest) String() string
- type AddResponse
- type CountDailyTotalsRequest
- func (*CountDailyTotalsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CountDailyTotalsRequest) GetDate() *date.Date
- func (*CountDailyTotalsRequest) ProtoMessage()
- func (x *CountDailyTotalsRequest) ProtoReflect() protoreflect.Message
- func (x *CountDailyTotalsRequest) Reset()
- func (x *CountDailyTotalsRequest) String() string
- type CountDailyTotalsResponse
- func (*CountDailyTotalsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CountDailyTotalsResponse) GetMethodCounts() []*MethodCount
- func (*CountDailyTotalsResponse) ProtoMessage()
- func (x *CountDailyTotalsResponse) ProtoReflect() protoreflect.Message
- func (x *CountDailyTotalsResponse) Reset()
- func (x *CountDailyTotalsResponse) String() string
- type CountServiceClient
- type CountServiceServer
- type CountService_AddClient
- type CountService_AddServer
- type GetPeriodTotalsRequest
- func (*GetPeriodTotalsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetPeriodTotalsRequest) GetPeriod() *date.Date
- func (*GetPeriodTotalsRequest) ProtoMessage()
- func (x *GetPeriodTotalsRequest) ProtoReflect() protoreflect.Message
- func (x *GetPeriodTotalsRequest) Reset()
- func (x *GetPeriodTotalsRequest) String() string
- type GetPeriodTotalsResponse
- func (*GetPeriodTotalsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetPeriodTotalsResponse) GetMethodCounts() []*MethodCount
- func (*GetPeriodTotalsResponse) ProtoMessage()
- func (x *GetPeriodTotalsResponse) ProtoReflect() protoreflect.Message
- func (x *GetPeriodTotalsResponse) Reset()
- func (x *GetPeriodTotalsResponse) String() string
- type ListDailyTotalsRequest
- func (*ListDailyTotalsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListDailyTotalsRequest) GetEndDate() *date.Date
- func (x *ListDailyTotalsRequest) GetStartDate() *date.Date
- func (*ListDailyTotalsRequest) ProtoMessage()
- func (x *ListDailyTotalsRequest) ProtoReflect() protoreflect.Message
- func (x *ListDailyTotalsRequest) Reset()
- func (x *ListDailyTotalsRequest) String() string
- type ListDailyTotalsResponse
- func (*ListDailyTotalsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListDailyTotalsResponse) GetMethodCounts() []*MethodCount
- func (*ListDailyTotalsResponse) ProtoMessage()
- func (x *ListDailyTotalsResponse) ProtoReflect() protoreflect.Message
- func (x *ListDailyTotalsResponse) Reset()
- func (x *ListDailyTotalsResponse) String() string
- type Method
- type MethodCount
- func (*MethodCount) Descriptor() ([]byte, []int)deprecated
- func (x *MethodCount) GetCount() int64
- func (x *MethodCount) GetDate() *date.Date
- func (x *MethodCount) GetMethod() Method
- func (x *MethodCount) GetPath() string
- func (*MethodCount) ProtoMessage()
- func (x *MethodCount) ProtoReflect() protoreflect.Message
- func (x *MethodCount) Reset()
- func (x *MethodCount) String() string
- type UnimplementedCountServiceServer
- func (UnimplementedCountServiceServer) Add(CountService_AddServer) error
- func (UnimplementedCountServiceServer) CountDailyTotals(context.Context, *CountDailyTotalsRequest) (*CountDailyTotalsResponse, error)
- func (UnimplementedCountServiceServer) GetPeriodTotals(context.Context, *GetPeriodTotalsRequest) (*GetPeriodTotalsResponse, error)
- func (UnimplementedCountServiceServer) ListDailyTotals(context.Context, *ListDailyTotalsRequest) (*ListDailyTotalsResponse, error)
- type UnsafeCountServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( Method_name = map[int32]string{ 0: "METHOD_UNSPECIFIED", 1: "CONNECT", 2: "DELETE", 3: "GET", 4: "HEAD", 5: "OPTIONS", 6: "POST", 7: "PUT", 8: "TRACE", 100: "GRPC", } Method_value = map[string]int32{ "METHOD_UNSPECIFIED": 0, "CONNECT": 1, "DELETE": 2, "GET": 3, "HEAD": 4, "OPTIONS": 5, "POST": 6, "PUT": 7, "TRACE": 8, "GRPC": 100, } )
Enum value maps for Method.
var CountService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "count.v1.CountService", HandlerType: (*CountServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CountDailyTotals", Handler: _CountService_CountDailyTotals_Handler, }, { MethodName: "ListDailyTotals", Handler: _CountService_ListDailyTotals_Handler, }, { MethodName: "GetPeriodTotals", Handler: _CountService_GetPeriodTotals_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Add", Handler: _CountService_Add_Handler, ClientStreams: true, }, }, Metadata: "count/v1/count.proto", }
CountService_ServiceDesc is the grpc.ServiceDesc for CountService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_count_v1_count_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCountServiceServer ¶
func RegisterCountServiceServer(s grpc.ServiceRegistrar, srv CountServiceServer)
Types ¶
type AddRequest ¶
type AddRequest struct { // Method of the request can be a HTTP method or GRPC. Method Method `protobuf:"varint,1,opt,name=method,proto3,enum=count.v1.Method" json:"method,omitempty"` // Path of the request, or name of the gRPC method. // This value is required. Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` // Timestamp of the request, using the server's wall clock. // This value is required. RequestTimestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=request_timestamp,json=requestTimestamp,proto3" json:"request_timestamp,omitempty"` // contains filtered or unexported fields }
AddRequest is a datapoint for request counting.
func (*AddRequest) Descriptor
deprecated
func (*AddRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.
func (*AddRequest) GetMethod ¶
func (x *AddRequest) GetMethod() Method
func (*AddRequest) GetPath ¶
func (x *AddRequest) GetPath() string
func (*AddRequest) GetRequestTimestamp ¶
func (x *AddRequest) GetRequestTimestamp() *timestamppb.Timestamp
func (*AddRequest) ProtoMessage ¶
func (*AddRequest) ProtoMessage()
func (*AddRequest) ProtoReflect ¶
func (x *AddRequest) ProtoReflect() protoreflect.Message
func (*AddRequest) Reset ¶
func (x *AddRequest) Reset()
func (*AddRequest) String ¶
func (x *AddRequest) String() string
type AddResponse ¶
type AddResponse struct {
// contains filtered or unexported fields
}
func (*AddResponse) Descriptor
deprecated
func (*AddResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddResponse.ProtoReflect.Descriptor instead.
func (*AddResponse) ProtoMessage ¶
func (*AddResponse) ProtoMessage()
func (*AddResponse) ProtoReflect ¶
func (x *AddResponse) ProtoReflect() protoreflect.Message
func (*AddResponse) Reset ¶
func (x *AddResponse) Reset()
func (*AddResponse) String ¶
func (x *AddResponse) String() string
type CountDailyTotalsRequest ¶
type CountDailyTotalsRequest struct { // date which each timestamp should be part of. Date *date.Date `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"` // contains filtered or unexported fields }
CountDailyTotalsRequest determines data points to be counted.
func (*CountDailyTotalsRequest) Descriptor
deprecated
func (*CountDailyTotalsRequest) Descriptor() ([]byte, []int)
Deprecated: Use CountDailyTotalsRequest.ProtoReflect.Descriptor instead.
func (*CountDailyTotalsRequest) GetDate ¶
func (x *CountDailyTotalsRequest) GetDate() *date.Date
func (*CountDailyTotalsRequest) ProtoMessage ¶
func (*CountDailyTotalsRequest) ProtoMessage()
func (*CountDailyTotalsRequest) ProtoReflect ¶
func (x *CountDailyTotalsRequest) ProtoReflect() protoreflect.Message
func (*CountDailyTotalsRequest) Reset ¶
func (x *CountDailyTotalsRequest) Reset()
func (*CountDailyTotalsRequest) String ¶
func (x *CountDailyTotalsRequest) String() string
type CountDailyTotalsResponse ¶
type CountDailyTotalsResponse struct { MethodCounts []*MethodCount `protobuf:"bytes,1,rep,name=method_counts,json=methodCounts,proto3" json:"method_counts,omitempty"` // contains filtered or unexported fields }
CountDailyTotalsResponse returns the method and path pair request counts for the requested date.
func (*CountDailyTotalsResponse) Descriptor
deprecated
func (*CountDailyTotalsResponse) Descriptor() ([]byte, []int)
Deprecated: Use CountDailyTotalsResponse.ProtoReflect.Descriptor instead.
func (*CountDailyTotalsResponse) GetMethodCounts ¶
func (x *CountDailyTotalsResponse) GetMethodCounts() []*MethodCount
func (*CountDailyTotalsResponse) ProtoMessage ¶
func (*CountDailyTotalsResponse) ProtoMessage()
func (*CountDailyTotalsResponse) ProtoReflect ¶
func (x *CountDailyTotalsResponse) ProtoReflect() protoreflect.Message
func (*CountDailyTotalsResponse) Reset ¶
func (x *CountDailyTotalsResponse) Reset()
func (*CountDailyTotalsResponse) String ¶
func (x *CountDailyTotalsResponse) String() string
type CountServiceClient ¶
type CountServiceClient interface { // Add datapoints for request counting, over a streaming RPC. // Datapoints are stored asynchronous, to prevent blocking at the client side. // The stream is terminated by the server after the first error, // which might result in some datapoints not being stored. Add(ctx context.Context, opts ...grpc.CallOption) (CountService_AddClient, error) // CountDailyTotals triggers a count of daily requests. // Request entries for specified date are deleted, while being counted against // method and path pairs. // This method is meant to be called once a day in a cron-like job. // Repeated calls for the same date will not overwrite existing counts, // and may fail if additional request entries are found for a method and path pair. CountDailyTotals(ctx context.Context, in *CountDailyTotalsRequest, opts ...grpc.CallOption) (*CountDailyTotalsResponse, error) // ListDailyTotals returns a list of daily counts for each method and path pair. // Only entries which are previously created by CountDailyTotals can be returned. // When the requested interval does not result in any entries, // a NotFound error will be returned. ListDailyTotals(ctx context.Context, in *ListDailyTotalsRequest, opts ...grpc.CallOption) (*ListDailyTotalsResponse, error) // GetPeriodTotals returns a list of count for each method and path pair. // Only entries which are previously created by CountDailyTotals can be returned. // The inverval is determined by the fields in period. When: // - day and month are zero, a list of totals for the requested year is returned. // - only day is zero, a list of totals for the requested month and year is returned. // - day and month are non zero, a list of totals for the request date is returned. // // When the requested period does not result in any entries, // a NotFound error will be returned. GetPeriodTotals(ctx context.Context, in *GetPeriodTotalsRequest, opts ...grpc.CallOption) (*GetPeriodTotalsResponse, error) }
CountServiceClient is the client API for CountService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewCountServiceClient ¶
func NewCountServiceClient(cc grpc.ClientConnInterface) CountServiceClient
type CountServiceServer ¶
type CountServiceServer interface { // Add datapoints for request counting, over a streaming RPC. // Datapoints are stored asynchronous, to prevent blocking at the client side. // The stream is terminated by the server after the first error, // which might result in some datapoints not being stored. Add(CountService_AddServer) error // CountDailyTotals triggers a count of daily requests. // Request entries for specified date are deleted, while being counted against // method and path pairs. // This method is meant to be called once a day in a cron-like job. // Repeated calls for the same date will not overwrite existing counts, // and may fail if additional request entries are found for a method and path pair. CountDailyTotals(context.Context, *CountDailyTotalsRequest) (*CountDailyTotalsResponse, error) // ListDailyTotals returns a list of daily counts for each method and path pair. // Only entries which are previously created by CountDailyTotals can be returned. // When the requested interval does not result in any entries, // a NotFound error will be returned. ListDailyTotals(context.Context, *ListDailyTotalsRequest) (*ListDailyTotalsResponse, error) // GetPeriodTotals returns a list of count for each method and path pair. // Only entries which are previously created by CountDailyTotals can be returned. // The inverval is determined by the fields in period. When: // - day and month are zero, a list of totals for the requested year is returned. // - only day is zero, a list of totals for the requested month and year is returned. // - day and month are non zero, a list of totals for the request date is returned. // // When the requested period does not result in any entries, // a NotFound error will be returned. GetPeriodTotals(context.Context, *GetPeriodTotalsRequest) (*GetPeriodTotalsResponse, error) // contains filtered or unexported methods }
CountServiceServer is the server API for CountService service. All implementations must embed UnimplementedCountServiceServer for forward compatibility
type CountService_AddClient ¶
type CountService_AddClient interface { Send(*AddRequest) error CloseAndRecv() (*AddResponse, error) grpc.ClientStream }
type CountService_AddServer ¶
type CountService_AddServer interface { SendAndClose(*AddResponse) error Recv() (*AddRequest, error) grpc.ServerStream }
type GetPeriodTotalsRequest ¶
type GetPeriodTotalsRequest struct { // period for which the totals are requested. // The length of the period is determined // by the populated fields year, month or day. Period *date.Date `protobuf:"bytes,1,opt,name=period,proto3" json:"period,omitempty"` // contains filtered or unexported fields }
func (*GetPeriodTotalsRequest) Descriptor
deprecated
func (*GetPeriodTotalsRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetPeriodTotalsRequest.ProtoReflect.Descriptor instead.
func (*GetPeriodTotalsRequest) GetPeriod ¶
func (x *GetPeriodTotalsRequest) GetPeriod() *date.Date
func (*GetPeriodTotalsRequest) ProtoMessage ¶
func (*GetPeriodTotalsRequest) ProtoMessage()
func (*GetPeriodTotalsRequest) ProtoReflect ¶
func (x *GetPeriodTotalsRequest) ProtoReflect() protoreflect.Message
func (*GetPeriodTotalsRequest) Reset ¶
func (x *GetPeriodTotalsRequest) Reset()
func (*GetPeriodTotalsRequest) String ¶
func (x *GetPeriodTotalsRequest) String() string
type GetPeriodTotalsResponse ¶
type GetPeriodTotalsResponse struct { MethodCounts []*MethodCount `protobuf:"bytes,1,rep,name=method_counts,json=methodCounts,proto3" json:"method_counts,omitempty"` // contains filtered or unexported fields }
func (*GetPeriodTotalsResponse) Descriptor
deprecated
func (*GetPeriodTotalsResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetPeriodTotalsResponse.ProtoReflect.Descriptor instead.
func (*GetPeriodTotalsResponse) GetMethodCounts ¶
func (x *GetPeriodTotalsResponse) GetMethodCounts() []*MethodCount
func (*GetPeriodTotalsResponse) ProtoMessage ¶
func (*GetPeriodTotalsResponse) ProtoMessage()
func (*GetPeriodTotalsResponse) ProtoReflect ¶
func (x *GetPeriodTotalsResponse) ProtoReflect() protoreflect.Message
func (*GetPeriodTotalsResponse) Reset ¶
func (x *GetPeriodTotalsResponse) Reset()
func (*GetPeriodTotalsResponse) String ¶
func (x *GetPeriodTotalsResponse) String() string
type ListDailyTotalsRequest ¶
type ListDailyTotalsRequest struct { // start date of the interval, inclusive. StartDate *date.Date `protobuf:"bytes,1,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` // end date of the time interval, inclusive. EndDate *date.Date `protobuf:"bytes,2,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` // contains filtered or unexported fields }
ListDailyTotalsRequest describes an time interval, between which records are returned. The timestamps are rounded down to whole days. So hours, minutes, seconds etc are discarded.
func (*ListDailyTotalsRequest) Descriptor
deprecated
func (*ListDailyTotalsRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListDailyTotalsRequest.ProtoReflect.Descriptor instead.
func (*ListDailyTotalsRequest) GetEndDate ¶
func (x *ListDailyTotalsRequest) GetEndDate() *date.Date
func (*ListDailyTotalsRequest) GetStartDate ¶
func (x *ListDailyTotalsRequest) GetStartDate() *date.Date
func (*ListDailyTotalsRequest) ProtoMessage ¶
func (*ListDailyTotalsRequest) ProtoMessage()
func (*ListDailyTotalsRequest) ProtoReflect ¶
func (x *ListDailyTotalsRequest) ProtoReflect() protoreflect.Message
func (*ListDailyTotalsRequest) Reset ¶
func (x *ListDailyTotalsRequest) Reset()
func (*ListDailyTotalsRequest) String ¶
func (x *ListDailyTotalsRequest) String() string
type ListDailyTotalsResponse ¶
type ListDailyTotalsResponse struct { MethodCounts []*MethodCount `protobuf:"bytes,1,rep,name=method_counts,json=methodCounts,proto3" json:"method_counts,omitempty"` // contains filtered or unexported fields }
func (*ListDailyTotalsResponse) Descriptor
deprecated
func (*ListDailyTotalsResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListDailyTotalsResponse.ProtoReflect.Descriptor instead.
func (*ListDailyTotalsResponse) GetMethodCounts ¶
func (x *ListDailyTotalsResponse) GetMethodCounts() []*MethodCount
func (*ListDailyTotalsResponse) ProtoMessage ¶
func (*ListDailyTotalsResponse) ProtoMessage()
func (*ListDailyTotalsResponse) ProtoReflect ¶
func (x *ListDailyTotalsResponse) ProtoReflect() protoreflect.Message
func (*ListDailyTotalsResponse) Reset ¶
func (x *ListDailyTotalsResponse) Reset()
func (*ListDailyTotalsResponse) String ¶
func (x *ListDailyTotalsResponse) String() string
type Method ¶
type Method int32
Method defines all HTTP standard method types. GRPC value can be used when a request is received over a gRPC connection. buf:lint:ignore ENUM_VALUE_PREFIX
const ( Method_METHOD_UNSPECIFIED Method = 0 // HTTP request methods Method_CONNECT Method = 1 Method_DELETE Method = 2 Method_GET Method = 3 Method_HEAD Method = 4 Method_OPTIONS Method = 5 Method_POST Method = 6 Method_PUT Method = 7 Method_TRACE Method = 8 // gRPC requests Method_GRPC Method = 100 )
func (Method) Descriptor ¶
func (Method) Descriptor() protoreflect.EnumDescriptor
func (Method) EnumDescriptor
deprecated
func (Method) Number ¶
func (x Method) Number() protoreflect.EnumNumber
func (Method) Type ¶
func (Method) Type() protoreflect.EnumType
type MethodCount ¶
type MethodCount struct { // Method of the request can be a HTTP method or GRPC. Method Method `protobuf:"varint,1,opt,name=method,proto3,enum=count.v1.Method" json:"method,omitempty"` // Path of the request, or name of the gRPC method. Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` // Amount of times each method and path pair was requested. Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` // Date of the counted requests. Date *date.Date `protobuf:"bytes,4,opt,name=date,proto3" json:"date,omitempty"` // contains filtered or unexported fields }
MethodCount gives a request count for a method and path pair.
func (*MethodCount) Descriptor
deprecated
func (*MethodCount) Descriptor() ([]byte, []int)
Deprecated: Use MethodCount.ProtoReflect.Descriptor instead.
func (*MethodCount) GetCount ¶
func (x *MethodCount) GetCount() int64
func (*MethodCount) GetDate ¶
func (x *MethodCount) GetDate() *date.Date
func (*MethodCount) GetMethod ¶
func (x *MethodCount) GetMethod() Method
func (*MethodCount) GetPath ¶
func (x *MethodCount) GetPath() string
func (*MethodCount) ProtoMessage ¶
func (*MethodCount) ProtoMessage()
func (*MethodCount) ProtoReflect ¶
func (x *MethodCount) ProtoReflect() protoreflect.Message
func (*MethodCount) Reset ¶
func (x *MethodCount) Reset()
func (*MethodCount) String ¶
func (x *MethodCount) String() string
type UnimplementedCountServiceServer ¶
type UnimplementedCountServiceServer struct { }
UnimplementedCountServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedCountServiceServer) CountDailyTotals ¶
func (UnimplementedCountServiceServer) CountDailyTotals(context.Context, *CountDailyTotalsRequest) (*CountDailyTotalsResponse, error)
func (UnimplementedCountServiceServer) GetPeriodTotals ¶
func (UnimplementedCountServiceServer) GetPeriodTotals(context.Context, *GetPeriodTotalsRequest) (*GetPeriodTotalsResponse, error)
func (UnimplementedCountServiceServer) ListDailyTotals ¶
func (UnimplementedCountServiceServer) ListDailyTotals(context.Context, *ListDailyTotalsRequest) (*ListDailyTotalsResponse, error)
type UnsafeCountServiceServer ¶
type UnsafeCountServiceServer interface {
// contains filtered or unexported methods
}
UnsafeCountServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CountServiceServer will result in compilation errors.