Documentation ¶
Overview ¶
Client contains the gRPC client implementation used to send RPCs to Cloudprober.
Index ¶
- type CloudproberClient
- func (c *CloudproberClient) CloseConn()
- func (c *CloudproberClient) ListProbes(ctx context.Context) ([]*proberpb.Probe, error)
- func (c *CloudproberClient) RegisterAndAddProbe(ctx context.Context, extensionNumber int, probePb *configpb.ProbeDef, ...) error
- func (c *CloudproberClient) RemoveProbe(ctx context.Context, probeName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudproberClient ¶
type CloudproberClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(rpcServer string) (*CloudproberClient, error)
NewClient creates, initialises and returns a new CloudproberClient. This is the correct way to create a new instance of CloudproberClient. Parameters: - rpcServer: Pass the rpcServer address and port as a string formatted as: "hostname:port", e.g. "localhost:1234" Returns: - *CloudproberClient: returns a CloudproberClient with a client connection to the Cloudprober gRPC server. - error:
- nil: No error occurred and the client was successfully initialised.
- gRPC Error: See https://godoc.org/google.golang.org/grpc/codes for error codes. -> See https://github.com/grpc/grpc-go/blob/d25c71b54334380ff1febd25d88064b36de44b3c/clientconn.go#L123
func (*CloudproberClient) CloseConn ¶
func (c *CloudproberClient) CloseConn()
CloseConn is used for closing the client connection with the gRPC server.
func (*CloudproberClient) ListProbes ¶
ListProbes() returns a (stable) sorted array of active probes from Cloudprober. Parameters: - ctx: Context used for cancelling RPCs. Returns:
- probesList: This is the array of active probes in Cloudprober. If this is empty, there are no active probes.
- Error:
- See Cloudprober ListProbes() RPC for details on an error.
func (*CloudproberClient) RegisterAndAddProbe ¶
func (c *CloudproberClient) RegisterAndAddProbe(ctx context.Context, extensionNumber int, probePb *configpb.ProbeDef, hermesProbeToAdd cpprobes.Probe) error
RegisterAndAddProbe registers a probe type and adds the probe to Cloudprober to be run. Parameters: - ctx: Context used for cancelling RPCs. - extensionNumber: The proto extension number from the proto of this probe type. - probePb: This probe config must be unmarshalled before being passed as an argument. - hermesProbeToAdd - An empty probe object of the desired probe type. Returns: TODO(evanSpendlove): Include details of these errors in the error message. - error:
- Code 3, InvalidArgument: probe config cannot be nil
- error parsing regexp [...]: the machine name for this probe to run on does not compile as a regexp.
- Code 6, AlreadyExists: probe [name] is already defined - the probe has already been added
- Code 2, Unknown:
- only one probe extension is allowed per probe, got %d extensions -> More than one probe extension type has been registered using cpprobes.RegisterProbeType()
- no probe extension in probe config -> The probe proto does not have an extension registered.
- no probes registered for the extension: [extension code] -> The proto has a probe extension, but there is no probe extension registered matching that extension code.
- proto.GetExtension() error: extension missing, invalid, incomplete or proto cannot be extended. -> The proto.SetExtension() method must be called and supplied with valid data.
- unregistered user defined probe: [probe name] -> The probe type has not been registered as a user defined probe.
- unknown probe type: [probe type] -> The probe type does not match any expected types (including user-defined and extension).
- probe.Init() error: an error occurred when the probe, created from the config passsed, was initialised. -> There was a problem in the Init() function of the probe type passed.
- options.BuildProbeOptions() error: an error occurred when building the options for this probe from the config supplied. -> The options could not be built from the config supplied.
func (*CloudproberClient) RemoveProbe ¶
func (c *CloudproberClient) RemoveProbe(ctx context.Context, probeName string) error
RemoveProbe removes a probe from Cloudprober, given the probe name (located in the probe config). An error will be returned if there is no active probe with this probe name. Parameters: - ctx: Context used for cancelling RPCs. - probeName: This must be the name of an active probe in Cloudprober. Returns: - error:
- Code: 3, InvalidArgument: probeName is an empty string
- Code: 5, NotFound: cannot find a probe matching this probe name