Documentation ¶
Index ¶
- Variables
- func Instr(logger log.Logger, ins extpromhttp.InstrumentationMiddleware) func(name string, f ApiFunc) httprouter.Handle
- type API
- func (a *API) ApplyConfig(c *config.Config) error
- func (a *API) Config(_ *http.Request) (interface{}, []error, *ApiError)
- func (a *API) DiffProfiles(r *http.Request) (*profile.Profile, storage.Warnings, *ApiError)
- func (a *API) LabelNames(r *http.Request) (interface{}, []error, *ApiError)
- func (a *API) LabelValues(r *http.Request) (interface{}, []error, *ApiError)
- func (a *API) MergeProfiles(r *http.Request) (*profile.Profile, storage.Warnings, *ApiError)
- func (a *API) Query(r *http.Request) (interface{}, []error, *ApiError)
- func (a *API) QueryRange(r *http.Request) (interface{}, []error, *ApiError)
- func (a *API) Reload(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (a *API) Routes() http.Handler
- func (a *API) Series(r *http.Request) (interface{}, []error, *ApiError)
- func (a *API) SingleProfileQuery(r *http.Request) (*profile.Profile, storage.Warnings, *ApiError)
- func (a *API) Targets(r *http.Request) (interface{}, []error, *ApiError)
- type ApiError
- type ApiFunc
- type DroppedTarget
- type EmptyResponse
- type ErrorResponse
- type ErrorType
- type GlobalURLOptions
- type HttpResponseRenderer
- type MergeTimeoutError
- type MetaReport
- type NoTargetRetriever
- type Option
- func WithDB(db storage.Queryable) Option
- func WithMaxMergeBatchSize(max int64) Option
- func WithPrefix(prefix string) Option
- func WithQueryTimeout(t time.Duration) Option
- func WithReloadChannel(reloadCh chan struct{}) Option
- func WithSymbolizer(s Symbolizer) Option
- func WithTargets(targets func(ctx context.Context) TargetRetriever) Option
- type ProfileResponseRenderer
- type ProtoRenderer
- type Response
- type SVGRenderer
- type Series
- type Status
- type SuccessResponse
- type Symbolizer
- type Target
- type TargetDiscovery
- type TargetRetriever
- type TreeNode
- type ValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultMergeBatchSize = int64(1024 * 1024 * 64) // 64Mb
)
View Source
var (
LocalhostRepresentations = []string{"127.0.0.1", "localhost"}
)
View Source
var NoTargets = func(_ context.Context) TargetRetriever { return NoTargetRetriever{} }
NoTargets is passed to the API when only the API is served and no scraping is happening.
Functions ¶
func Instr ¶
func Instr( logger log.Logger, ins extpromhttp.InstrumentationMiddleware, ) func(name string, f ApiFunc) httprouter.Handle
TODO: add tracer Instr returns a http HandlerFunc with the instrumentation middleware.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) DiffProfiles ¶
func (*API) LabelNames ¶
func (*API) LabelValues ¶
func (*API) MergeProfiles ¶
func (*API) QueryRange ¶
func (*API) Reload ¶
func (a *API) Reload(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*API) Routes ¶
Routes returns a http.Handler containing all routes of the API so that it can be mounted into a mux.
func (*API) SingleProfileQuery ¶
type DroppedTarget ¶
type DroppedTarget struct { // Labels before any processing. DiscoveredLabels map[string]string `json:"discoveredLabels"` }
DroppedTarget has the information for one target that was dropped during relabelling.
type EmptyResponse ¶
type EmptyResponse struct{}
func (*EmptyResponse) Render ¶
func (r *EmptyResponse) Render(w http.ResponseWriter) error
type ErrorResponse ¶
type ErrorResponse struct { Data interface{} ApiErr *ApiError }
func (*ErrorResponse) Render ¶
func (r *ErrorResponse) Render(w http.ResponseWriter) error
type GlobalURLOptions ¶
GlobalURLOptions contains fields used for deriving the global URL for local targets.
type HttpResponseRenderer ¶
type HttpResponseRenderer interface {
Render(w http.ResponseWriter) error
}
type MergeTimeoutError ¶
type MergeTimeoutError struct {
// contains filtered or unexported fields
}
func NewMergeTimeoutError ¶
func NewMergeTimeoutError(count int) *MergeTimeoutError
func (*MergeTimeoutError) Error ¶
func (e *MergeTimeoutError) Error() string
type MetaReport ¶
type MetaReport struct { SampleTypes []ValueType `json:"sampleTypes"` DefaultSampleType string `json:"defaultSampleType"` }
func GenerateMetaReport ¶
func GenerateMetaReport(profile *profile.Profile) (*MetaReport, error)
type NoTargetRetriever ¶
type NoTargetRetriever struct{}
NoTargetRetriever is passed to the API when only the API is served and no scraping is happening.
func (NoTargetRetriever) TargetsActive ¶
func (t NoTargetRetriever) TargetsActive() map[string][]*scrape.Target
func (NoTargetRetriever) TargetsDropped ¶
func (t NoTargetRetriever) TargetsDropped() map[string][]*scrape.Target
type Option ¶
type Option func(*API)
func WithMaxMergeBatchSize ¶
func WithPrefix ¶
func WithQueryTimeout ¶
func WithReloadChannel ¶
func WithReloadChannel(reloadCh chan struct{}) Option
func WithSymbolizer ¶
func WithSymbolizer(s Symbolizer) Option
func WithTargets ¶
func WithTargets(targets func(ctx context.Context) TargetRetriever) Option
type ProfileResponseRenderer ¶
type ProfileResponseRenderer struct {
// contains filtered or unexported fields
}
func (*ProfileResponseRenderer) Render ¶
func (r *ProfileResponseRenderer) Render(w http.ResponseWriter) error
type ProtoRenderer ¶
type ProtoRenderer struct {
// contains filtered or unexported fields
}
func NewProtoRenderer ¶
func NewProtoRenderer(profile *profile.Profile) *ProtoRenderer
func (*ProtoRenderer) Render ¶
func (r *ProtoRenderer) Render(w http.ResponseWriter) error
type SVGRenderer ¶
type SVGRenderer struct {
// contains filtered or unexported fields
}
func NewSVGRenderer ¶
func (*SVGRenderer) Render ¶
func (r *SVGRenderer) Render(w http.ResponseWriter) error
type SuccessResponse ¶
type SuccessResponse struct { Data interface{} Warnings []error }
func NewSuccessResponse ¶
func NewSuccessResponse(data interface{}, warnings []error) *SuccessResponse
func (*SuccessResponse) Render ¶
func (r *SuccessResponse) Render(w http.ResponseWriter) error
type Target ¶
type Target struct { // Labels before any processing. DiscoveredLabels map[string]string `json:"discoveredLabels"` // Any labels that are added to this target and its metrics. Labels map[string]string `json:"labels"` ScrapePool string `json:"scrapePool"` ScrapeURL string `json:"scrapeUrl"` GlobalURL string `json:"globalUrl"` LastError string `json:"lastError"` LastScrape time.Time `json:"lastScrape"` LastScrapeDuration float64 `json:"lastScrapeDuration"` Health scrape.TargetHealth `json:"health"` }
Target has the information for one target.
type TargetDiscovery ¶
type TargetDiscovery struct { ActiveTargets []*Target `json:"activeTargets"` DroppedTargets []*DroppedTarget `json:"droppedTargets"` }
TargetDiscovery has all the active targets.
type TargetRetriever ¶
Click to show internal directories.
Click to hide internal directories.