api

package
v1.17.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusClientClosedRequest is the status code for when a client request cancellation of a http request
	StatusClientClosedRequest = 499
)

Variables

This section is empty.

Functions

func RespondError

func RespondError(logger log.Logger, w http.ResponseWriter, errorType v1.ErrorType, msg string, statusCode int)

RespondError writes error in Prometheus response format using provided error type and message.

func RespondFromGRPCError

func RespondFromGRPCError(logger log.Logger, w http.ResponseWriter, err error)

RespondFromGRPCError writes gRPC error in Prometheus response format. If error is not a valid gRPC error, use server_error instead.

Types

type Response

type Response struct {
	Status    string       `json:"status"`
	Data      interface{}  `json:"data"`
	ErrorType v1.ErrorType `json:"errorType"`
	Error     string       `json:"error"`
	Warnings  []string     `json:"warnings,omitempty"`
}

Response defines the Prometheus response format.

Jump to

Keyboard shortcuts

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