monitoring

package
Version: v1.13.9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tag

func Tag(key, value string) string

Tag will create from given key and value a tag for statsd metrics in a format key:value Value will be sanitized by default: - value will be lowercase, starting with letter - value will contain only alphanumerics and underscores, commas and slashes sanitizing can be skipped by using UnsafeTag instead.

func UnsafeTag

func UnsafeTag(key, value string) string

UnsafeTag will create from given key and value a tag for statsd metrics in a format key:value. Skips sanitization and as such should be used only with internal values that we know will be safe.

Types

type MetricSettings

type MetricSettings struct {
	Host        string
	Port        string
	Namespace   string
	Environment string
}

MetricSettings are settings required to set up metrics client.

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics is the instance of metrics to be used.

func CreateNewMetricService

func CreateNewMetricService(settings MetricSettings) (*Metrics, error)

CreateNewMetricService creates an instance of Metrics and returns it.

func (*Metrics) Incr

func (c *Metrics) Incr(name string, tags ...string)

Incr increases a metric by 1.

type Tracer

type Tracer struct{}

Tracer is the Tracer instance that contains all the methods.

func CreateNewTracingService

func CreateNewTracingService(options TracerOptions) (*Tracer, error)

CreateNewTracingService creates a new Instance of Tracer.

func (*Tracer) FinishSpan

func (*Tracer) FinishSpan(span tracer.Span)

FinishSpan finishes tracking given span. Should be used in conjunction with defer to trigger at the end of every function that should be tracked.

func (*Tracer) StartSpan

func (*Tracer) StartSpan(operationName, resourceName, resourceType string) tracer.Span

StartSpan creates a new tracing span and returns it.

func (*Tracer) StartSpanWithContext

func (*Tracer) StartSpanWithContext(
	oldContext context.Context,
	operationName,
	resourceName,
	resourceType string) (tracer.Span, context.Context)

StartSpanWithContext creates a new span attached to current context.

func (*Tracer) Stop

func (*Tracer) Stop()

Stop stops the instance of Tracer.

type TracerOptions

type TracerOptions struct {
	ServiceName string
	Environment string
	Host        string
	Port        string
}

TracerOptions are required options to create an instance of a tracer.

Jump to

Keyboard shortcuts

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