apmzap

package module
v1.15.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// FieldKeyTraceID is the field key for the trace ID.
	FieldKeyTraceID = "trace.id"

	// FieldKeyTransactionID is the field key for the transaction ID.
	FieldKeyTransactionID = "transaction.id"

	// FieldKeySpanID is the field key for the span ID.
	FieldKeySpanID = "span.id"
)
View Source
const (
	// DefaultFatalFlushTimeout is the default value for Hook.FatalFlushTimeout.
	DefaultFatalFlushTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func TraceContext

func TraceContext(ctx context.Context) []zapcore.Field

TraceContext returns zap.Fields containing the trace context of the transaction and span contained in ctx, if any.

Types

type Core

type Core struct {
	// Tracer is the apm.Tracer to use for reporting errors.
	// If Tracer is nil, then apm.DefaultTracer will be used.
	Tracer *apm.Tracer

	// FatalFlushTimeout is the amount of time to wait while
	// flushing a fatal log message to the APM Server before
	// the process is exited. If this is 0, then
	// DefaultFatalFlushTimeout will be used. If the timeout
	// is a negative value, then no flushing will be performed.
	FatalFlushTimeout time.Duration
}

Core is an implementation of zapcore.Core, reporting log records as errors to the APM Server. If TraceContext is used to add trace IDs to the log records, the errors reported will be associated with them.

func (*Core) Check

func (c *Core) Check(entry zapcore.Entry, checked *zapcore.CheckedEntry) *zapcore.CheckedEntry

Check checks if the entry should be logged, and adds c to checked if so.

func (*Core) Enabled

func (*Core) Enabled(level zapcore.Level) bool

Enabled returns true if level is >= zapcore.ErrorLevel.

func (*Core) Sync

func (*Core) Sync() error

Sync is a no-op.

func (*Core) With

func (c *Core) With(fields []zapcore.Field) zapcore.Core

With returns a new zapcore.Core that decorates c with fields.

func (*Core) WrapCore

func (c *Core) WrapCore(core zapcore.Core) zapcore.Core

WrapCore returns zapcore.NewTee(core, c). WrapCore is suitable for passing to zap.WrapCore.

func (*Core) Write

func (c *Core) Write(entry zapcore.Entry, fields []zapcore.Field) error

Write reports entry and fields as an error using c.tracer.

Jump to

Keyboard shortcuts

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