newrelic

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider wraps a New Relic application to implement the metrics.Provider interface

func NewProvider

func NewProvider(app *newrelic.Application) *Provider

NewProvider creates a new New Relic metrics provider

func (*Provider) Application

func (p *Provider) Application() *newrelic.Application

Application returns the underlying New Relic application for cases where direct access is needed (e.g., log integration)

func (*Provider) RecordCount

func (p *Provider) RecordCount(metricName string, count uint64)

RecordCount records a count metric

func (*Provider) RecordDuration

func (p *Provider) RecordDuration(metricName string, duration time.Duration)

RecordDuration records a duration metric

func (*Provider) RecordEvent

func (p *Provider) RecordEvent(eventName string, attributes map[string]interface{})

RecordEvent records a custom event with key-value attributes

func (*Provider) StartTrace

func (p *Provider) StartTrace(name string) metrics.Trace

StartTrace starts a new trace

type Span

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

Span wraps a New Relic segment

func (*Span) AddAttribute

func (s *Span) AddAttribute(key string, value interface{})

AddAttribute adds a key-value attribute to the span

func (*Span) End

func (s *Span) End()

End completes the span

type Trace

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

Trace wraps a New Relic transaction

func (*Trace) AddAttribute

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

AddAttribute adds a key-value attribute to the trace

func (*Trace) End

func (t *Trace) End()

End completes the trace

func (*Trace) EnrichContext added in v0.29.0

func (t *Trace) EnrichContext(ctx context.Context) context.Context

EnrichContext implements metrics.ContextEnricher to add the New Relic transaction to the context using New Relic's context key. This enables automatic instrumentation by libraries like nrpgx.

func (*Trace) OnError

func (t *Trace) OnError(err error)

OnError records an error on the trace

func (*Trace) SetRequest

func (t *Trace) SetRequest(r metrics.Request)

SetRequest sets HTTP request information on the trace

func (*Trace) SetResponse

func (t *Trace) SetResponse(w http.ResponseWriter) http.ResponseWriter

SetResponse sets the HTTP response writer for the trace

func (*Trace) StartSpan

func (t *Trace) StartSpan(name string) metrics.Span

StartSpan starts a new span within the trace

func (*Trace) Unwrap

func (t *Trace) Unwrap() *newrelic.Transaction

Unwrap returns the underlying New Relic transaction for advanced use cases

Jump to

Keyboard shortcuts

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