metrics

package
v0.0.0-...-51115e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package metrics is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_metrics_metrics_proto protoreflect.FileDescriptor
View Source
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

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

Cause function returns cause value.

func (MetricsShowRequestValidationError) Error

Error satisfies the builtin error interface

func (MetricsShowRequestValidationError) ErrorName

ErrorName returns error name.

func (MetricsShowRequestValidationError) Field

Field function returns field value.

func (MetricsShowRequestValidationError) Key

Key function returns key value.

func (MetricsShowRequestValidationError) Reason

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

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

Cause function returns cause value.

func (MetricsShowResponseValidationError) Error

Error satisfies the builtin error interface

func (MetricsShowResponseValidationError) ErrorName

ErrorName returns error name.

func (MetricsShowResponseValidationError) Field

Field function returns field value.

func (MetricsShowResponseValidationError) Key

Key function returns key value.

func (MetricsShowResponseValidationError) Reason

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) StreamShow

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL