Documentation ¶
Overview ¶
Package metrics is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterMetricsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMetricsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsClient) error
- func RegisterMetricsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMetricsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetricsServer) error
- func RegisterMetricsServer(s grpc.ServiceRegistrar, srv MetricsServer)
- type MetricsClient
- type MetricsServer
- type MetricsShowRequest
- func (*MetricsShowRequest) Descriptor() ([]byte, []int)deprecated
- func (x *MetricsShowRequest) GetNamespace() string
- func (x *MetricsShowRequest) GetPod() string
- func (*MetricsShowRequest) ProtoMessage()
- func (x *MetricsShowRequest) ProtoReflect() protoreflect.Message
- func (x *MetricsShowRequest) Reset()
- func (x *MetricsShowRequest) String() string
- func (m *MetricsShowRequest) Validate() error
- func (m *MetricsShowRequest) ValidateAll() error
- type MetricsShowRequestMultiError
- type MetricsShowRequestValidationError
- func (e MetricsShowRequestValidationError) Cause() error
- func (e MetricsShowRequestValidationError) Error() string
- func (e MetricsShowRequestValidationError) ErrorName() string
- func (e MetricsShowRequestValidationError) Field() string
- func (e MetricsShowRequestValidationError) Key() bool
- func (e MetricsShowRequestValidationError) Reason() string
- type MetricsShowResponse
- func (*MetricsShowResponse) Descriptor() ([]byte, []int)deprecated
- func (x *MetricsShowResponse) GetCpu() float64
- func (x *MetricsShowResponse) GetHumanizeCpu() string
- func (x *MetricsShowResponse) GetHumanizeMemory() string
- func (x *MetricsShowResponse) GetLength() int64
- func (x *MetricsShowResponse) GetMemory() float64
- func (x *MetricsShowResponse) GetTime() string
- func (*MetricsShowResponse) ProtoMessage()
- func (x *MetricsShowResponse) ProtoReflect() protoreflect.Message
- func (x *MetricsShowResponse) Reset()
- func (x *MetricsShowResponse) String() string
- func (m *MetricsShowResponse) Validate() error
- func (m *MetricsShowResponse) ValidateAll() error
- type MetricsShowResponseMultiError
- type MetricsShowResponseValidationError
- func (e MetricsShowResponseValidationError) Cause() error
- func (e MetricsShowResponseValidationError) Error() string
- func (e MetricsShowResponseValidationError) ErrorName() string
- func (e MetricsShowResponseValidationError) Field() string
- func (e MetricsShowResponseValidationError) Key() bool
- func (e MetricsShowResponseValidationError) Reason() string
- type Metrics_StreamShowClient
- type Metrics_StreamShowServer
- type UnimplementedMetricsServer
- type UnsafeMetricsServer
Constants ¶
This section is empty.
Variables ¶
var File_metrics_metrics_proto protoreflect.FileDescriptor
var Metrics_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Metrics", HandlerType: (*MetricsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Show", Handler: _Metrics_Show_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "StreamShow", Handler: _Metrics_StreamShow_Handler, ServerStreams: true, }, }, Metadata: "metrics/metrics.proto", }
Metrics_ServiceDesc is the grpc.ServiceDesc for Metrics service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMetricsHandler ¶
func RegisterMetricsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMetricsHandler registers the http handlers for service Metrics to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMetricsHandlerClient ¶
func RegisterMetricsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsClient) error
RegisterMetricsHandlerClient registers the http handlers for service Metrics to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetricsClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetricsClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MetricsClient" to call the correct interceptors.
func RegisterMetricsHandlerFromEndpoint ¶
func RegisterMetricsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMetricsHandlerFromEndpoint is same as RegisterMetricsHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMetricsHandlerServer ¶
func RegisterMetricsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetricsServer) error
RegisterMetricsHandlerServer registers the http handlers for service Metrics to "mux". UnaryRPC :call MetricsServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMetricsHandlerFromEndpoint instead.
func RegisterMetricsServer ¶
func RegisterMetricsServer(s grpc.ServiceRegistrar, srv MetricsServer)
Types ¶
type MetricsClient ¶
type MetricsClient interface { // Show 获取 pod 的 cpu memory 信息 Show(ctx context.Context, in *MetricsShowRequest, opts ...grpc.CallOption) (*MetricsShowResponse, error) // StreamShow stream 的方式获取 pod 的 cpu memory 信息 StreamShow(ctx context.Context, in *MetricsShowRequest, opts ...grpc.CallOption) (Metrics_StreamShowClient, error) }
MetricsClient is the client API for Metrics 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 NewMetricsClient ¶
func NewMetricsClient(cc grpc.ClientConnInterface) MetricsClient
type MetricsServer ¶
type MetricsServer interface { // Show 获取 pod 的 cpu memory 信息 Show(context.Context, *MetricsShowRequest) (*MetricsShowResponse, error) // StreamShow stream 的方式获取 pod 的 cpu memory 信息 StreamShow(*MetricsShowRequest, Metrics_StreamShowServer) error // contains filtered or unexported methods }
MetricsServer is the server API for Metrics service. All implementations must embed UnimplementedMetricsServer for forward compatibility
type MetricsShowRequest ¶
type MetricsShowRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` Pod string `protobuf:"bytes,2,opt,name=pod,proto3" json:"pod,omitempty"` // contains filtered or unexported fields }
func (*MetricsShowRequest) Descriptor
deprecated
func (*MetricsShowRequest) Descriptor() ([]byte, []int)
Deprecated: Use MetricsShowRequest.ProtoReflect.Descriptor instead.
func (*MetricsShowRequest) GetNamespace ¶
func (x *MetricsShowRequest) GetNamespace() string
func (*MetricsShowRequest) GetPod ¶
func (x *MetricsShowRequest) GetPod() string
func (*MetricsShowRequest) ProtoMessage ¶
func (*MetricsShowRequest) ProtoMessage()
func (*MetricsShowRequest) ProtoReflect ¶
func (x *MetricsShowRequest) ProtoReflect() protoreflect.Message
func (*MetricsShowRequest) Reset ¶
func (x *MetricsShowRequest) Reset()
func (*MetricsShowRequest) String ¶
func (x *MetricsShowRequest) String() string
func (*MetricsShowRequest) Validate ¶
func (m *MetricsShowRequest) Validate() error
Validate checks the field values on MetricsShowRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*MetricsShowRequest) ValidateAll ¶
func (m *MetricsShowRequest) ValidateAll() error
ValidateAll checks the field values on MetricsShowRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in MetricsShowRequestMultiError, or nil if none found.
type MetricsShowRequestMultiError ¶
type MetricsShowRequestMultiError []error
MetricsShowRequestMultiError is an error wrapping multiple validation errors returned by MetricsShowRequest.ValidateAll() if the designated constraints aren't met.
func (MetricsShowRequestMultiError) AllErrors ¶
func (m MetricsShowRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (MetricsShowRequestMultiError) Error ¶
func (m MetricsShowRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type MetricsShowRequestValidationError ¶
type MetricsShowRequestValidationError struct {
// contains filtered or unexported fields
}
MetricsShowRequestValidationError is the validation error returned by MetricsShowRequest.Validate if the designated constraints aren't met.
func (MetricsShowRequestValidationError) Cause ¶
func (e MetricsShowRequestValidationError) Cause() error
Cause function returns cause value.
func (MetricsShowRequestValidationError) Error ¶
func (e MetricsShowRequestValidationError) Error() string
Error satisfies the builtin error interface
func (MetricsShowRequestValidationError) ErrorName ¶
func (e MetricsShowRequestValidationError) ErrorName() string
ErrorName returns error name.
func (MetricsShowRequestValidationError) Field ¶
func (e MetricsShowRequestValidationError) Field() string
Field function returns field value.
func (MetricsShowRequestValidationError) Key ¶
func (e MetricsShowRequestValidationError) Key() bool
Key function returns key value.
func (MetricsShowRequestValidationError) Reason ¶
func (e MetricsShowRequestValidationError) Reason() string
Reason function returns reason value.
type MetricsShowResponse ¶
type MetricsShowResponse struct { Cpu float64 `protobuf:"fixed64,1,opt,name=cpu,proto3" json:"cpu,omitempty"` Memory float64 `protobuf:"fixed64,2,opt,name=memory,proto3" json:"memory,omitempty"` HumanizeCpu string `protobuf:"bytes,3,opt,name=humanize_cpu,json=humanizeCpu,proto3" json:"humanize_cpu,omitempty"` HumanizeMemory string `protobuf:"bytes,4,opt,name=humanize_memory,json=humanizeMemory,proto3" json:"humanize_memory,omitempty"` Time string `protobuf:"bytes,5,opt,name=time,proto3" json:"time,omitempty"` Length int64 `protobuf:"varint,6,opt,name=length,proto3" json:"length,omitempty"` // contains filtered or unexported fields }
func (*MetricsShowResponse) Descriptor
deprecated
func (*MetricsShowResponse) Descriptor() ([]byte, []int)
Deprecated: Use MetricsShowResponse.ProtoReflect.Descriptor instead.
func (*MetricsShowResponse) GetCpu ¶
func (x *MetricsShowResponse) GetCpu() float64
func (*MetricsShowResponse) GetHumanizeCpu ¶
func (x *MetricsShowResponse) GetHumanizeCpu() string
func (*MetricsShowResponse) GetHumanizeMemory ¶
func (x *MetricsShowResponse) GetHumanizeMemory() string
func (*MetricsShowResponse) GetLength ¶
func (x *MetricsShowResponse) GetLength() int64
func (*MetricsShowResponse) GetMemory ¶
func (x *MetricsShowResponse) GetMemory() float64
func (*MetricsShowResponse) GetTime ¶
func (x *MetricsShowResponse) GetTime() string
func (*MetricsShowResponse) ProtoMessage ¶
func (*MetricsShowResponse) ProtoMessage()
func (*MetricsShowResponse) ProtoReflect ¶
func (x *MetricsShowResponse) ProtoReflect() protoreflect.Message
func (*MetricsShowResponse) Reset ¶
func (x *MetricsShowResponse) Reset()
func (*MetricsShowResponse) String ¶
func (x *MetricsShowResponse) String() string
func (*MetricsShowResponse) Validate ¶
func (m *MetricsShowResponse) Validate() error
Validate checks the field values on MetricsShowResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*MetricsShowResponse) ValidateAll ¶
func (m *MetricsShowResponse) ValidateAll() error
ValidateAll checks the field values on MetricsShowResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in MetricsShowResponseMultiError, or nil if none found.
type MetricsShowResponseMultiError ¶
type MetricsShowResponseMultiError []error
MetricsShowResponseMultiError is an error wrapping multiple validation errors returned by MetricsShowResponse.ValidateAll() if the designated constraints aren't met.
func (MetricsShowResponseMultiError) AllErrors ¶
func (m MetricsShowResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (MetricsShowResponseMultiError) Error ¶
func (m MetricsShowResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type MetricsShowResponseValidationError ¶
type MetricsShowResponseValidationError struct {
// contains filtered or unexported fields
}
MetricsShowResponseValidationError is the validation error returned by MetricsShowResponse.Validate if the designated constraints aren't met.
func (MetricsShowResponseValidationError) Cause ¶
func (e MetricsShowResponseValidationError) Cause() error
Cause function returns cause value.
func (MetricsShowResponseValidationError) Error ¶
func (e MetricsShowResponseValidationError) Error() string
Error satisfies the builtin error interface
func (MetricsShowResponseValidationError) ErrorName ¶
func (e MetricsShowResponseValidationError) ErrorName() string
ErrorName returns error name.
func (MetricsShowResponseValidationError) Field ¶
func (e MetricsShowResponseValidationError) Field() string
Field function returns field value.
func (MetricsShowResponseValidationError) Key ¶
func (e MetricsShowResponseValidationError) Key() bool
Key function returns key value.
func (MetricsShowResponseValidationError) Reason ¶
func (e MetricsShowResponseValidationError) Reason() string
Reason function returns reason value.
type Metrics_StreamShowClient ¶
type Metrics_StreamShowClient interface { Recv() (*MetricsShowResponse, error) grpc.ClientStream }
type Metrics_StreamShowServer ¶
type Metrics_StreamShowServer interface { Send(*MetricsShowResponse) error grpc.ServerStream }
type UnimplementedMetricsServer ¶
type UnimplementedMetricsServer struct { }
UnimplementedMetricsServer must be embedded to have forward compatible implementations.
func (UnimplementedMetricsServer) Show ¶
func (UnimplementedMetricsServer) Show(context.Context, *MetricsShowRequest) (*MetricsShowResponse, error)
func (UnimplementedMetricsServer) StreamShow ¶
func (UnimplementedMetricsServer) StreamShow(*MetricsShowRequest, Metrics_StreamShowServer) error
type UnsafeMetricsServer ¶
type UnsafeMetricsServer interface {
// contains filtered or unexported methods
}
UnsafeMetricsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MetricsServer will result in compilation errors.