grpc

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

README

gRPC Provider

The gRPC Provider extends the platform-health server to enable monitoring of arbitrary external gRPC servers implementing the gRPC Health Checking Protocol.

Usage

Once the gRPC Provider is configured, any query to the platform-health server will trigger validation of the configured gRPC service(s). The server will attempt to establish a connection to each configured component, and it will report component as "healthy" if the connection is successful and the service reports "SERVING", or "unhealthy" otherwise.

Configuration

The gRPC Provider is configured through the platform-health server's configuration file, with component instances listed under the grpc key.

  • name (required): The name of the gRPC service instance, used to identify the service in the health reports.
  • host (required): The hostname or IP address of the gRPC service to monitor.
  • port (default: 8080): The port number of the gRPC service to monitor.
  • service (default: ""): The service on the target gRPC service to monitor.
  • tls (default: false, unless port is 443): Enable TLS for the gRPC dialer.
  • insecure (default: false): Disable certificate validation when TLS is enabled.
Example
grpc:
  - name: example
    host: grpc.example.com
    port: 443
    service: "foo"

In this example, the gRPC Provider will establish a connection to grpc.example.com on port 443 (which automatically enables TLS mode), returning "healthy" only if the "foo" service reports "SERVING".

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeGRPC = "grpc"

Functions

This section is empty.

Types

type GRPC

type GRPC struct {
	Name     string        `mapstructure:"name"`
	Host     string        `mapstructure:"host"`
	Port     int           `mapstructure:"port"`
	Service  string        `mapstructure:"service"`
	TLS      bool          `mapstructure:"tls" default:"false"`
	Insecure bool          `mapstructure:"insecure" default:"false"`
	Timeout  time.Duration `mapstructure:"timeout" default:"1s"`
}

func (*GRPC) GetHealth

func (i *GRPC) GetHealth(ctx context.Context) *ph.HealthCheckResponse

func (*GRPC) GetName

func (i *GRPC) GetName() string

func (*GRPC) GetType

func (i *GRPC) GetType() string

func (*GRPC) LogValue

func (i *GRPC) LogValue() slog.Value

func (*GRPC) SetDefaults

func (i *GRPC) SetDefaults()

Jump to

Keyboard shortcuts

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