Documentation ¶
Overview ¶
+build !cgo appengine
Index ¶
- Variables
- func CaptureTaggedRuntimeMemStatsOnce(r TaggedRegistry)
- func CleanOpenTSDB(s string) string
- func CleanOpenTSDBRune(r, replace rune) rune
- func RegisterTaggedRuntimeMemStats(r TaggedRegistry)
- type ClearableMetric
- type DefaultTaggedMetric
- type DefaultTaggedRegistry
- func (r *DefaultTaggedRegistry) Add(name string, tags Tags, i interface{}) error
- func (r *DefaultTaggedRegistry) Each(f func(string, TaggedMetric))
- func (r *DefaultTaggedRegistry) Get(name string, tags Tags) interface{}
- func (r *DefaultTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
- func (r *DefaultTaggedRegistry) Register(name string, tags Tags, i interface{}) error
- func (r *DefaultTaggedRegistry) RunHealthchecks()
- func (r *DefaultTaggedRegistry) Unregister(name string, tags Tags)
- func (r *DefaultTaggedRegistry) UnregisterAll()
- func (r *DefaultTaggedRegistry) UnregisterMetric(i interface{})
- func (r *DefaultTaggedRegistry) WrappedEach(wrapperFunc func(string, TaggedMetric) (string, TaggedMetric), ...)
- type DuplicateTaggedMetric
- type IntHistogram
- func (h *IntHistogram) Clear()
- func (h *IntHistogram) Count() int64
- func (h *IntHistogram) Max() int64
- func (h *IntHistogram) Mean() int64
- func (h *IntHistogram) Min() int64
- func (h *IntHistogram) Percentile(p float64) int64
- func (h *IntHistogram) Percentiles(ps []float64) []int64
- func (h *IntHistogram) Sample() metrics.Sample
- func (h *IntHistogram) Snapshot() IntegerHistogram
- func (h *IntHistogram) StdDev() int64
- func (h *IntHistogram) Sum() int64
- func (h *IntHistogram) Update(v int64)
- func (h *IntHistogram) Variance() int64
- type IntHistogramSnapshot
- func (*IntHistogramSnapshot) Clear()
- func (h *IntHistogramSnapshot) Count() int64
- func (h *IntHistogramSnapshot) Max() int64
- func (h *IntHistogramSnapshot) Mean() int64
- func (h *IntHistogramSnapshot) Min() int64
- func (h *IntHistogramSnapshot) Percentile(p float64) int64
- func (h *IntHistogramSnapshot) Percentiles(ps []float64) []int64
- func (h *IntHistogramSnapshot) Sample() metrics.Sample
- func (h *IntHistogramSnapshot) Snapshot() IntegerHistogram
- func (h *IntHistogramSnapshot) StdDev() int64
- func (h *IntHistogramSnapshot) Sum() int64
- func (*IntHistogramSnapshot) Update(int64)
- func (h *IntHistogramSnapshot) Variance() int64
- type IntegerHistogram
- type OpenTSDBFormat
- type OpenTSDBPoint
- type PrefixedTaggedRegistry
- func (r *PrefixedTaggedRegistry) Add(name string, tags Tags, i interface{}) error
- func (r *PrefixedTaggedRegistry) Each(fn func(string, TaggedMetric))
- func (r *PrefixedTaggedRegistry) Get(name string, tags Tags) interface{}
- func (r *PrefixedTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
- func (r *PrefixedTaggedRegistry) Register(name string, tags Tags, i interface{}) error
- func (r *PrefixedTaggedRegistry) RunHealthchecks()
- func (r *PrefixedTaggedRegistry) Unregister(name string, tags Tags)
- func (r *PrefixedTaggedRegistry) UnregisterAll()
- func (r *PrefixedTaggedRegistry) UnregisterMetric(i interface{})
- func (r *PrefixedTaggedRegistry) WrappedEach(wrapperFn func(string, TaggedMetric) (string, TaggedMetric), ...)
- type SegmentedTaggedRegistry
- func (r *SegmentedTaggedRegistry) Add(name string, tags Tags, i interface{}) error
- func (r *SegmentedTaggedRegistry) Each(fn func(string, TaggedMetric))
- func (r *SegmentedTaggedRegistry) Get(name string, tags Tags) interface{}
- func (r *SegmentedTaggedRegistry) GetName(name string) string
- func (r *SegmentedTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
- func (r *SegmentedTaggedRegistry) GetPrefix() string
- func (r *SegmentedTaggedRegistry) GetRootRegistry() TaggedRegistry
- func (r *SegmentedTaggedRegistry) GetTags(t Tags) Tags
- func (r *SegmentedTaggedRegistry) Register(name string, tags Tags, i interface{}) error
- func (r *SegmentedTaggedRegistry) RunHealthchecks()
- func (r *SegmentedTaggedRegistry) Unregister(name string, tags Tags)
- func (r *SegmentedTaggedRegistry) UnregisterAll()
- func (r *SegmentedTaggedRegistry) UnregisterMetric(i interface{})
- func (r *SegmentedTaggedRegistry) WrappedEach(wrapperFn func(string, TaggedMetric) (string, TaggedMetric), ...)
- type TaggedMetric
- type TaggedOpenTSDB
- type TaggedRegistry
- type Tags
- type TagsID
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var RuntimeCaptureFn = []func(TaggedRegistry){CaptureTaggedRuntimeMemStatsOnce}
Functions ¶
func CaptureTaggedRuntimeMemStatsOnce ¶
func CaptureTaggedRuntimeMemStatsOnce(r TaggedRegistry)
Capture new values for the Go runtime statistics exported in runtime.MemStats. This is designed to be called in a background goroutine. Giving a registry which has not been given to RegisterRuntimeMemStats will panic.
Be very careful with this because runtime.ReadMemStats calls the C functions runtime·semacquire(&runtime·worldsema) and runtime·stoptheworld() and that last one does what it says on the tin.
func CleanOpenTSDB ¶
func CleanOpenTSDBRune ¶
func RegisterTaggedRuntimeMemStats ¶
func RegisterTaggedRuntimeMemStats(r TaggedRegistry)
Register runtimeMetrics for the Go runtime statistics exported in runtime and specifically runtime.MemStats. The runtimeMetrics are named by their fully-qualified Go symbols, i.e. runtime.MemStats.Alloc.
Types ¶
type ClearableMetric ¶
type ClearableMetric interface {
Clear()
}
type DefaultTaggedMetric ¶
type DefaultTaggedMetric struct { Tags Tags Metric interface{} }
func (*DefaultTaggedMetric) AddTags ¶
func (m *DefaultTaggedMetric) AddTags(tags Tags) TaggedMetric
func (*DefaultTaggedMetric) GetMetric ¶
func (m *DefaultTaggedMetric) GetMetric() interface{}
func (*DefaultTaggedMetric) GetTags ¶
func (m *DefaultTaggedMetric) GetTags() Tags
func (*DefaultTaggedMetric) GetTagsID ¶
func (m *DefaultTaggedMetric) GetTagsID() TagsID
func (*DefaultTaggedMetric) TagString ¶
func (m *DefaultTaggedMetric) TagString() string
type DefaultTaggedRegistry ¶
type DefaultTaggedRegistry struct {
// contains filtered or unexported fields
}
The standard implementation of a Registry is a mutex-protected map of names to metrics.
func (*DefaultTaggedRegistry) Add ¶
func (r *DefaultTaggedRegistry) Add(name string, tags Tags, i interface{}) error
func (*DefaultTaggedRegistry) Each ¶
func (r *DefaultTaggedRegistry) Each(f func(string, TaggedMetric))
Call the given function for each registered metric.
func (*DefaultTaggedRegistry) Get ¶
func (r *DefaultTaggedRegistry) Get(name string, tags Tags) interface{}
Get the metric by the given name or nil if none is registered.
func (*DefaultTaggedRegistry) GetOrRegister ¶
func (r *DefaultTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
Gets an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure. The interface can be the metric to register if not found in registry, or a function returning the metric for lazy instantiation.
func (*DefaultTaggedRegistry) Register ¶
func (r *DefaultTaggedRegistry) Register(name string, tags Tags, i interface{}) error
Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.
func (*DefaultTaggedRegistry) RunHealthchecks ¶
func (r *DefaultTaggedRegistry) RunHealthchecks()
Run all registered healthchecks.
func (*DefaultTaggedRegistry) Unregister ¶
func (r *DefaultTaggedRegistry) Unregister(name string, tags Tags)
Unregister the metric with the given name.
func (*DefaultTaggedRegistry) UnregisterAll ¶
func (r *DefaultTaggedRegistry) UnregisterAll()
Unregister all metrics. (Mostly for testing.)
func (*DefaultTaggedRegistry) UnregisterMetric ¶
func (r *DefaultTaggedRegistry) UnregisterMetric(i interface{})
Unregister the metric using the Metric object itself.
func (*DefaultTaggedRegistry) WrappedEach ¶
func (r *DefaultTaggedRegistry) WrappedEach(wrapperFunc func(string, TaggedMetric) (string, TaggedMetric), f func(string, TaggedMetric))
type DuplicateTaggedMetric ¶
type DuplicateTaggedMetric struct {
// contains filtered or unexported fields
}
DuplicateMetric is the error returned by Registry.Register when a metric already exists. If you mean to Register that metric you must first Unregister the existing metric.
func (DuplicateTaggedMetric) Error ¶
func (err DuplicateTaggedMetric) Error() string
type IntHistogram ¶
type IntHistogram struct {
// contains filtered or unexported fields
}
IntHistogram is the standard implementation of a Histogram and uses a Sample to bound its memory use.
func (*IntHistogram) Clear ¶
func (h *IntHistogram) Clear()
Clear clears the histogram and its sample.
func (*IntHistogram) Count ¶
func (h *IntHistogram) Count() int64
Count returns the number of samples recorded since the histogram was last cleared.
func (*IntHistogram) Max ¶
func (h *IntHistogram) Max() int64
Max returns the maximum value in the sample.
func (*IntHistogram) Mean ¶
func (h *IntHistogram) Mean() int64
Mean returns the mean of the values in the sample.
func (*IntHistogram) Min ¶
func (h *IntHistogram) Min() int64
Min returns the minimum value in the sample.
func (*IntHistogram) Percentile ¶
func (h *IntHistogram) Percentile(p float64) int64
Percentile returns an arbitrary percentile of the values in the sample.
func (*IntHistogram) Percentiles ¶
func (h *IntHistogram) Percentiles(ps []float64) []int64
Percentiles returns a slice of arbitrary percentiles of the values in the sample.
func (*IntHistogram) Sample ¶
func (h *IntHistogram) Sample() metrics.Sample
Sample returns the Sample underlying the histogram.
func (*IntHistogram) Snapshot ¶
func (h *IntHistogram) Snapshot() IntegerHistogram
Snapshot returns a read-only copy of the histogram.
func (*IntHistogram) StdDev ¶
func (h *IntHistogram) StdDev() int64
StdDev returns the standard deviation of the values in the sample.
func (*IntHistogram) Variance ¶
func (h *IntHistogram) Variance() int64
Variance returns the variance of the values in the sample.
type IntHistogramSnapshot ¶
type IntHistogramSnapshot struct {
// contains filtered or unexported fields
}
IntHistogramSnapshot is a read-only copy of another Histogram.
func (*IntHistogramSnapshot) Count ¶
func (h *IntHistogramSnapshot) Count() int64
Count returns the number of samples recorded at the time the snapshot was taken.
func (*IntHistogramSnapshot) Max ¶
func (h *IntHistogramSnapshot) Max() int64
Max returns the maximum value in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Mean ¶
func (h *IntHistogramSnapshot) Mean() int64
Mean returns the mean of the values in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Min ¶
func (h *IntHistogramSnapshot) Min() int64
Min returns the minimum value in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Percentile ¶
func (h *IntHistogramSnapshot) Percentile(p float64) int64
Percentile returns an arbitrary percentile of values in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Percentiles ¶
func (h *IntHistogramSnapshot) Percentiles(ps []float64) []int64
Percentiles returns a slice of arbitrary percentiles of values in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Sample ¶
func (h *IntHistogramSnapshot) Sample() metrics.Sample
Sample returns the Sample underlying the histogram.
func (*IntHistogramSnapshot) Snapshot ¶
func (h *IntHistogramSnapshot) Snapshot() IntegerHistogram
Snapshot returns the snapshot.
func (*IntHistogramSnapshot) StdDev ¶
func (h *IntHistogramSnapshot) StdDev() int64
StdDev returns the standard deviation of the values in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Sum ¶
func (h *IntHistogramSnapshot) Sum() int64
Sum returns the sum in the sample at the time the snapshot was taken.
func (*IntHistogramSnapshot) Variance ¶
func (h *IntHistogramSnapshot) Variance() int64
Variance returns the variance of inputs at the time the snapshot was taken.
type IntegerHistogram ¶
type IntegerHistogram interface { Clear() Count() int64 Max() int64 Mean() int64 Min() int64 Percentile(float64) int64 Percentiles([]float64) []int64 Sample() metrics.Sample Snapshot() IntegerHistogram StdDev() int64 Sum() int64 Update(int64) Variance() int64 }
func NewIntegerHistogram ¶
func NewIntegerHistogram(s metrics.Sample) IntegerHistogram
type OpenTSDBPoint ¶
type PrefixedTaggedRegistry ¶
type PrefixedTaggedRegistry struct {
// contains filtered or unexported fields
}
Provide a single set of tags and a prefix for all metrics in registry
func (*PrefixedTaggedRegistry) Add ¶
func (r *PrefixedTaggedRegistry) Add(name string, tags Tags, i interface{}) error
func (*PrefixedTaggedRegistry) Each ¶
func (r *PrefixedTaggedRegistry) Each(fn func(string, TaggedMetric))
Call the given function for each registered metric.
func (*PrefixedTaggedRegistry) Get ¶
func (r *PrefixedTaggedRegistry) Get(name string, tags Tags) interface{}
Get the metric by the given name or nil if none is registered.
func (*PrefixedTaggedRegistry) GetOrRegister ¶
func (r *PrefixedTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
Gets an existing metric or registers the given one. The interface can be the metric to register if not found in registry, or a function returning the metric for lazy instantiation.
func (*PrefixedTaggedRegistry) Register ¶
func (r *PrefixedTaggedRegistry) Register(name string, tags Tags, i interface{}) error
Register the given metric under the given name. The name will be prefixed.
func (*PrefixedTaggedRegistry) RunHealthchecks ¶
func (r *PrefixedTaggedRegistry) RunHealthchecks()
Run all registered healthchecks.
func (*PrefixedTaggedRegistry) Unregister ¶
func (r *PrefixedTaggedRegistry) Unregister(name string, tags Tags)
Unregister the metric with the given name. The name will be prefixed.
func (*PrefixedTaggedRegistry) UnregisterAll ¶
func (r *PrefixedTaggedRegistry) UnregisterAll()
Unregister all metrics. (Mostly for testing.)
func (*PrefixedTaggedRegistry) UnregisterMetric ¶
func (r *PrefixedTaggedRegistry) UnregisterMetric(i interface{})
Unregister the metric using the Metric object itself.
func (*PrefixedTaggedRegistry) WrappedEach ¶
func (r *PrefixedTaggedRegistry) WrappedEach(wrapperFn func(string, TaggedMetric) (string, TaggedMetric), fn func(string, TaggedMetric))
type SegmentedTaggedRegistry ¶
type SegmentedTaggedRegistry struct {
// contains filtered or unexported fields
}
func (*SegmentedTaggedRegistry) Add ¶
func (r *SegmentedTaggedRegistry) Add(name string, tags Tags, i interface{}) error
func (*SegmentedTaggedRegistry) Each ¶
func (r *SegmentedTaggedRegistry) Each(fn func(string, TaggedMetric))
Call the given function for each registered metric.
func (*SegmentedTaggedRegistry) Get ¶
func (r *SegmentedTaggedRegistry) Get(name string, tags Tags) interface{}
Get the metric by the given name or nil if none is registered.
func (*SegmentedTaggedRegistry) GetName ¶
func (r *SegmentedTaggedRegistry) GetName(name string) string
func (*SegmentedTaggedRegistry) GetOrRegister ¶
func (r *SegmentedTaggedRegistry) GetOrRegister(name string, tags Tags, i interface{}) interface{}
Gets an existing metric or registers the given one. The interface can be the metric to register if not found in registry, or a function returning the metric for lazy instantiation.
func (*SegmentedTaggedRegistry) GetPrefix ¶
func (r *SegmentedTaggedRegistry) GetPrefix() string
func (*SegmentedTaggedRegistry) GetRootRegistry ¶
func (r *SegmentedTaggedRegistry) GetRootRegistry() TaggedRegistry
func (*SegmentedTaggedRegistry) GetTags ¶
func (r *SegmentedTaggedRegistry) GetTags(t Tags) Tags
func (*SegmentedTaggedRegistry) Register ¶
func (r *SegmentedTaggedRegistry) Register(name string, tags Tags, i interface{}) error
Register the given metric under the given name. The name will be prefixed.
func (*SegmentedTaggedRegistry) RunHealthchecks ¶
func (r *SegmentedTaggedRegistry) RunHealthchecks()
Run all registered healthchecks.
func (*SegmentedTaggedRegistry) Unregister ¶
func (r *SegmentedTaggedRegistry) Unregister(name string, tags Tags)
Unregister the metric with the given name. The name will be prefixed.
func (*SegmentedTaggedRegistry) UnregisterAll ¶
func (r *SegmentedTaggedRegistry) UnregisterAll()
Unregister all metrics. (Mostly for testing.)
func (*SegmentedTaggedRegistry) UnregisterMetric ¶
func (r *SegmentedTaggedRegistry) UnregisterMetric(i interface{})
Unregister the metric using the Metric object itself.
func (*SegmentedTaggedRegistry) WrappedEach ¶
func (r *SegmentedTaggedRegistry) WrappedEach(wrapperFn func(string, TaggedMetric) (string, TaggedMetric), fn func(string, TaggedMetric))
type TaggedMetric ¶
type TaggedMetric interface { GetTags() Tags GetMetric() interface{} GetTagsID() TagsID TagString() string AddTags(Tags) TaggedMetric }
type TaggedOpenTSDB ¶
type TaggedOpenTSDB struct { Addr string // Network address to connect to Registry TaggedRegistry // Registry to be exported FlushInterval time.Duration // Flush interval DurationUnit time.Duration // Time conversion unit for durations Format OpenTSDBFormat Compress bool BulkSize int Logger log.FieldLogger // contains filtered or unexported fields }
TaggedOpenTSDBConfig provides a container with configuration parameters for the TaggedOpenTSDB exporter
Example ¶
go TaggedOpenTSDB(context.Background(), DefaultTaggedRegistry, 1*time.Second, "some.prefix", ":2003", Tcollector)
Output:
func (*TaggedOpenTSDB) Export ¶
func (t *TaggedOpenTSDB) Export() error
func (*TaggedOpenTSDB) Run ¶
func (t *TaggedOpenTSDB) Run(ctx context.Context)
TaggedOpenTSDBWithConfig is a blocking exporter function just like TaggedOpenTSDB, but it takes a TaggedOpenTSDBConfig instead.
func (*TaggedOpenTSDB) RunWithPreprocessing ¶
func (t *TaggedOpenTSDB) RunWithPreprocessing(ctx context.Context, fn []func(TaggedRegistry))
func (*TaggedOpenTSDB) RunWithProcessing ¶
func (t *TaggedOpenTSDB) RunWithProcessing(ctx context.Context, preFn, postFn []func(TaggedRegistry))
type TaggedRegistry ¶
type TaggedRegistry interface { // Call the given function for each registered metric. Each(func(string, TaggedMetric)) WrappedEach(func(string, TaggedMetric) (string, TaggedMetric), func(string, TaggedMetric)) // Get the metric by the given name or nil if none is registered. Get(string, Tags) interface{} // Gets an existing metric or registers the given one. // The interface can be the metric to register if not found in registry, // or a function returning the metric for lazy instantiation. GetOrRegister(string, Tags, interface{}) interface{} // Register the given metric under the given name. Register(string, Tags, interface{}) error // Add() will add metrics that will be reported a single time // without getting registered Add(string, Tags, interface{}) error // Run all registered healthchecks. RunHealthchecks() // Unregister the metric with the given name. Unregister(string, Tags) // Unregister the metric using the Metric object itself. UnregisterMetric(interface{}) // Unregister all metrics. (Mostly for testing.) UnregisterAll() }
This is an interface so as to encourage other structs to implement the Registry API as appropriate.
func NewPrefixedTaggedRegistry ¶
func NewPrefixedTaggedRegistry(prefix string, tags Tags) TaggedRegistry
func NewRootSegmentedTaggedRegistry ¶
func NewRootSegmentedTaggedRegistry(tags Tags) TaggedRegistry
func NewSegmentedTaggedRegistry ¶
func NewSegmentedTaggedRegistry(prefix string, tags Tags, parentRegistry TaggedRegistry) TaggedRegistry