fgrpc

package
v1.60.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 24 Imported by: 5

Documentation

Overview

Package fgrpc is a generated protocol buffer package.

It is generated from these files:

ping.proto

It has these top-level messages:

PingMessage

Index

Constants

View Source
const (
	// DefaultHealthServiceName is the default health service name used by fortio.
	DefaultHealthServiceName = "ping"
	// Error indicates that something went wrong with healthcheck in grpc.
	Error = "ERROR"
)

Variables

This section is empty.

Functions

func Dial added in v0.7.0

Dial dials grpc using insecure or tls transport security when serverAddr has prefixHTTPS or cert is provided. If override is set to a non empty string, it will override the virtual host name of authority in requests.

func PingClientCall added in v0.8.0

func PingClientCall(serverAddr string, n int, payload string, delay time.Duration, tlsOpts *fhttp.TLSOptions, md metadata.MD,
) (float64, error)

PingClientCall calls the ping service (presumably running as PingServer on the destination). returns the average round trip in seconds.

func PingServer added in v0.8.0

func PingServer(port, healthServiceName string, maxConcurrentStreams uint32, tlsOptions *fhttp.TLSOptions) net.Addr

PingServer starts a grpc ping (and health) echo server. returns the port being bound (useful when passing "0" as the port to get a dynamic server). Pass the healthServiceName to use for the grpc service name health check (or pass DefaultHealthServiceName) to be marked as SERVING. Pass maxConcurrentStreams > 0 to set that option.

func PingServerTCP added in v1.1.0

func PingServerTCP(port, healthServiceName string, maxConcurrentStreams uint32, tlsOptions *fhttp.TLSOptions) int

PingServerTCP is PingServer() assuming tcp instead of possible unix domain socket port, returns the numeric port.

func RegisterPingServerServer

func RegisterPingServerServer(s *grpc.Server, srv PingServerServer)

Types

type GRPCRunnerOptions

type GRPCRunnerOptions struct {
	periodic.RunnerOptions
	fhttp.TLSOptions
	Destination        string
	Service            string        // Service to be checked when using grpc health check
	Profiler           string        // file to save profiles to. defaults to no profiling
	Payload            string        // Payload to be sent for grpc ping service
	Streams            int           // number of streams. total go routines and data streams will be streams*numthreads.
	Delay              time.Duration // Delay to be sent when using grpc ping service
	CertOverride       string        // Override the cert virtual host of authority for testing
	AllowInitialErrors bool          // whether initial errors don't cause an abort
	UsePing            bool          // use our own Ping proto for grpc load instead of standard health check one.
	Metadata           metadata.MD   // input metadata that will be added to the request

	GrpcCompression bool // enable grpc compression
	// contains filtered or unexported fields
}

GRPCRunnerOptions includes the base RunnerOptions plus grpc specific options.

type GRPCRunnerResults

type GRPCRunnerResults struct {
	periodic.RunnerResults

	RetCodes    HealthResultMap
	Destination string
	Streams     int
	Ping        bool
	Metadata    metadata.MD
	// contains filtered or unexported fields
}

GRPCRunnerResults is the aggregated result of an GRPCRunner. Also is the internal type used per thread/goroutine.

func RunGRPCTest

func RunGRPCTest(o *GRPCRunnerOptions) (*GRPCRunnerResults, error)

RunGRPCTest runs an http test and returns the aggregated stats.

func (*GRPCRunnerResults) Run added in v0.4.2

func (grpcstate *GRPCRunnerResults) Run(outCtx context.Context, t periodic.ThreadID) (bool, string)

Run exercises GRPC health check or ping at the target QPS. To be set as the Function in RunnerOptions.

type HealthResultMap added in v0.8.0

type HealthResultMap map[string]int64

HealthResultMap short cut for the map of results to count.

func GrpcHealthCheck added in v0.8.0

func GrpcHealthCheck(serverAddr, svcname string, n int, tlsOpts *fhttp.TLSOptions, md metadata.MD) (*HealthResultMap, error)

GrpcHealthCheck makes a grpc client call to the standard grpc health check service.

type PingMessage

type PingMessage struct {
	Seq        int64  `protobuf:"varint,1,opt,name=seq" json:"seq,omitempty"`
	Ts         int64  `protobuf:"varint,2,opt,name=ts" json:"ts,omitempty"`
	Payload    string `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
	DelayNanos int64  `protobuf:"varint,4,opt,name=delayNanos" json:"delayNanos,omitempty"`
}

func (*PingMessage) Descriptor

func (*PingMessage) Descriptor() ([]byte, []int)

func (*PingMessage) GetDelayNanos added in v0.9.0

func (m *PingMessage) GetDelayNanos() int64

func (*PingMessage) GetPayload

func (m *PingMessage) GetPayload() string

func (*PingMessage) GetSeq

func (m *PingMessage) GetSeq() int64

func (*PingMessage) GetTs

func (m *PingMessage) GetTs() int64

func (*PingMessage) ProtoMessage

func (*PingMessage) ProtoMessage()

func (*PingMessage) Reset

func (m *PingMessage) Reset()

func (*PingMessage) String

func (m *PingMessage) String() string

type PingServerClient

type PingServerClient interface {
	Ping(ctx context.Context, in *PingMessage, opts ...grpc.CallOption) (*PingMessage, error)
}

func NewPingServerClient

func NewPingServerClient(cc *grpc.ClientConn) PingServerClient

type PingServerServer

type PingServerServer interface {
	Ping(context.Context, *PingMessage) (*PingMessage, error)
}

Jump to

Keyboard shortcuts

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