Documentation ¶
Overview ¶
Package meter is for instrumentation
Index ¶
- Variables
- func NewContext(ctx context.Context, c Meter) context.Context
- func Sort(slice *[]string)
- type Counter
- type FloatCounter
- type Gauge
- type Histogram
- type Meter
- type Option
- func Address(value string) Option
- func Context(ctx context.Context) Option
- func Labels(ls ...string) Option
- func Logger(l logger.Logger) Option
- func Name(n string) Option
- func Path(value string) Option
- func SetOption(k, v interface{}) Option
- func WriteFDMetrics(b bool) Option
- func WriteProcessMetrics(b bool) Option
- type Options
- type Summary
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultMeter is the default meter DefaultMeter Meter = NewMeter() // DefaultAddress data will be made available on this host:port DefaultAddress = ":9090" // DefaultPath the meter endpoint where the Meter data will be made available DefaultPath = "/metrics" // DefaultMetricPrefix holds the string that prepends to all metrics DefaultMetricPrefix = "micro_" // DefaultLabelPrefix holds the string that prepends to all labels DefaultLabelPrefix = "micro_" // DefaultSummaryQuantiles is the default spread of stats for summary DefaultSummaryQuantiles = []float64{0.5, 0.9, 0.97, 0.99, 1} // DefaultSummaryWindow is the default window for summary DefaultSummaryWindow = 5 * time.Minute )
Functions ¶
func NewContext ¶ added in v3.1.5
NewContext put meter in context
Types ¶
type FloatCounter ¶ added in v3.1.4
FloatCounter is a float64 counter
type Histogram ¶ added in v3.1.4
Histogram is a histogram for non-negative values with automatically created buckets
type Meter ¶ added in v3.1.4
type Meter interface { Name() string Init(opts ...Option) error Counter(name string, labels ...string) Counter FloatCounter(name string, labels ...string) FloatCounter Gauge(name string, fn func() float64, labels ...string) Gauge Set(opts ...Option) Meter Histogram(name string, labels ...string) Histogram Summary(name string, labels ...string) Summary SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) Summary Write(w io.Writer, opts ...Option) error Options() Options String() string }
Meter is an interface for collecting and instrumenting metrics
func FromContext ¶ added in v3.1.5
FromContext get meter from context
type Option ¶
type Option func(*Options)
Option powers the configuration for metrics implementations:
func SetOption ¶ added in v3.1.5
func SetOption(k, v interface{}) Option
SetOption returns a function to setup a context with given value
func WriteFDMetrics ¶ added in v3.2.12
WriteFDMetrics enable fd metrics output for write
func WriteProcessMetrics ¶ added in v3.2.12
WriteProcessMetrics enable process metrics output for write
type Options ¶
type Options struct { // Logger used for logging Logger logger.Logger // Context holds external options Context context.Context // Name holds the meter name Name string // Address holds the address that serves metrics Address string // Path holds the path for metrics Path string // MetricPrefix holds the prefix for all metrics MetricPrefix string // LabelPrefix holds the prefix for all labels LabelPrefix string // Labels holds the default labels Labels []string // WriteProcessMetrics flag to write process metrics WriteProcessMetrics bool // WriteFDMetrics flag to write fd metrics WriteFDMetrics bool }
Options for metrics implementations:
Click to show internal directories.
Click to hide internal directories.