zipper

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-2-Clause Imports: 37 Imported by: 1

Documentation

Overview

Package zipper exposes following non-monitoring endpoints:

  • /metrics/find
  • /render
  • /info

Error codes policy (applies to find, render, info endpoints)

  • if at least one backend succeeds, it's a success with code 200.
  • if all bakends fail
  • if all errors are not-found, it's a not found. But code is 200 + a monitoring counter incremented.
  • if errors are of mixed type we fail with code 500.

Index

Constants

This section is empty.

Variables

View Source
var BuildVersion string

BuildVersion is replaced by ldflags

View Source
var Metrics = struct {
	Requests  *expvar.Int
	Responses *expvar.Int
	Errors    *expvar.Int

	Goroutines expvar.Func
	Uptime     expvar.Func

	FindRequests *expvar.Int
	FindErrors   *expvar.Int

	RenderRequests *expvar.Int
	RenderErrors   *expvar.Int

	InfoRequests *expvar.Int
	InfoErrors   *expvar.Int

	Timeouts *expvar.Int

	CacheSize   expvar.Func
	CacheItems  expvar.Func
	CacheMisses *expvar.Int
	CacheHits   *expvar.Int
}{
	Requests:  expvar.NewInt("requests"),
	Responses: expvar.NewInt("responses"),
	Errors:    expvar.NewInt("errors"),

	FindRequests: expvar.NewInt("find_requests"),
	FindErrors:   expvar.NewInt("find_errors"),

	RenderRequests: expvar.NewInt("render_requests"),
	RenderErrors:   expvar.NewInt("render_errors"),

	InfoRequests: expvar.NewInt("info_requests"),
	InfoErrors:   expvar.NewInt("info_errors"),

	Timeouts: expvar.NewInt("timeouts"),

	CacheHits:   expvar.NewInt("cache_hits"),
	CacheMisses: expvar.NewInt("cache_misses"),
}

Metrics contains grouped expvars for /debug/vars and graphite

Functions

This section is empty.

Types

type App

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

App represents the main zipper runnable

func New

func New(config cfg.Zipper, logger *zap.Logger, buildVersion string) (*App, error)

New inits backends and makes a new copy of the app. Does not run the app

func (*App) Start

func (app *App) Start(logger *zap.Logger) func()

Start start launches the goroutines starts the app execution

type PrometheusMetrics

type PrometheusMetrics struct {
	Requests                  prometheus.Counter
	Responses                 *prometheus.CounterVec
	RenderMismatches          prometheus.Counter
	RenderFixedMismatches     prometheus.Counter
	RenderMismatchedResponses prometheus.Counter
	Renders                   prometheus.Counter
	FindNotFound              prometheus.Counter
	RequestCancel             *prometheus.CounterVec
	DurationExp               prometheus.Histogram
	DurationLin               prometheus.Histogram
	RenderDurationExp         prometheus.Histogram
	RenderOutDurationExp      *prometheus.HistogramVec
	FindDurationExp           prometheus.Histogram
	FindDurationLin           prometheus.Histogram
	TimeInQueueExp            prometheus.Histogram
	TimeInQueueLin            prometheus.Histogram
}

PrometheusMetrics keeps all the metrics exposed on /metrics endpoint

func NewPrometheusMetrics

func NewPrometheusMetrics(config cfg.Zipper) *PrometheusMetrics

NewPrometheusMetrics creates a set of default Prom metrics

Jump to

Keyboard shortcuts

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