Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendResponse ¶ added in v3.6.0
type BackendResponse struct {
// contains filtered or unexported fields
}
type ComparisonSummary ¶
type ComparisonSummary struct {
// contains filtered or unexported fields
}
type InstrumentationServer ¶
type InstrumentationServer struct {
// contains filtered or unexported fields
}
func NewInstrumentationServer ¶
func NewInstrumentationServer(port int, registry *prometheus.Registry, logger log.Logger) *InstrumentationServer
NewInstrumentationServer returns a server exposing Prometheus metrics.
func (*InstrumentationServer) Start ¶
func (s *InstrumentationServer) Start() error
Start the instrumentation server.
func (*InstrumentationServer) Stop ¶
func (s *InstrumentationServer) Stop()
Stop closes the instrumentation server.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func NewProxy ¶
func NewProxy(cfg ProxyConfig, logger log.Logger, readRoutes, writeRoutes []Route, registerer prometheus.Registerer) (*Proxy, error)
type ProxyBackend ¶
type ProxyBackend struct {
// contains filtered or unexported fields
}
ProxyBackend holds the information of a single backend.
func NewProxyBackend ¶
func NewProxyBackend(name string, endpoint *url.URL, timeout time.Duration, preferred bool) *ProxyBackend
NewProxyBackend makes a new ProxyBackend
func (*ProxyBackend) ForwardRequest ¶
func (b *ProxyBackend) ForwardRequest(orig *http.Request, body io.ReadCloser) *BackendResponse
func (*ProxyBackend) WithFilter ¶
func (b *ProxyBackend) WithFilter(f *regexp.Regexp) *ProxyBackend
type ProxyConfig ¶
type ProxyConfig struct {
ServerServicePort int
BackendEndpoints string
PreferredBackend string
BackendReadTimeout time.Duration
CompareResponses bool
DisableBackendReadProxy string
ValueComparisonTolerance float64
UseRelativeError bool
PassThroughNonRegisteredRoutes bool
SkipRecentSamples time.Duration
SkipSamplesBefore flagext.Time
RequestURLFilter *regexp.Regexp
InstrumentCompares bool
Goldfish goldfish.Config
}
func (*ProxyConfig) RegisterFlags ¶
func (cfg *ProxyConfig) RegisterFlags(f *flag.FlagSet)
type ProxyEndpoint ¶
type ProxyEndpoint struct {
// contains filtered or unexported fields
}
func NewProxyEndpoint ¶
func NewProxyEndpoint(backends []*ProxyBackend, routeName string, metrics *ProxyMetrics, logger log.Logger, comparator ResponsesComparator, instrumentCompares bool) *ProxyEndpoint
func (*ProxyEndpoint) ServeHTTP ¶
func (p *ProxyEndpoint) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ProxyEndpoint) WithGoldfish ¶ added in v3.6.0
func (p *ProxyEndpoint) WithGoldfish(manager *goldfish.Manager) *ProxyEndpoint
WithGoldfish adds Goldfish manager to the endpoint.
type ProxyMetrics ¶
type ProxyMetrics struct {
// contains filtered or unexported fields
}
func NewProxyMetrics ¶
func NewProxyMetrics(registerer prometheus.Registerer) *ProxyMetrics
type ResponsesComparator ¶
type ResponsesComparator interface {
Compare(expected, actual []byte, queryEvaluationTime time.Time) (*ComparisonSummary, error)
}
type Route ¶
type Route struct {
Path string
RouteName string
Methods []string
ResponseComparator ResponsesComparator
}
type SampleComparisonOptions ¶
type SampleComparisonOptions struct {
Tolerance float64
UseRelativeError bool
SkipRecentSamples time.Duration
SkipSamplesBefore time.Time
}
func (*SampleComparisonOptions) SkipSample ¶ added in v3.4.0
func (opts *SampleComparisonOptions) SkipSample(sampleTime, evaluationTime time.Time) bool
type SamplesComparator ¶
type SamplesComparator struct {
// contains filtered or unexported fields
}
func NewSamplesComparator ¶
func NewSamplesComparator(opts SampleComparisonOptions) *SamplesComparator
func (*SamplesComparator) Compare ¶
func (s *SamplesComparator) Compare(expectedResponse, actualResponse []byte, evaluationTime time.Time) (*ComparisonSummary, error)
func (*SamplesComparator) RegisterSamplesType ¶
func (s *SamplesComparator) RegisterSamplesType(samplesType string, comparator SamplesComparatorFunc)
RegisterSamplesType helps with registering custom sample types
type SamplesComparatorFunc ¶
type SamplesComparatorFunc func(expected, actual json.RawMessage, evaluationTime time.Time, opts SampleComparisonOptions) (*ComparisonSummary, error)
SamplesComparatorFunc helps with comparing different types of samples coming from /api/v1/query and /api/v1/query_range routes.
type SamplesResponse ¶
type SamplesResponse struct {
Status string
Data struct {
ResultType string
Result json.RawMessage
}
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.