Documentation ¶
Index ¶
- Constants
- func DecrementGauge(ctx context.Context, metric string)
- func IncrementCounter(ctx context.Context, metric string)
- func IncrementGauge(ctx context.Context, metric string)
- func IsTemporary(err error) bool
- func Logger(ctx context.Context) logrus.FieldLogger
- func LoggerWithFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- func NewRNG(seed int64) *rand.Rand
- func NewSyslogHook(url *url.URL, prefix string) error
- func PublishElapsedTimeHistogram(ctx context.Context, key string, start, end time.Time)
- func PublishHistogram(ctx context.Context, key string, value float64)
- func PublishHistogramToSpan(span opentracing.Span, key string, value float64)
- func PublishHistograms(ctx context.Context, metrics map[string]float64)
- func SetLogDest(to, prefix string)
- func SetLogLevel(ll string)
- func WithLogger(ctx context.Context, l logrus.FieldLogger) context.Context
- type Backoff
- type BoxTime
- type Clock
- type Temporary
Constants ¶
const ( // FnPrefix is a constant for "fn_", used as a prefix for span names, field names, Prometheus metric names and Prometheus label names FnPrefix = "fn_" // FieldnamePrefixHistogram is prefixed to the name of a logged field // to denote that it corresponds to a histogram metric FieldnamePrefixHistogram = FnPrefix + "histogram_" // FieldnamePrefixCounter is prefixed to the name of a logged field // to denote that it corresponds to a counter metric FieldnamePrefixCounter = FnPrefix + "counter_" // FieldnamePrefixGauge is prefixed to the name of a logged field // to denote that it corresponds to a gauge metric FieldnamePrefixGauge = FnPrefix + "gauge_" // SpannameSuffixDummy is suffixed to the name of a tracing span // to denote that it has been created solely for the purpose of carrying metric values // and is not itself of any interest and should not be converted to a Prometheus duration metric SpannameSuffixDummy = "_dummy" )
Variables ¶
This section is empty.
Functions ¶
func DecrementGauge ¶
DecrementGauge decrements the specified gauge metric It does this by logging an appropriate field value to a tracing span.
func IncrementCounter ¶
IncrementCounter increments the specified counter metric It does this by logging an appropriate field value to a tracing span.
func IncrementGauge ¶
IncrementGauge increments the specified gauge metric It does this by logging an appropriate field value to a tracing span.
func IsTemporary ¶
func Logger ¶
func Logger(ctx context.Context) logrus.FieldLogger
Logger returns the structured logger.
func LoggerWithFields ¶
func LoggerWithFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)
Attempt at simplifying this whole logger in the context thing Could even make this take a generic map, then the logger that gets returned could be used just like the stdlib too, since it's compatible
func PublishElapsedTimeHistogram ¶
PublishElapsedTimeToSpan publishes the specifed histogram elapsed time since start It does this by logging an appropriate field value to a tracing span Use this when the current tracing span is long-lived and you want the metric to be visible before it ends
func PublishHistogram ¶
PublishHistogram publishes the specifed histogram metric It does this by logging an appropriate field value to a tracing span Use this when the current tracing span is long-lived and you want the metric to be visible before it ends
func PublishHistogramToSpan ¶
PublishHistogramToSpan publishes the specifed histogram metric It does this by logging an appropriate field value to the specified tracing span Use this when you don't need to create a new tracing span
func PublishHistograms ¶
PublishHistograms publishes the specifed histogram metrics It does this by logging appropriate field values to a tracing span Use this when the current tracing span is long-lived and you want the metric to be visible before it ends
func SetLogDest ¶
func SetLogDest(to, prefix string)
func SetLogLevel ¶
func SetLogLevel(ll string)
func WithLogger ¶
WithLogger stores the logger.