Documentation
¶
Index ¶
- Constants
- func DeleteGlobalTag(key string)
- func IsFieldValueValid(value interface{}) (bool, error)
- func IsKeyValid(key string) (bool, error)
- func IsNameValid(name string) (bool, error)
- func IsTagValueValid(value string) (bool, error)
- func SetGlobalTag(key string, value string) error
- func SetMetrics(m Interface)
- func SubmitPoints(ctx context.Context, m Interface, itr PointIterator) error
- func SubmitSlice(ctx context.Context, m Interface, pts []*Point) error
- type BasicMetricsable
- type Fields
- type Interface
- type Logger
- type Metricsable
- type Metricser
- type Point
- type PointIterator
- type SetMetricser
- type SwapMetrics
- func (s *SwapMetrics) Close() error
- func (s *SwapMetrics) Submit(ctx context.Context, p *Point) error
- func (s *SwapMetrics) SubmitPoints(ctx context.Context, itr PointIterator) error
- func (s *SwapMetrics) SubmitSlice(ctx context.Context, ps []*Point) error
- func (s *SwapMetrics) Swap(m Interface)
- func (s *SwapMetrics) Unwrap() Interface
- type Tags
- type ToMany
- func (s *ToMany) Append(m ...Interface)
- func (s *ToMany) Close() (err error)
- func (s *ToMany) Len() (n int)
- func (s *ToMany) Metrics() []Interface
- func (s *ToMany) Reset() []Interface
- func (s *ToMany) Submit(ctx context.Context, p *Point) (err error)
- func (s *ToMany) SubmitSlice(ctx context.Context, ps []*Point) (err error)
Constants ¶
const Discard = discard(0)
Discard discards all metrics.
Variables ¶
This section is empty.
Functions ¶
func DeleteGlobalTag ¶
func DeleteGlobalTag(key string)
DeleteGlobalTag removes the tag with given key from the list of global tags.
func IsFieldValueValid ¶
IsFieldValueValid validates the given field value, returning true if and only if value validates. A valid field value is one of the following types:
- time.Time
- time.Duration
- int, int8, int16, int32, int64
- uint, uint8, uint16, uint32, uint64
- float64
- bool
- string
Any other type is considered invalid. In addition:
- if the value is a string, it must have length < 32768;
- if the value is a float64, it must not be NaN.
If validation fails, an error will be returned describing the problem.
func IsKeyValid ¶
IsKeyValid validates the given key, returning true if and only if the key validates. A valid key must satisfy:
- non-empty
- length < 256
with characters consisting only of the ASCII characters:
- a-z, A-Z, and 0-9
- '.', '-', and '_'.
Any other character is considered invalid. In order to maintain compatibility with InfluxDB, the key "time" is prohibited. If validation fails, an error will be returned describing the problem.
func IsNameValid ¶
IsNameValid validates the given name, returning true if and only if the name validates. A valid name must satisfy:
- non-empty
- length < 256
with characters consisting only of the ASCII characters:
- a-z, A-Z, and 0-9
- '.', '-', and '_'.
Any other character is considered invalid. In order to maintain compatibility with InfluxDB, the name "time" is prohibited. If validation fails, an error will be returned describing the problem.
func IsTagValueValid ¶
IsTagValueValid validates the given tag value, returning true if and only if the value validates. A valid tag value must satisfy:
- length < 256
If validation fails, an error will be returned describing the problem.
func SetGlobalTag ¶
SetGlobalTag adds the tag with given key and value to the list of global tags. Any existing global tag with the same key will have its value replaced. Global tags are automatically added to the tags for any point created with NewPoint or NewPointWithTimestamp. If a tag is provided to NewPoint or NewPointWithTimestamp with the same key as a global tag, then the point will use the provided value rather than the global value.
func SubmitPoints ¶
func SubmitPoints(ctx context.Context, m Interface, itr PointIterator) error
SubmitPoints will submit the points in the given iterator to m. If m satisfies the interface
type SubmitPointser interface { SubmitPoints(context.Context, PointIterator) error }
then m's SubmitPoints method will be used. Otherwise, if m satisfies the interface
type SubmitSlicer interface { SubmitSlice(context.Context, []*Point) error }
then m's SubmitSlice method will be used.
func SubmitSlice ¶
SubmitSlice will submit the given slice of points to m. If m satisfies the interface
type SubmitSlicer interface { SubmitSlice(context.Context, []*Point) error }
then m's SubmitSlice method will be used. Otherwise, if m satisfies the interface
type SubmitPointser interface { SubmitPoints(context.Context, PointIterator) error }
then m's SubmitPoints method will be used.
Types ¶
type BasicMetricsable ¶
type BasicMetricsable struct {
// contains filtered or unexported fields
}
BasicMetricsable provides an embeddable implementation of a Metricsable.
func (*BasicMetricsable) Metrics ¶
func (b *BasicMetricsable) Metrics() Interface
Metrics returns the metrics endpoint.
func (*BasicMetricsable) SetMetrics ¶
func (b *BasicMetricsable) SetMetrics(m Interface)
SetMetrics sets a metrics endpoint.
type Fields ¶
type Fields map[string]interface{}
Fields is a map of field names and values. The values must take one of the following types:
time.Time time.Duration int, int8, int16, int32, int64 uint, uint8, uint16, uint32, uint64 float64 bool string
func (*Fields) GobDecode ¶
GobDecode overwrites the receiver, which must be a pointer, with the value represented by the byte slice, which was written by GobEncode.
func (Fields) IsValid ¶
IsValid returns true if and only if the fields are valid. If false, an error will be returned describing the problem. The fields are considered valid if and only if:
- the keys satisfy IsKeyValid;
- the values satisfy IsFieldValueValid.
type Interface ¶
type Interface interface {
Submit(ctx context.Context, p *Point) error // Submit submits the given point.
}
Interface is a metrics endpoint that stores metric points.
type Metricsable ¶
type Metricsable interface { SetMetricser Metricser }
Metricsable is the interface satisfied by the SetMetrics and Metrics methods. It indicates an object that supports metrics reporting.
type Metricser ¶
type Metricser interface {
Metrics() Interface // Metrics returns the metrics endpoint.
}
Metricser is the interface satisfied by the Metrics method.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point represents a point for a metric. That is, a unique tuple of name, fields, tags, and timestamp.
func NewPoint ¶
NewPoint returns a new point with the given data. Any global tags will also be included in the tags for this point. If a tag is provided with the same key as a global tag, then the point will use the provided value rather than the global value. The timestamp will be set to the current time. The data is considered valid if and only if:
- the name satisfies IsNameValid;
- the fields satisfy fields.IsValid;
- the tags satisfy tags.IsValid.
If validation fails, an error will be returned describing the problem.
func NewPointWithTimestamp ¶
func NewPointWithTimestamp(name string, fields Fields, tags Tags, timestamp time.Time) (*Point, error)
NewPointWithTimestamp returns a new point with the given data. Any global tags will also be included in the tags for this point. If a tag is provided with the same key as a global tag, then the point will use the provided value rather than the global value. The data is considered valid if and only if:
- the name satisfies IsNameValid;
- the fields satisfy fields.IsValid;
- the tags satisfy tags.IsValid;
- the timestamp is non-zero.
If validation fails, an error will be returned describing the problem.
func RawPoint ¶
RawPoint returns a new point with the given data. Unlike in the case of NewPoint and NewPointWithTimestamp, global tags will not be included in the returned point. The data is considered valid if and only if:
- the name satisfies IsNameValid;
- the fields satisfy fields.IsValid;
- the tags satisfy tags.IsValid;
- the timestamp is non-zero.
If validation fails, an error will be returned describing the problem.
func (*Point) GobDecode ¶
GobDecode overwrites the receiver, which must be a valid pointer, with the value represented by the byte slice, which was written by GobEncode.
type PointIterator ¶
type PointIterator interface { Close() error // Close closes the iterator, preventing further iteration. Err() error // Err returns the last error, if any, encountered during iteration. Err may be called after Close. Next() bool // Next advances the iterator. Returns true if there are more points in the iterator; false otherwise. Next must be called before the first call to Value. Value() *Point // Value returns the current point in the iterator. Attempting to call Value after the iterator is closed, or without a previous successful call to Next, may panic. }
PointIterator describe an iterator for Point data.
func IteratorFromSlice ¶
func IteratorFromSlice(S []*Point) PointIterator
IteratorFromSlice returns a PointIterator based on S.
type SetMetricser ¶
type SetMetricser interface {
SetMetrics(m Interface) // SetMetrics sets a metrics endpoint.
}
SetMetricser is the interface satisfied by the SetMetrics method.
type SwapMetrics ¶
type SwapMetrics struct {
// contains filtered or unexported fields
}
SwapMetrics wraps an Interface that may be safely replaced while other go routines use the SwapMetrics concurrently. The zero value for a SwapMetrics will discard all metrics without error.
func (*SwapMetrics) Close ¶
func (s *SwapMetrics) Close() error
Close calls Close on the wrapped Interface, if the wrapped Interface satisfies the io.Closer interface. Otherwise it does nothing.
func (*SwapMetrics) Submit ¶
func (s *SwapMetrics) Submit(ctx context.Context, p *Point) error
Submit submits the given point to the wrapped Interface.
func (*SwapMetrics) SubmitPoints ¶
func (s *SwapMetrics) SubmitPoints(ctx context.Context, itr PointIterator) error
SubmitPoints submits the points in the given iterator to the wrapped Interface.
func (*SwapMetrics) SubmitSlice ¶
func (s *SwapMetrics) SubmitSlice(ctx context.Context, ps []*Point) error
SubmitSlice submits the given slice of points to the wrapped Interface.
func (*SwapMetrics) Swap ¶
func (s *SwapMetrics) Swap(m Interface)
Swap replaces the currently wrapped Interface with m. This will panic if s is nil.
func (*SwapMetrics) Unwrap ¶
func (s *SwapMetrics) Unwrap() Interface
Unwrap returns the wrapped Interface. If the wrapped Interface is nil, then Discard is returned.
type Tags ¶
Tags is a map of tag names and values.
func (Tags) IsValid ¶
IsValid returns true if and only if the tags are valid. If false, an error will be returned describing the problem. The tags are considered valid if and only if:
- the keys satisfy IsKeyValid;
- the values satisfy IsTagValueValid.
type ToMany ¶
type ToMany struct {
// contains filtered or unexported fields
}
ToMany combines multiple Interfaces, sending all metrics to each of the Interfaces. ToMany is safe to be used concurrently. The zero value for a ToMany will discard all metrics without an error.
func (*ToMany) Append ¶
Append appends the given Interfaces to the slice of Interfaces being used. This will panic if s is nil.
func (*ToMany) Close ¶
Close calls Close on each of the associated Interfaces, if the Interface satisfies the io.Closer interface.
func (*ToMany) Reset ¶
Reset returns the current slice of Interfaces being used, and empties this slice.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
Package influxdb provides an InfluxDB endpoint for metrics data.
|
Package influxdb provides an InfluxDB endpoint for metrics data. |
metricsdbflag
Package metricsdbflag provides a standard flag set for configuring the metrics package and starting metrics collection.
|
Package metricsdbflag provides a standard flag set for configuring the metrics package and starting metrics collection. |
Package metricsreporter provides a reporter for metrics data collected by package "github.com/rcrowley/go-metrics".
|
Package metricsreporter provides a reporter for metrics data collected by package "github.com/rcrowley/go-metrics". |