Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterKernelTelemetryServer(s grpc.ServiceRegistrar, srv KernelTelemetryServer)
- type GetDashboardRequest
- func (*GetDashboardRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetDashboardRequest) GetRefresh() bool
- func (*GetDashboardRequest) ProtoMessage()
- func (x *GetDashboardRequest) ProtoReflect() protoreflect.Message
- func (x *GetDashboardRequest) Reset()
- func (x *GetDashboardRequest) String() string
- type GetDashboardResponse
- func (*GetDashboardResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetDashboardResponse) GetActiveNodes() int64
- func (x *GetDashboardResponse) GetActiveUsers() int64
- func (x *GetDashboardResponse) GetBannedUsers() int64
- func (x *GetDashboardResponse) GetCachedAt() string
- func (x *GetDashboardResponse) GetExpiredUsers() int64
- func (x *GetDashboardResponse) GetMonthlyIncome() int64
- func (x *GetDashboardResponse) GetOnlineUsers() int64
- func (x *GetDashboardResponse) GetPaidOrders() int64
- func (x *GetDashboardResponse) GetPendingOrders() int64
- func (x *GetDashboardResponse) GetTodayIncome() int64
- func (x *GetDashboardResponse) GetTodayNewUsers() int64
- func (x *GetDashboardResponse) GetTodayTraffic() int64
- func (x *GetDashboardResponse) GetTotalNodes() int64
- func (x *GetDashboardResponse) GetTotalOrders() int64
- func (x *GetDashboardResponse) GetTotalRevenue() int64
- func (x *GetDashboardResponse) GetTotalTrafficUsed() int64
- func (x *GetDashboardResponse) GetTotalUsers() int64
- func (*GetDashboardResponse) ProtoMessage()
- func (x *GetDashboardResponse) ProtoReflect() protoreflect.Message
- func (x *GetDashboardResponse) Reset()
- func (x *GetDashboardResponse) String() string
- type KernelTelemetryClient
- type KernelTelemetryServer
- type UnimplementedKernelTelemetryServer
- type UnsafeKernelTelemetryServer
Constants ¶
const (
KernelTelemetry_GetDashboard_FullMethodName = "/anixops.kerneltelemetry.v1.KernelTelemetry/GetDashboard"
)
Variables ¶
var File_api_kerneltelemetry_v1_kernel_telemetry_proto protoreflect.FileDescriptor
var KernelTelemetry_ServiceDesc = grpc.ServiceDesc{ ServiceName: "anixops.kerneltelemetry.v1.KernelTelemetry", HandlerType: (*KernelTelemetryServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetDashboard", Handler: _KernelTelemetry_GetDashboard_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/kerneltelemetry/v1/kernel_telemetry.proto", }
KernelTelemetry_ServiceDesc is the grpc.ServiceDesc for KernelTelemetry service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterKernelTelemetryServer ¶
func RegisterKernelTelemetryServer(s grpc.ServiceRegistrar, srv KernelTelemetryServer)
Types ¶
type GetDashboardRequest ¶
type GetDashboardRequest struct {
// refresh rebuilds the snapshot from the database and replaces the cached
// one, as the v2 route's refresh=true does.
Refresh bool `protobuf:"varint,1,opt,name=refresh,proto3" json:"refresh,omitempty"`
// contains filtered or unexported fields
}
func (*GetDashboardRequest) Descriptor
deprecated
func (*GetDashboardRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetDashboardRequest.ProtoReflect.Descriptor instead.
func (*GetDashboardRequest) GetRefresh ¶
func (x *GetDashboardRequest) GetRefresh() bool
func (*GetDashboardRequest) ProtoMessage ¶
func (*GetDashboardRequest) ProtoMessage()
func (*GetDashboardRequest) ProtoReflect ¶
func (x *GetDashboardRequest) ProtoReflect() protoreflect.Message
func (*GetDashboardRequest) Reset ¶
func (x *GetDashboardRequest) Reset()
func (*GetDashboardRequest) String ¶
func (x *GetDashboardRequest) String() string
type GetDashboardResponse ¶
type GetDashboardResponse struct {
TotalUsers int64 `protobuf:"varint,1,opt,name=total_users,json=totalUsers,proto3" json:"total_users,omitempty"`
ActiveUsers int64 `protobuf:"varint,2,opt,name=active_users,json=activeUsers,proto3" json:"active_users,omitempty"`
ExpiredUsers int64 `protobuf:"varint,3,opt,name=expired_users,json=expiredUsers,proto3" json:"expired_users,omitempty"`
BannedUsers int64 `protobuf:"varint,4,opt,name=banned_users,json=bannedUsers,proto3" json:"banned_users,omitempty"`
TodayNewUsers int64 `protobuf:"varint,5,opt,name=today_new_users,json=todayNewUsers,proto3" json:"today_new_users,omitempty"`
TotalOrders int64 `protobuf:"varint,6,opt,name=total_orders,json=totalOrders,proto3" json:"total_orders,omitempty"`
PendingOrders int64 `protobuf:"varint,7,opt,name=pending_orders,json=pendingOrders,proto3" json:"pending_orders,omitempty"`
PaidOrders int64 `protobuf:"varint,8,opt,name=paid_orders,json=paidOrders,proto3" json:"paid_orders,omitempty"`
TotalRevenue int64 `protobuf:"varint,9,opt,name=total_revenue,json=totalRevenue,proto3" json:"total_revenue,omitempty"`
MonthlyIncome int64 `protobuf:"varint,10,opt,name=monthly_income,json=monthlyIncome,proto3" json:"monthly_income,omitempty"`
TodayIncome int64 `protobuf:"varint,11,opt,name=today_income,json=todayIncome,proto3" json:"today_income,omitempty"`
TotalNodes int64 `protobuf:"varint,12,opt,name=total_nodes,json=totalNodes,proto3" json:"total_nodes,omitempty"`
ActiveNodes int64 `protobuf:"varint,13,opt,name=active_nodes,json=activeNodes,proto3" json:"active_nodes,omitempty"`
// online_users counts the users in the kernel's alive set.
OnlineUsers int64 `protobuf:"varint,14,opt,name=online_users,json=onlineUsers,proto3" json:"online_users,omitempty"`
TotalTrafficUsed int64 `protobuf:"varint,15,opt,name=total_traffic_used,json=totalTrafficUsed,proto3" json:"total_traffic_used,omitempty"`
TodayTraffic int64 `protobuf:"varint,16,opt,name=today_traffic,json=todayTraffic,proto3" json:"today_traffic,omitempty"`
// cached_at is when the kernel built the snapshot: RFC 3339 with its
// fraction and offset, as encoding/json writes the kernel's time, so a
// module answers it byte for byte.
CachedAt string `protobuf:"bytes,17,opt,name=cached_at,json=cachedAt,proto3" json:"cached_at,omitempty"`
// contains filtered or unexported fields
}
GetDashboardResponse is the snapshot, field for field the kernel's service.DashboardStats. Amounts are in cents, traffic in bytes.
func (*GetDashboardResponse) Descriptor
deprecated
func (*GetDashboardResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetDashboardResponse.ProtoReflect.Descriptor instead.
func (*GetDashboardResponse) GetActiveNodes ¶
func (x *GetDashboardResponse) GetActiveNodes() int64
func (*GetDashboardResponse) GetActiveUsers ¶
func (x *GetDashboardResponse) GetActiveUsers() int64
func (*GetDashboardResponse) GetBannedUsers ¶
func (x *GetDashboardResponse) GetBannedUsers() int64
func (*GetDashboardResponse) GetCachedAt ¶
func (x *GetDashboardResponse) GetCachedAt() string
func (*GetDashboardResponse) GetExpiredUsers ¶
func (x *GetDashboardResponse) GetExpiredUsers() int64
func (*GetDashboardResponse) GetMonthlyIncome ¶
func (x *GetDashboardResponse) GetMonthlyIncome() int64
func (*GetDashboardResponse) GetOnlineUsers ¶
func (x *GetDashboardResponse) GetOnlineUsers() int64
func (*GetDashboardResponse) GetPaidOrders ¶
func (x *GetDashboardResponse) GetPaidOrders() int64
func (*GetDashboardResponse) GetPendingOrders ¶
func (x *GetDashboardResponse) GetPendingOrders() int64
func (*GetDashboardResponse) GetTodayIncome ¶
func (x *GetDashboardResponse) GetTodayIncome() int64
func (*GetDashboardResponse) GetTodayNewUsers ¶
func (x *GetDashboardResponse) GetTodayNewUsers() int64
func (*GetDashboardResponse) GetTodayTraffic ¶
func (x *GetDashboardResponse) GetTodayTraffic() int64
func (*GetDashboardResponse) GetTotalNodes ¶
func (x *GetDashboardResponse) GetTotalNodes() int64
func (*GetDashboardResponse) GetTotalOrders ¶
func (x *GetDashboardResponse) GetTotalOrders() int64
func (*GetDashboardResponse) GetTotalRevenue ¶
func (x *GetDashboardResponse) GetTotalRevenue() int64
func (*GetDashboardResponse) GetTotalTrafficUsed ¶
func (x *GetDashboardResponse) GetTotalTrafficUsed() int64
func (*GetDashboardResponse) GetTotalUsers ¶
func (x *GetDashboardResponse) GetTotalUsers() int64
func (*GetDashboardResponse) ProtoMessage ¶
func (*GetDashboardResponse) ProtoMessage()
func (*GetDashboardResponse) ProtoReflect ¶
func (x *GetDashboardResponse) ProtoReflect() protoreflect.Message
func (*GetDashboardResponse) Reset ¶
func (x *GetDashboardResponse) Reset()
func (*GetDashboardResponse) String ¶
func (x *GetDashboardResponse) String() string
type KernelTelemetryClient ¶
type KernelTelemetryClient interface {
// GetDashboard answers the administrator dashboard's snapshot, as the v2
// route GET /api/v2/admin/dashboard shows it. The kernel caches the
// snapshot for 60 seconds in its memory; GetDashboard answers the cached
// one, or builds, caches and answers a new one when none is cached or
// refresh is set.
//
// online_users is a count of the alive set node reports keep in the
// kernel's memory; the set itself never leaves the kernel.
//
// INTERNAL when building the snapshot fails; the message is the kernel's
// error, which the v2 route shows the administrator after
// "获取统计失败: ".
GetDashboard(ctx context.Context, in *GetDashboardRequest, opts ...grpc.CallOption) (*GetDashboardResponse, error)
}
KernelTelemetryClient is the client API for KernelTelemetry 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.
KernelTelemetry is the kernel's contract for the telemetry it computes and caches in its own memory (docs/architecture/kernel-caches.md). The kernel keeps the cache: a module reads the cached answer through this contract instead of keeping a copy, so whichever side answers a route, legacy handler or module, answers the same snapshot with the same cached_at, and a refresh rebuilds the one cache both read.
It is served on the module listener and the local package bridge to official packages, by capability:
- kernel.telemetry.dashboard.v1: GetDashboard
func NewKernelTelemetryClient ¶
func NewKernelTelemetryClient(cc grpc.ClientConnInterface) KernelTelemetryClient
type KernelTelemetryServer ¶
type KernelTelemetryServer interface {
// GetDashboard answers the administrator dashboard's snapshot, as the v2
// route GET /api/v2/admin/dashboard shows it. The kernel caches the
// snapshot for 60 seconds in its memory; GetDashboard answers the cached
// one, or builds, caches and answers a new one when none is cached or
// refresh is set.
//
// online_users is a count of the alive set node reports keep in the
// kernel's memory; the set itself never leaves the kernel.
//
// INTERNAL when building the snapshot fails; the message is the kernel's
// error, which the v2 route shows the administrator after
// "获取统计失败: ".
GetDashboard(context.Context, *GetDashboardRequest) (*GetDashboardResponse, error)
// contains filtered or unexported methods
}
KernelTelemetryServer is the server API for KernelTelemetry service. All implementations must embed UnimplementedKernelTelemetryServer for forward compatibility.
KernelTelemetry is the kernel's contract for the telemetry it computes and caches in its own memory (docs/architecture/kernel-caches.md). The kernel keeps the cache: a module reads the cached answer through this contract instead of keeping a copy, so whichever side answers a route, legacy handler or module, answers the same snapshot with the same cached_at, and a refresh rebuilds the one cache both read.
It is served on the module listener and the local package bridge to official packages, by capability:
- kernel.telemetry.dashboard.v1: GetDashboard
type UnimplementedKernelTelemetryServer ¶
type UnimplementedKernelTelemetryServer struct{}
UnimplementedKernelTelemetryServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedKernelTelemetryServer) GetDashboard ¶
func (UnimplementedKernelTelemetryServer) GetDashboard(context.Context, *GetDashboardRequest) (*GetDashboardResponse, error)
type UnsafeKernelTelemetryServer ¶
type UnsafeKernelTelemetryServer interface {
// contains filtered or unexported methods
}
UnsafeKernelTelemetryServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to KernelTelemetryServer will result in compilation errors.