service

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

View Source
const ErrorPrefix = "FlagdError:"

Variables

This section is empty.

Functions

func Handler added in v0.2.3

func Handler(handlerID string, m Middleware, h http.Handler) http.Handler

Handler returns an measuring standard http.Handler.

Types

type Configuration added in v0.4.0

type Configuration struct {
	ReadinessProbe ReadinessProbe
}

type ConnectService added in v0.2.0

type ConnectService struct {
	Logger                      *logger.Logger
	Eval                        eval.IEvaluator
	ConnectServiceConfiguration *ConnectServiceConfiguration
	// contains filtered or unexported fields
}

func (*ConnectService) EventStream added in v0.2.3

func (s *ConnectService) EventStream(
	ctx context.Context,
	req *connect.Request[schemaV1.EventStreamRequest],
	stream *connect.ServerStream[schemaV1.EventStreamResponse],
) error

func (*ConnectService) Notify added in v0.2.3

func (s *ConnectService) Notify(n Notification)

func (*ConnectService) ResolveAll added in v0.3.1

func (s *ConnectService) ResolveAll(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveAllRequest],
) (*connect.Response[schemaV1.ResolveAllResponse], error)

func (*ConnectService) ResolveBoolean added in v0.2.0

func (s *ConnectService) ResolveBoolean(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveBooleanRequest],
) (*connect.Response[schemaV1.ResolveBooleanResponse], error)

func (*ConnectService) ResolveFloat added in v0.2.0

func (s *ConnectService) ResolveFloat(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveFloatRequest],
) (*connect.Response[schemaV1.ResolveFloatResponse], error)

func (*ConnectService) ResolveInt added in v0.2.0

func (s *ConnectService) ResolveInt(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveIntRequest],
) (*connect.Response[schemaV1.ResolveIntResponse], error)

func (*ConnectService) ResolveObject added in v0.2.0

func (s *ConnectService) ResolveObject(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveObjectRequest],
) (*connect.Response[schemaV1.ResolveObjectResponse], error)

func (*ConnectService) ResolveString added in v0.2.0

func (s *ConnectService) ResolveString(
	ctx context.Context,
	req *connect.Request[schemaV1.ResolveStringRequest],
) (*connect.Response[schemaV1.ResolveStringResponse], error)

func (*ConnectService) Serve added in v0.2.0

func (s *ConnectService) Serve(ctx context.Context, eval eval.IEvaluator, svcConf Configuration) error

type ConnectServiceConfiguration added in v0.2.0

type ConnectServiceConfiguration struct {
	Port             int32
	MetricsPort      int32
	ServerCertPath   string
	ServerKeyPath    string
	ServerSocketPath string
	CORS             []string
}

type HTTPProperties added in v0.2.3

type HTTPProperties struct {
	Service string
	ID      string
}

type HTTPReqProperties added in v0.2.3

type HTTPReqProperties struct {
	Service string
	ID      string
	Method  string
	Code    string
}

type IService

type IService interface {
	Serve(ctx context.Context, eval eval.IEvaluator, svcConf Configuration) error
	Notify(n Notification)
}

IService implementations define handlers for a particular transport, which call the IEvaluator implementation.

type Middleware added in v0.2.3

type Middleware struct {
	// contains filtered or unexported fields
}

func New added in v0.2.3

func New(cfg middlewareConfig) Middleware

func (Middleware) Measure added in v0.2.3

func (m Middleware) Measure(handlerID string, reporter Reporter, next func())

type Notification added in v0.2.3

type Notification struct {
	Type NotificationType       `json:"type"`
	Data map[string]interface{} `json:"data"`
}

type NotificationType added in v0.2.3

type NotificationType string
const (
	ConfigurationChange NotificationType = "configuration_change"
	ProviderReady       NotificationType = "provider_ready"
	KeepAlive           NotificationType = "keep_alive"
)

type OTelMetricsRecorder added in v0.4.0

type OTelMetricsRecorder struct {
	// contains filtered or unexported fields
}

func (OTelMetricsRecorder) OTelInFlightRequestEnd added in v0.4.0

func (r OTelMetricsRecorder) OTelInFlightRequestEnd(p HTTPReqProperties)

func (OTelMetricsRecorder) OTelInFlightRequestStart added in v0.4.0

func (r OTelMetricsRecorder) OTelInFlightRequestStart(p HTTPReqProperties)

func (OTelMetricsRecorder) OTelObserveHTTPRequestDuration added in v0.4.0

func (r OTelMetricsRecorder) OTelObserveHTTPRequestDuration(p HTTPReqProperties, duration time.Duration)

func (OTelMetricsRecorder) OTelObserveHTTPResponseSize added in v0.4.0

func (r OTelMetricsRecorder) OTelObserveHTTPResponseSize(p HTTPReqProperties, sizeBytes int64)

type ReadinessProbe added in v0.4.0

type ReadinessProbe func() bool

type Recorder added in v0.2.3

type Recorder interface {
	// OTelObserveHTTPRequestDuration measures the duration of an HTTP request.
	OTelObserveHTTPRequestDuration(props HTTPReqProperties, duration time.Duration)
	// OTelObserveHTTPResponseSize measures the size of an HTTP response in bytes.
	OTelObserveHTTPResponseSize(props HTTPReqProperties, sizeBytes int64)

	// OTelInFlightRequestStart count the active requests.
	OTelInFlightRequestStart(props HTTPReqProperties)
	// OTelInFlightRequestEnd count the finished requests.
	OTelInFlightRequestEnd(props HTTPReqProperties)
}

type Reporter added in v0.2.3

type Reporter interface {
	Method() string
	URLPath() string
	StatusCode() int
	BytesWritten() int64
}

Jump to

Keyboard shortcuts

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