monitoring

package
v5.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetBlobStoreStats

func SetBlobStoreStats(s BlobStats)

func SetElasticSearchSyncing added in v5.6.1

func SetElasticSearchSyncing(inProgress bool)

SetElasticSearchSyncing sets the charmstore_elastic_search_syncing gauge to 1 if inProgress, 0 otherwise (as per common practice for tracking "booleans" in ElasticSearch).

Types

type BlobStats

type BlobStats struct {
	// Count holds the total number of blobs stored.
	Count int
	// MaxSize holds the size of the largest blob.
	MaxSize int64
	// MeanSize holds the average blob size.
	MeanSize int64
}

BlobStats holds statistics about blobs in the blob store.

type Duration

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

Duration represents a time duration to be monitored. The duration starts when the Duration is created and finishes when Done is called.

func NewBlobstoreGCDuration

func NewBlobstoreGCDuration() *Duration

NewBlobstoreGCDuration returns a new Duration to be used for measuring the time taken to run the blobstore garbage collector.

func NewUploadProcessingDuration

func NewUploadProcessingDuration() *Duration

NewUploadProcessingDuration returns a new Duration to be used for measuring the time taken to process an upload.

func (*Duration) Done

func (d *Duration) Done()

Done observes the duration on a Duration as a metric. It should only be called once.

type DurationVec added in v5.6.2

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

DurationVec represents a time duration to be monitored, but uses a prometheus.SummaryVec collector to allow dimension partitioning with labels. The duration starts when the Duration is created and finishes when Done is called.

func NewMetaDuration added in v5.6.2

func NewMetaDuration(metaName string) *DurationVec

NewMetaDuration returns a new DurationVec to be used for measuring the time taken to get metadata for an entity.

func (*DurationVec) Done added in v5.6.2

func (d *DurationVec) Done()

Done observes the duration on a DurationVec as a metric. It should only be called once.

type Request

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

Request represents a monitoring request. To record a request, either create a new request with NewRequest or call Reset on an existing Request; then call Done when the request has completed.

func NewRequest

func NewRequest(req *http.Request, root string) *Request

NewRequest returns a new monitoring request for monitoring a request within the given root. When the request is done, Done should be called.

func (*Request) Done

func (r *Request) Done(status func() int)

Done records that the request is complete, and records any metrics for the request since the last call to Reset. If the request endpoint is empty, it falls back to the path from the request url.

func (*Request) Endpoint added in v5.6.2

func (r *Request) Endpoint() string

Endpoint returns the currently set endpoint for the request. If it is not set it falls back to the request URL path if one exists (e.g. it may not in unit testing).

func (*Request) Reset

func (r *Request) Reset(req *http.Request, root string)

Reset resets r to indicate that a new request has started. The parameter holds the API root (for example the API version).

func (*Request) SetEndpoint added in v5.6.2

func (r *Request) SetEndpoint(endpoint string)

SetEndpoint sets the endpoint of the request.

type ResponseWriter added in v5.6.1

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter wraps the http.ResponseWriter to give us the ability to retrieve the HTTP status code at any point after the response has been written.

Note: This is does not implement any of the optional methods implemented by ResponseWriters. (i.e. CloseNotifier, Flusher, Hijacker)

func NewResponseWriter added in v5.6.1

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

NewResponseWriter creates a new *ResponseWriter from a provided http.ResponseWriter

func (*ResponseWriter) Status added in v5.6.1

func (w *ResponseWriter) Status() int

Status returns the status of the ResponseWriter. It will be 0 if not set yet.

func (*ResponseWriter) Write added in v5.6.1

func (w *ResponseWriter) Write(b []byte) (int, error)

Write records the HTTP status before calling Write on the underlying http.ResponseWriter. If the status has not been set by this point, it is set to 200 OK (something the underlying http.ResponseWriter will do anyway).

func (*ResponseWriter) WriteHeader added in v5.6.1

func (w *ResponseWriter) WriteHeader(status int)

WriteHeader records the HTTP status before calling WriteHeader on the underlying http.ResponseWriter.

Jump to

Keyboard shortcuts

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