api

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_sampler_api_api_proto protoreflect.FileDescriptor
View Source
var Health_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "containerd.api.Health",
	HandlerType: (*HealthServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Check",
			Handler:    _Health_Check_Handler,
		},
		{
			MethodName: "IsLeader",
			Handler:    _Health_IsLeader_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/sampler/api/api.proto",
}

Health_ServiceDesc is the grpc.ServiceDesc for Health service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var MetricsCollector_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "containerd.api.MetricsCollector",
	HandlerType: (*MetricsCollectorServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "PushMetrics",
			Handler:       _MetricsCollector_PushMetrics_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "pkg/sampler/api/api.proto",
}

MetricsCollector_ServiceDesc is the grpc.ServiceDesc for MetricsCollector service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var Metrics_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "containerd.api.Metrics",
	HandlerType: (*MetricsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListMetrics",
			Handler:    _Metrics_ListMetrics_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/sampler/api/api.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 RegisterHealthHandler

func RegisterHealthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterHealthHandler registers the http handlers for service Health to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterHealthHandlerClient

func RegisterHealthHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HealthClient) error

RegisterHealthHandlerClient registers the http handlers for service Health to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HealthClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HealthClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HealthClient" to call the correct interceptors.

func RegisterHealthHandlerFromEndpoint

func RegisterHealthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHealthHandlerFromEndpoint is same as RegisterHealthHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHealthHandlerServer

func RegisterHealthHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HealthServer) error

RegisterHealthHandlerServer registers the http handlers for service Health to "mux". UnaryRPC :call HealthServer 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 RegisterHealthHandlerFromEndpoint instead.

func RegisterHealthServer

func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer)

func RegisterMetricsCollectorServer

func RegisterMetricsCollectorServer(s grpc.ServiceRegistrar, srv MetricsCollectorServer)

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 ConfigurePush

type ConfigurePush struct {
	// contains filtered or unexported fields
}

func (*ConfigurePush) Descriptor deprecated

func (*ConfigurePush) Descriptor() ([]byte, []int)

Deprecated: Use ConfigurePush.ProtoReflect.Descriptor instead.

func (*ConfigurePush) ProtoMessage

func (*ConfigurePush) ProtoMessage()

func (*ConfigurePush) ProtoReflect

func (x *ConfigurePush) ProtoReflect() protoreflect.Message

func (*ConfigurePush) Reset

func (x *ConfigurePush) Reset()

func (*ConfigurePush) String

func (x *ConfigurePush) String() string

type ContainerMetrics

