Documentation
¶
Overview ¶
Package inspect serves grpcproc.inspect.v1.Inspector: a node's processes, links and events over gRPC, for tools and for people. It is optional — register it next to the node on the same server, behind whatever interceptors guard the application's other services.
node.Register(grpcServer) inspect.New(node).Register(grpcServer)
A request for another node is forwarded to that node's Inspector, reached as the node reaches its peers (Node.Dial), so one Inspector answers for the whole cluster.
Index ¶
- func Event(e *inspectv1.Event) grpcproc.Event
- func NodeInfo(n *inspectv1.NodeInfo) grpcproc.NodeInfo
- func ProcessInfo(p *inspectv1.ProcessInfo) grpcproc.ProcessInfo
- type Option
- type PeerFunc
- type Server
- func (s *Server) Call(ctx context.Context, req *inspectv1.CallRequest) (*inspectv1.CallResponse, error)
- func (s *Server) Close() error
- func (s *Server) Exit(ctx context.Context, req *inspectv1.ExitRequest) (*inspectv1.ExitResponse, error)
- func (s *Server) GetNode(ctx context.Context, req *inspectv1.GetNodeRequest) (*inspectv1.GetNodeResponse, error)
- func (s *Server) GetProcess(ctx context.Context, req *inspectv1.GetProcessRequest) (*inspectv1.GetProcessResponse, error)
- func (s *Server) ListNames(ctx context.Context, req *inspectv1.ListNamesRequest) (*inspectv1.ListNamesResponse, error)
- func (s *Server) ListProcesses(ctx context.Context, req *inspectv1.ListProcessesRequest) (*inspectv1.ListProcessesResponse, error)
- func (s *Server) LookupName(ctx context.Context, req *inspectv1.LookupNameRequest) (*inspectv1.LookupNameResponse, error)
- func (s *Server) Register(r grpc.ServiceRegistrar)
- func (s *Server) Send(ctx context.Context, req *inspectv1.SendRequest) (*inspectv1.SendResponse, error)
- func (s *Server) SetLogLevel(ctx context.Context, req *inspectv1.SetLogLevelRequest) (*inspectv1.SetLogLevelResponse, error)
- func (s *Server) Watch(req *inspectv1.WatchRequest, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessInfo ¶
func ProcessInfo(p *inspectv1.ProcessInfo) grpcproc.ProcessInfo
ProcessInfo converts a wire ProcessInfo back to grpcproc's.
Types ¶
type Option ¶
type Option func(*Server)
Option configures a Server.
func ReadOnly ¶
func ReadOnly() Option
ReadOnly refuses SetLogLevel, Send, Call and Exit with PermissionDenied.
func WithPeers ¶
WithPeers is WithResolver for other ways of reaching a node's Inspector. Whichever of the two comes last is used. Close does not release what f holds. WithPeers(nil) keeps the server to its own node: a request for another node is then FailedPrecondition.
func WithResolver ¶
func WithResolver(r grpcproc.Resolver, opts ...grpc.DialOption) Option
WithResolver has the server reach other nodes' Inspectors through r and opts rather than the node's own Dial: for Inspectors that peers serve elsewhere than on the server their node links through, or over other credentials. It keeps one connection per node, until Close.
type Server ¶
type Server struct {
inspectv1.UnimplementedInspectorServer
// contains filtered or unexported fields
}
Server implements grpcproc.inspect.v1.Inspector for one node.
func New ¶
New returns an Inspector for node. It forwards a request for another node to that node's Inspector, which it reaches through node.Dial, unless WithResolver or WithPeers says otherwise.
func (*Server) Call ¶ added in v0.1.0
func (s *Server) Call(ctx context.Context, req *inspectv1.CallRequest) (*inspectv1.CallResponse, error)
func (*Server) Close ¶
Close closes the connections the server opened to other nodes. It keeps answering for its own node; a request for another node fails from then on (Unavailable, or Canceled if it was already on its way), but with WithPeers, whose connections are not its own.
func (*Server) Exit ¶
func (s *Server) Exit(ctx context.Context, req *inspectv1.ExitRequest) (*inspectv1.ExitResponse, error)
func (*Server) GetNode ¶
func (s *Server) GetNode(ctx context.Context, req *inspectv1.GetNodeRequest) (*inspectv1.GetNodeResponse, error)
func (*Server) GetProcess ¶
func (s *Server) GetProcess(ctx context.Context, req *inspectv1.GetProcessRequest) (*inspectv1.GetProcessResponse, error)
func (*Server) ListNames ¶ added in v0.4.0
func (s *Server) ListNames(ctx context.Context, req *inspectv1.ListNamesRequest) (*inspectv1.ListNamesResponse, error)
func (*Server) ListProcesses ¶
func (s *Server) ListProcesses(ctx context.Context, req *inspectv1.ListProcessesRequest) (*inspectv1.ListProcessesResponse, error)
func (*Server) LookupName ¶ added in v0.4.0
func (s *Server) LookupName(ctx context.Context, req *inspectv1.LookupNameRequest) (*inspectv1.LookupNameResponse, error)
func (*Server) Register ¶
func (s *Server) Register(r grpc.ServiceRegistrar)
Register mounts the Inspector on r.
func (*Server) Send ¶
func (s *Server) Send(ctx context.Context, req *inspectv1.SendRequest) (*inspectv1.SendResponse, error)
func (*Server) SetLogLevel ¶
func (s *Server) SetLogLevel(ctx context.Context, req *inspectv1.SetLogLevelRequest) (*inspectv1.SetLogLevelResponse, error)
func (*Server) Watch ¶
func (s *Server) Watch(req *inspectv1.WatchRequest, stream grpc.ServerStreamingServer[inspectv1.WatchResponse]) error