metrics

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewRelicContextKey = "newrelic_context"
)

Variables

This section is empty.

Functions

func RecordCount

func RecordCount(ctx context.Context, metricName string, count uint64)

RecordCount records a count metric

func RecordDuration

func RecordDuration(ctx context.Context, metricName string, duration time.Duration)

RecordDuration records a duration metric

func RecordEvent

func RecordEvent(ctx context.Context, eventName string, kvPairs map[string]interface{})

RecordEvent records a new event with a name and set of key-value pairs

Types

type CustomNewRelicContextLogFormatter

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

CustomNewRelicContextLogFormatter is a logrus.Formatter that will format logs for sending to New Relic. This is a custom implementation that includes sending all logrus.Entry.Fields, which isn't supported out of the box yet

Based off of: https://github.com/newrelic/go-agent/blob/f1942e10f0819e2c854d5d7289eb0dc1c52a00af/v3/integrations/logcontext-v2/nrlogrus/formatter.go

func (CustomNewRelicContextLogFormatter) Format

type MethodTracer

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

MethodTracer collects analytics for a given method call within an existing trace.

func TraceMethodCall

func TraceMethodCall(ctx context.Context, structOrPackageName, methodName string) *MethodTracer

TraceMethodCall traces a method call with a given struct/package and method names

func (*MethodTracer) AddAttribute

func (t *MethodTracer) AddAttribute(key string, value interface{})

AddAttribute adds a key-value pair metadata to the method trace

func (*MethodTracer) AddAttributes

func (t *MethodTracer) AddAttributes(attributes map[string]interface{})

AddAttributes adds a set of key-value pair metadata to the method trace

func (*MethodTracer) End

func (t *MethodTracer) End()

End completes the trace for the method call.

func (*MethodTracer) OnError

func (t *MethodTracer) OnError(err error)

OnError observes an error within a method trace

Jump to

Keyboard shortcuts

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