Runtime logs (#1447)
* Runtime logs * Slightly broken * Pushing for diff * Log trailing works locally * LogsOptions * Comments and streamcount support for local logs * Adding kubernetes logs * Fixing k8s logs * K8s fixes * StreamCount is now nuked * PR comments * PR comments again * Fix typo
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: runtime/service/proto/runtime.proto
|
||||
// source: micro/go-micro/runtime/service/proto/runtime.proto
|
||||
|
||||
package go_micro_runtime
|
||||
|
||||
@@ -39,6 +39,7 @@ type RuntimeService interface {
|
||||
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
||||
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
|
||||
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
Logs(ctx context.Context, in *LogsRequest, opts ...client.CallOption) (Runtime_LogsService, error)
|
||||
}
|
||||
|
||||
type runtimeService struct {
|
||||
@@ -103,6 +104,55 @@ func (c *runtimeService) List(ctx context.Context, in *ListRequest, opts ...clie
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *runtimeService) Logs(ctx context.Context, in *LogsRequest, opts ...client.CallOption) (Runtime_LogsService, error) {
|
||||
req := c.c.NewRequest(c.name, "Runtime.Logs", &LogsRequest{})
|
||||
stream, err := c.c.Stream(ctx, req, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := stream.Send(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &runtimeServiceLogs{stream}, nil
|
||||
}
|
||||
|
||||
type Runtime_LogsService interface {
|
||||
Context() context.Context
|
||||
SendMsg(interface{}) error
|
||||
RecvMsg(interface{}) error
|
||||
Close() error
|
||||
Recv() (*LogRecord, error)
|
||||
}
|
||||
|
||||
type runtimeServiceLogs struct {
|
||||
stream client.Stream
|
||||
}
|
||||
|
||||
func (x *runtimeServiceLogs) Close() error {
|
||||
return x.stream.Close()
|
||||
}
|
||||
|
||||
func (x *runtimeServiceLogs) Context() context.Context {
|
||||
return x.stream.Context()
|
||||
}
|
||||
|
||||
func (x *runtimeServiceLogs) SendMsg(m interface{}) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
||||
|
||||
func (x *runtimeServiceLogs) RecvMsg(m interface{}) error {
|
||||
return x.stream.Recv(m)
|
||||
}
|
||||
|
||||
func (x *runtimeServiceLogs) Recv() (*LogRecord, error) {
|
||||
m := new(LogRecord)
|
||||
err := x.stream.Recv(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for Runtime service
|
||||
|
||||
type RuntimeHandler interface {
|
||||
@@ -111,6 +161,7 @@ type RuntimeHandler interface {
|
||||
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
||||
Update(context.Context, *UpdateRequest, *UpdateResponse) error
|
||||
List(context.Context, *ListRequest, *ListResponse) error
|
||||
Logs(context.Context, *LogsRequest, Runtime_LogsStream) error
|
||||
}
|
||||
|
||||
func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error {
|
||||
@@ -120,6 +171,7 @@ func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server
|
||||
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
||||
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
|
||||
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
||||
Logs(ctx context.Context, stream server.Stream) error
|
||||
}
|
||||
type Runtime struct {
|
||||
runtime
|
||||
@@ -151,3 +203,43 @@ func (h *runtimeHandler) Update(ctx context.Context, in *UpdateRequest, out *Upd
|
||||
func (h *runtimeHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
||||
return h.RuntimeHandler.List(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *runtimeHandler) Logs(ctx context.Context, stream server.Stream) error {
|
||||
m := new(LogsRequest)
|
||||
if err := stream.Recv(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return h.RuntimeHandler.Logs(ctx, m, &runtimeLogsStream{stream})
|
||||
}
|
||||
|
||||
type Runtime_LogsStream interface {
|
||||
Context() context.Context
|
||||
SendMsg(interface{}) error
|
||||
RecvMsg(interface{}) error
|
||||
Close() error
|
||||
Send(*LogRecord) error
|
||||
}
|
||||
|
||||
type runtimeLogsStream struct {
|
||||
stream server.Stream
|
||||
}
|
||||
|
||||
func (x *runtimeLogsStream) Close() error {
|
||||
return x.stream.Close()
|
||||
}
|
||||
|
||||
func (x *runtimeLogsStream) Context() context.Context {
|
||||
return x.stream.Context()
|
||||
}
|
||||
|
||||
func (x *runtimeLogsStream) SendMsg(m interface{}) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
||||
|
||||
func (x *runtimeLogsStream) RecvMsg(m interface{}) error {
|
||||
return x.stream.Recv(m)
|
||||
}
|
||||
|
||||
func (x *runtimeLogsStream) Send(m *LogRecord) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
||||
|
Reference in New Issue
Block a user