route

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2020 The Moov Authors Use of this source code is governed by an Apache License license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	IdempotentRecorder = lru.New()

	// Prometheus Metrics
	Histogram = prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
		Name: "http_response_duration_seconds",
		Help: "Histogram representing the http response durations",
	}, []string{"route"})
)

Functions

func CleanPath

func CleanPath(path string) string

CleanPath takes a URL path and formats it for Prometheus metrics

This method replaces /'s with -'s and strips out moov/base.ID() values from URL path slugs.

func GetHeaderValue added in v0.9.0

func GetHeaderValue(header string, r *http.Request) string

func PingRoute

func PingRoute(logger log.Logger, r *mux.Router)

func ReadLimit

func ReadLimit(r *http.Request) int64

ReadLimit returns the "limit" query param from a request or zero if it's missing.

func ReadOffset

func ReadOffset(r *http.Request) int64

ReadOffset returns the "offset" query param from a request or zero if it's missing.

func ReadPathID

func ReadPathID(name string, r *http.Request) string

Types

type Responder

type Responder struct {
	OrganizationID string
	XRequestID     string
	// contains filtered or unexported fields
}

func NewResponder

func NewResponder(cfg *config.Config, w http.ResponseWriter, r *http.Request) *Responder

func (*Responder) Problem

func (r *Responder) Problem(err error)

func (*Responder) Respond

func (r *Responder) Respond(fn func(http.ResponseWriter))

func (*Responder) Span

func (r *Responder) Span() opentracing.Span

Jump to

Keyboard shortcuts

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