monitoring

package
v5.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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 montored. 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 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.

func (*Request) Kind

func (r *Request) Kind() string

Kind returns the kind that has been set. This is useful for 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) SetKind

func (r *Request) SetKind(kind string)

SetKind sets the kind of the request. This is an arbitrary string to classify different kinds of 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