Go API Documentation

github.com/TykTechnologies/tyk/internal/service/newrelic

No package summary is available.

Package

Files: 3. Third party imports: 5. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Vars

var (
	NewApplication	= newrelic.NewApplication
	FromContext	= newrelic.FromContext

	ConfigLogger			= newrelic.ConfigLogger
	ConfigEnabled			= newrelic.ConfigEnabled
	ConfigAppName			= newrelic.ConfigAppName
	ConfigLicense			= newrelic.ConfigLicense
	ConfigDistributedTracerEnabled	= newrelic.ConfigDistributedTracerEnabled
)
var _ newrelic.Logger = &Logger{}

Types

Logger

This type doesn't have documentation.

Field name Field type Comment

*logrus.Entry

No comment on field.
type Logger struct {
	*logrus.Entry
}

Sink

This type doesn't have documentation.

Field name Field type Comment
relic

*newrelic.Application

No comment on field.

health.Sink

No comment on field.
type Sink struct {
	relic	*newrelic.Application
	health.Sink
}

Application, Transaction, ConfigOption

This type doesn't have documentation.

Field name Field type Comment
type

newrelic.Application

No comment on field.
type

newrelic.Transaction

No comment on field.
type

newrelic.ConfigOption

No comment on field.
type (
	Application	= newrelic.Application
	Transaction	= newrelic.Transaction
	ConfigOption	= newrelic.ConfigOption
)

Functions

func Mount

Mount adds the nrgorilla middleware to the router. The application is added to the request context. If app is nil, nothing will be done and the function will return.

func Mount(router *mux.Router, app *Application) {
	if app == nil {
		return
	}

	router.Use(nrgorilla.Middleware(app))
}

Cognitive complexity: 2, Cyclomatic complexity: 2

Uses: nrgorilla.Middleware.

func NewLogger

func NewLogger(e *logrus.Entry) *Logger {
	return &Logger{e}
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func NewSink

func NewSink(relic *newrelic.Application) *Sink {
	return &Sink{
		relic: relic,
	}
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func (*Logger) Debug

func (l *Logger) Debug(msg string, c map[string]interface{}) {
	l.WithFields(c).Debug(msg)
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func (*Logger) DebugEnabled

func (l *Logger) DebugEnabled() bool {
	return l.Level >= logrus.DebugLevel
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: logrus.DebugLevel.

func (*Logger) Error

func (l *Logger) Error(msg string, c map[string]interface{}) {
	l.WithFields(c).Error(msg)
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func (*Logger) Info

func (l *Logger) Info(msg string, c map[string]interface{}) {
	l.WithFields(c).Info(msg)
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func (*Logger) Warn

func (l *Logger) Warn(msg string, c map[string]interface{}) {
	l.WithFields(c).Warn(msg)
}

Cognitive complexity: 1, Cyclomatic complexity: 1

func (*Sink) EmitComplete

func (s *Sink) EmitComplete(job string, status health.CompletionStatus, nanoseconds int64, kvs map[string]string) {
	s.relic.RecordCustomEvent(job+":health:"+status.String()+":duration_ns:"+strconv.FormatInt(nanoseconds, 10), makeParams(kvs))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: strconv.FormatInt.

func (*Sink) EmitEvent

func (s *Sink) EmitEvent(job string, event string, kvs map[string]string) {
	s.relic.RecordCustomEvent(job+":"+event, makeParams(kvs))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

func (*Sink) EmitEventErr

func (s *Sink) EmitEventErr(job string, event string, err error, kvs map[string]string) {
	s.relic.RecordCustomEvent(job+":"+event+":msg:"+err.Error(), makeParams(kvs))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

func (*Sink) EmitGauge

func (s *Sink) EmitGauge(job string, event string, value float64, kvs map[string]string) {
	s.relic.RecordCustomEvent(job+":"+event+":value:"+fmt.Sprintf("%.2f", value), makeParams(kvs))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: fmt.Sprintf.

func (*Sink) EmitTiming

func (s *Sink) EmitTiming(job string, event string, nanoseconds int64, kvs map[string]string) {
	s.relic.RecordCustomEvent(job+":"+event+":duration_ns:"+strconv.FormatInt(nanoseconds, 10), makeParams(kvs))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: strconv.FormatInt.

Private functions

func makeParams

makeParams (kvs map[string]string) map[string]interface{}