type ContainerMetrics struct {
	ContainerID                string    `protobuf:"bytes,1,opt,name=containerID,proto3" json:"containerID,omitempty"`
	PodUID                     string    `protobuf:"bytes,2,opt,name=podUID,proto3" json:"podUID,omitempty"`
	CpuCoresNanoSec            []int64   `protobuf:"varint,3,rep,packed,name=cpuCoresNanoSec,proto3" json:"cpuCoresNanoSec,omitempty"`
	MemoryBytes                []int64   `protobuf:"varint,4,rep,packed,name=memoryBytes,proto3" json:"memoryBytes,omitempty"`
	OomCount                   []int64   `protobuf:"varint,5,rep,packed,name=oomCount,proto3" json:"oomCount,omitempty"`
	OomKillCount               []int64   `protobuf:"varint,6,rep,packed,name=oomKillCount,proto3" json:"oomKillCount,omitempty"`
	CpuThrottledNanoSec        []int64   `protobuf:"varint,7,rep,packed,name=cpuThrottledNanoSec,proto3" json:"cpuThrottledNanoSec,omitempty"`
	CpuPercentPeriodsThrottled []float32 `protobuf:"fixed32,8,rep,packed,name=cpuPercentPeriodsThrottled,proto3" json:"cpuPercentPeriodsThrottled,omitempty"`
	NodeName                   string    `protobuf:"bytes,9,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	// contains filtered or unexported fields
}

func (*ContainerMetrics) Descriptor deprecated

func (*ContainerMetrics) Descriptor() ([]byte, []int)

Deprecated: Use ContainerMetrics.ProtoReflect.Descriptor instead.

func (*ContainerMetrics) GetContainerID

func (x *ContainerMetrics) GetContainerID() string

func (*ContainerMetrics) GetCpuCoresNanoSec

func (x *ContainerMetrics) GetCpuCoresNanoSec() []int64

func (*ContainerMetrics) GetCpuPercentPeriodsThrottled

func (x *ContainerMetrics) GetCpuPercentPeriodsThrottled() []float32

func (*ContainerMetrics) GetCpuThrottledNanoSec

func (x *ContainerMetrics) GetCpuThrottledNanoSec() []int64

func (*ContainerMetrics) GetMemoryBytes

func (x *ContainerMetrics) GetMemoryBytes() []int64

func (*ContainerMetrics) GetNodeName

func (x *ContainerMetrics) GetNodeName() string

func (*ContainerMetrics) GetOomCount

func (x *ContainerMetrics) GetOomCount() []int64

func (*ContainerMetrics) GetOomKillCount

func (x *ContainerMetrics) GetOomKillCount() []int64

func (*ContainerMetrics) GetPodUID

func (x *ContainerMetrics) GetPodUID() string

func (*ContainerMetrics) ProtoMessage

func (*ContainerMetrics) ProtoMessage()

func (*ContainerMetrics) ProtoReflect

func (x *ContainerMetrics) ProtoReflect() protoreflect.Message

func (*ContainerMetrics) Reset

func (x *ContainerMetrics) Reset()

func (*ContainerMetrics) String

func (x *ContainerMetrics) String() string

type HealthClient

HealthClient is the client API for Health 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 NewHealthClient

func NewHealthClient(cc grpc.ClientConnInterface) HealthClient

type HealthServer

type HealthServer interface {
	Check(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
	IsLeader(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
	// contains filtered or unexported methods
}

HealthServer is the server API for Health service. All implementations must embed UnimplementedHealthServer for forward compatibility

type ListMetricsRequest

type ListMetricsRequest struct {
	// contains filtered or unexported fields
}

func (*ListMetricsRequest) Descriptor deprecated

func (*ListMetricsRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListMetricsRequest.ProtoReflect.Descriptor instead.

func (*ListMetricsRequest) ProtoMessage

func (*ListMetricsRequest) ProtoMessage()

func (*ListMetricsRequest) ProtoReflect

func (x *ListMetricsRequest) ProtoReflect() protoreflect.Message

func (*ListMetricsRequest) Reset

func (x *ListMetricsRequest) Reset()

func (*ListMetricsRequest) String

func (x *ListMetricsRequest) String() string

type ListMetricsResponse

type ListMetricsResponse struct {
	Containers []*ContainerMetrics    `protobuf:"bytes,1,rep,name=containers,proto3" json:"containers,omitempty"`
	Node       *NodeMetrics           `protobuf:"bytes,2,opt,name=node,proto3" json:"node,omitempty"`
	NodeName   string                 `protobuf:"bytes,3,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	PodName    string                 `protobuf:"bytes,4,opt,name=podName,proto3" json:"podName,omitempty"`
	Timestamp  *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Reason     string                 `protobuf:"bytes,6,opt,name=reason,proto3" json:"reason,omitempty"`
	// contains filtered or unexported fields
}

func (*ListMetricsResponse) Descriptor deprecated

