api

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WeakHashAlgorithmTimestampRequest = "Weak hash algorithm in timestamp request"
)

Variables

View Source
var (
	MetricLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "timestamp_authority_api_latency",
		Help: "API Latency on calls",
	}, []string{"path", "code"})

	MetricLatencySummary = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Name: "timestamp_authority_api_latency_summary",
		Help: "API Latency on calls",
	}, []string{"path", "code"})

	MetricRequestLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "timestamp_authority_latency_by_api",
		Help: "API Latency (in ns) by path and method",
		Buckets: prometheus.ExponentialBucketsRange(
			float64(time.Millisecond),
			float64(4*time.Second),
			10),
	}, []string{"path", "method"})

	MetricRequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "timestamp_authority_http_requests_total",
		Help: "Total number of HTTP requests by status code, path, and method.",
	}, []string{"code", "path", "method"})

	MetricNTPLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "timestamp_authority_ntp_latency",
		Help: "NTP request latency",
	}, []string{"host"})

	MetricNTPSyncCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "timestamp_authority_ntp_sync_total",
		Help: "Total number of NTP requests against a remote server",
	}, []string{"host", "failed"})

	MetricNTPErrorCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "timestamp_authority_ntp_errors_total",
		Help: "Total number of NTP related errors",
	}, []string{"reason"})
)

Functions

func ConfigureAPI

func ConfigureAPI()

func ParseJSONRequest added in v1.1.0

func ParseJSONRequest(reqBytes []byte) (*timestamp.Request, string, error)

ParseJSONRequest parses a JSON request into a timestamp.Request struct

func TimestampResponseHandler

func TimestampResponseHandler(params ts.GetTimestampResponseParams) middleware.Responder

Types

type API

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

func NewAPI

func NewAPI() (*API, error)

type JSONRequest added in v1.1.0

type JSONRequest struct {
	ArtifactHash  string   `json:"artifactHash"`
	Certificates  bool     `json:"certificates"`
	HashAlgorithm string   `json:"hashAlgorithm"`
	Nonce         *big.Int `json:"nonce"`
	TSAPolicyOID  string   `json:"tsaPolicyOID"`
}

Jump to

Keyboard shortcuts

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