grpc

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 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. Each instance is defined with its name as the YAML key under components.

  • type (required): Must be grpc.
  • timeout (optional): Per-instance timeout override.
  • spec: Provider-specific configuration:
    • 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.

Examples

Basic gRPC Health Check
components:
  example:
    type: grpc
    spec:
      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

View Source
const (
	ProviderType   = "grpc"
	DefaultTimeout = 1 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component added in v0.6.0

type Component struct {
	provider.Base
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port" default:"8080"`
	Service  string `mapstructure:"service"`
	TLS      bool   `mapstructure:"tls" default:"false"`
	Insecure bool   `mapstructure:"insecure" default:"false"`
}

func (*Component) GetHealth added in v0.6.0

func (c *Component) GetHealth(ctx context.Context) *ph.HealthCheckResponse

func (*Component) GetType added in v0.6.0

func (c *Component) GetType() string

func (*Component) LogValue added in v0.6.0

func (c *Component) LogValue() slog.Value

func (*Component) Setup added in v0.6.0

func (c *Component) Setup() error

Jump to

Keyboard shortcuts

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