profiler

package
v0.0.0-...-f7a5b1a Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name string

	ClientContext
	// contains filtered or unexported fields
}

Client is the gRPC client to interactive with the ProfilerServer

  • Name: the name of the client
  • serviceURL: the URL of the gRPC server
  • ProfilerClientContext: the context with the ProfilerClient and the connection

func NewClient

func NewClient(address, name string, dialOpts ...grpc.DialOption) (*Client, error)

NewClient returns the gRPC client to interactive with the gRPC server for the profiler

func (*Client) ProfilerOP

func (c *Client) ProfilerOP(op string, portNumber int32) (string, error)

ProfilerOP will call the doProfilerOP for the ProfilerServer. It will convert the hunam readable op to internal usage and is the entry point for the profiler operations.

type ClientContext

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

ClientContext is the context with the ProfilerClient and the connection

  • conn: the connection for the gRPC server
  • service: the ProfilerClient

func (ClientContext) Close

func (c ClientContext) Close() error

Close closes the connection for the gRPC server

type Server

type Server struct {
	profilerpb.UnimplementedProfilerServer
	// contains filtered or unexported fields
}

Server is the gRPC server to provide the basic operations like (show/enable/disable) for the profiler

  • name: the name of the server
  • errMsg: the error message current server has (if enabled failed, it will have the error message)
  • server: the http server for the profiler
  • lock: the RW lock for the server

func NewServer

func NewServer(name string) *Server

NewServer returns the gRPC service server for the profiler

func (*Server) DisableProfiler

func (s *Server) DisableProfiler() (string, error)

DisableProfiler disables the profilerpb. It will return the error when fails to shut down the profiler server.

func (*Server) EnableProfiler

func (s *Server) EnableProfiler(portNumber int32) (string, error)

EnableProfiler enables the profiler with specific port number. It will fail if the profiler is already enabled or the port number is invalid(0). For the profiler server enabling failed, it will return the error message. And keep the above error message, then user can get the error message by op `show`. The normal(success) case will return the address of the profiler server.

func (*Server) ProfilerOP

ProfilerOP is the gRPC function to provide the entry point for the profiler operations

func (*Server) ShowProfiler

func (s *Server) ShowProfiler() (string, error)

ShowProfiler returns the address of the profiler

Jump to

Keyboard shortcuts

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