stanza

package
v0.0.7-beta Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithHeaders

func ContextWithHeaders(r *http.Request) context.Context

ContextWithHeaders is a helper function which extracts and OTEL TraceContext, Baggage, and StanzaHeaders from a given http.Request into a context.Context.

func Guard

func Guard(ctx context.Context, guardName string, opts ...GuardOpt) *handlers.Guard

Guard is a helper function to Guard any arbitrary block of code

func GuardHandler

func GuardHandler(next http.Handler, guardName string, opts ...GuardOpt) http.Handler

func GuardMiddleware

func GuardMiddleware(next func(w http.ResponseWriter, r *http.Request), guardName string, opts ...GuardOpt) func(w http.ResponseWriter, r *http.Request)

func HttpGet

func HttpGet(ctx context.Context, guardName, url string, opts ...GuardOpt) (*http.Response, error)

HttpGet is a helper function to Guard an outbound HTTP GET

func HttpPost

func HttpPost(ctx context.Context, guardName, url string, body io.Reader, opts ...GuardOpt) (*http.Response, error)

HttpPost is a helper function to Guard an outbound HTTP POST

func HttpServer

func HttpServer(guardName string, opts ...GuardOpt) (*httphandler.InboundHandler, error)

HttpServer is a helper function to Guard inbound HTTP requests

func Init

func Init(ctx context.Context, co ClientOptions) (func(), error)

Init initializes the SDK with ClientOptions. The returned error is non-nil if options is invalid, if a global client already exists, or if StanzaHub can't be reached.

func NewGrpcInboundHandler

func NewGrpcInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.InboundHandler, error)

gRPC Server

func NewGrpcOutboundHandler

func NewGrpcOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.OutboundHandler, error)

gRPC Client

func NewHttpInboundHandler

func NewHttpInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.InboundHandler, error)

HTTP Server

func NewHttpOutboundHandler

func NewHttpOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.OutboundHandler, error)

HTTP Client

func RegisterGuard

func RegisterGuard(ctx context.Context, guard string)

func StreamClientInterceptor

func StreamClientInterceptor(guardName string, opts ...GuardOpt) grpc.StreamClientInterceptor

StreamClientInterceptor is a helper function to Guard an outbound grpc streaming client

func StreamServerInterceptor

func StreamServerInterceptor(guardName string, opts ...GuardOpt) grpc.StreamServerInterceptor

StreamServerInterceptor is a helper function to Guard an inbound grpc streaming server

func UnaryClientInterceptor

func UnaryClientInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryClientInterceptor

UnaryClientInterceptor is a helper function to Guard an outbound grpc unary client

func UnaryServerInterceptor

func UnaryServerInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryServerInterceptor

UnaryServerInterceptor is a helper function to Guard an inbound grpc unary server

Types

type ClientOptions

type ClientOptions struct {
	// Required
	APIKey string // customer generated API key

	// Optional
	Name        string // defines service unique name
	Release     string // defines service version
	Environment string // defines service environment
	StanzaHub   string // host:port (ipv4, ipv6, or resolvable hostname)

	Guard []string // prefetch config for these guards
}

type GuardOpt

type GuardOpt struct {
	Feature       *string
	PriorityBoost *int32
	DefaultWeight *float32
	Tags          *map[string]string
}

Jump to

Keyboard shortcuts

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