func (*ListMetricsResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListMetricsResponse.ProtoReflect.Descriptor instead.

func (*ListMetricsResponse) GetContainers

func (x *ListMetricsResponse) GetContainers() []*ContainerMetrics

func (*ListMetricsResponse) GetNode

func (x *ListMetricsResponse) GetNode() *NodeMetrics

func (*ListMetricsResponse) GetNodeName

func (x *ListMetricsResponse) GetNodeName() string

func (*ListMetricsResponse) GetPodName

func (x *ListMetricsResponse) GetPodName() string

func (*ListMetricsResponse) GetReason

func (x *ListMetricsResponse) GetReason() string

func (*ListMetricsResponse) GetTimestamp

func (x *ListMetricsResponse) GetTimestamp() *timestamppb.Timestamp

func (*ListMetricsResponse) ProtoMessage

func (*ListMetricsResponse) ProtoMessage()

func (*ListMetricsResponse) ProtoReflect

func (x *ListMetricsResponse) ProtoReflect() protoreflect.Message

func (*ListMetricsResponse) Reset

func (x *ListMetricsResponse) Reset()

func (*ListMetricsResponse) String

func (x *ListMetricsResponse) String() string

type MetricsClient

type MetricsClient interface {
	ListMetrics(ctx context.Context, in *ListMetricsRequest, opts ...grpc.CallOption) (*ListMetricsResponse, 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 MetricsCollectorClient

type MetricsCollectorClient interface {
	PushMetrics(ctx context.Context, opts ...grpc.CallOption) (MetricsCollector_PushMetricsClient, error)
}

MetricsCollectorClient is the client API for MetricsCollector 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.

type MetricsCollectorServer

type MetricsCollectorServer interface {
	PushMetrics(MetricsCollector_PushMetricsServer) error
	// contains filtered or unexported methods
}

MetricsCollectorServer is the server API for MetricsCollector service. All implementations must embed UnimplementedMetricsCollectorServer for forward compatibility

type MetricsCollector_PushMetricsClient

type MetricsCollector_PushMetricsClient interface {
	Send(*ListMetricsResponse) error
	Recv() (*ConfigurePush, error)
	grpc.ClientStream
}

type MetricsCollector_PushMetricsServer

type MetricsCollector_PushMetricsServer interface {
	Send(*ConfigurePush) error
	Recv() (*ListMetricsResponse, error)
	grpc.ServerStream
}

type MetricsServer

type MetricsServer interface {
	ListMetrics(context.Context, *ListMetricsRequest) (*ListMetricsResponse, error)
	// contains filtered or unexported methods
}

MetricsServer is the server API for Metrics service. All implementations must embed UnimplementedMetricsServer for forward compatibility

type NodeAggregatedMetrics

type NodeAggregatedMetrics struct {
	AggregationLevel string  `protobuf:"bytes,1,opt,name=aggregationLevel,proto3" json:"aggregationLevel,omitempty"`
	CpuCoresNanoSec  []int64 `protobuf:"varint,2,rep,packed,name=cpuCoresNanoSec,proto3" json:"cpuCoresNanoSec,omitempty"`
	MemoryBytes      []int64 `protobuf:"varint,3,rep,packed,name=memoryBytes,proto3" json:"memoryBytes,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeAggregatedMetrics) Descriptor deprecated

func (*NodeAggregatedMetrics) Descriptor() ([]byte, []int)

Deprecated: Use NodeAggregatedMetrics.ProtoReflect.Descriptor instead.

func (*NodeAggregatedMetrics) GetAggregationLevel

func (x *NodeAggregatedMetrics) GetAggregationLevel() string

func (*NodeAggregatedMetrics) GetCpuCoresNanoSec

func (x *NodeAggregatedMetrics) GetCpuCoresNanoSec() []int64

func (*NodeAggregatedMetrics) GetMemoryBytes

func (x *NodeAggregatedMetrics) GetMemoryBytes() []int64

func (*NodeAggregatedMetrics) ProtoMessage

func (*NodeAggregatedMetrics) ProtoMessage()

func (*NodeAggregatedMetrics) ProtoReflect

func (x *NodeAggregatedMetrics) ProtoReflect() protoreflect.Message

func (*NodeAggregatedMetrics) Reset

func (x *NodeAggregatedMetrics) Reset()

func (*NodeAggregatedMetrics) String

func (x *NodeAggregatedMetrics) String() string

type NodeMetrics

type NodeMetrics struct {
	AggregatedMetrics []*NodeAggregatedMetrics `protobuf:"bytes,1,rep,name=aggregatedMetrics,proto3" json:"aggregatedMetrics,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeMetrics) Descriptor deprecated

func (*NodeMetrics) Descriptor() ([]byte, []int)

Deprecated: Use NodeMetrics.ProtoReflect.Descriptor instead.

func (*NodeMetrics) GetAggregatedMetrics

func (x *NodeMetrics) GetAggregatedMetrics() []*NodeAggregatedMetrics

func (*NodeMetrics) ProtoMessage

func (*NodeMetrics) ProtoMessage()

func (*NodeMetrics) ProtoReflect

func (x *NodeMetrics) ProtoReflect() protoreflect.Message

func (*NodeMetrics) Reset

func (x *NodeMetrics) Reset()

func (*NodeMetrics) String

func (x *NodeMetrics) String() string

type UnimplementedHealthServer

type UnimplementedHealthServer struct {
}

UnimplementedHealthServer must be embedded to have forward compatible implementations.

type UnimplementedMetricsCollectorServer

type UnimplementedMetricsCollectorServer struct {
}

UnimplementedMetricsCollectorServer must be embedded to have forward compatible implementations.

func (UnimplementedMetricsCollectorServer) PushMetrics

type UnimplementedMetricsServer

type UnimplementedMetricsServer struct {
}

UnimplementedMetricsServer must be embedded to have forward compatible implementations.

func (UnimplementedMetricsServer) ListMetrics

type UnsafeHealthServer

type UnsafeHealthServer interface {
	// contains filtered or unexported methods
}

UnsafeHealthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HealthServer will result in compilation errors.

type UnsafeMetricsCollectorServer

type UnsafeMetricsCollectorServer interface {
	// contains filtered or unexported methods
}

UnsafeMetricsCollectorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MetricsCollectorServer will result in compilation errors.

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