opencensus

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRecorder

func NewRecorder(cfg Config) (metrics.Recorder, error)

NewRecorder returns a new Recorder that uses OpenCensus stats as the backend.

Types

type Config

type Config struct {
	// DurationBuckets are the buckets used for the HTTP request duration metrics,
	// by default uses default buckets (from 5ms to 10s).
	DurationBuckets []float64
	// SizeBuckets are the buckets for the HTTP response size metrics,
	// by default uses a exponential buckets from 100B to 1GB.
	SizeBuckets []float64
	// HandlerIDLabel is the name that will be set to the handler ID label, by default is `handler`.
	HandlerIDLabel string
	// StatusCodeLabel is the name that will be set to the status code label, by default is `code`.
	StatusCodeLabel string
	// MethodLabel is the name that will be set to the method label, by default is `method`.
	MethodLabel string
	// ServiceLabel is the name that will be set to the service label, by default is `service`.
	ServiceLabel string
	// UnregisterViewsBeforeRegister will unregister the previous Recorder views before registering
	// again. This is required on cases where multiple instances of recorder will be made due to how
	// Opencensus is implemented (everything is at global state). Sadly this option is a kind of hack
	// so we can test without exposing the views to the user. On regular usage this option is very
	// rare to use it.
	UnregisterViewsBeforeRegister bool
}

Config has the dependencies and values of the recorder.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL