apm-agent-go: github.com/elastic/apm-agent-go/module/apmgrpc Index | Files

package apmgrpc

import "github.com/elastic/apm-agent-go/module/apmgrpc"

Package apmgrpc provides interceptors for tracing gRPC.

Index

Package Files

client.go doc.go ignorer.go packages.go server.go

func IgnoreNone Uses

func IgnoreNone(*grpc.UnaryServerInfo) bool

IgnoreNone is a RequestIgnorerFunc which ignores no requests.

func NewUnaryClientInterceptor Uses

func NewUnaryClientInterceptor(o ...ClientOption) grpc.UnaryClientInterceptor

NewUnaryClientInterceptor returns a grpc.UnaryClientInterceptor that traces gRPC requests with the given options.

The interceptor will trace spans with the "grpc" type for each request made, for any client method presented with a context containing a sampled apm.Transaction.

func NewUnaryServerInterceptor Uses

func NewUnaryServerInterceptor(o ...ServerOption) grpc.UnaryServerInterceptor

NewUnaryServerInterceptor returns a grpc.UnaryServerInterceptor that traces gRPC requests with the given options.

The interceptor will trace transactions with the "grpc" type for each incoming request. The transaction will be added to the context, so server methods can use apm.StartSpan with the provided context.

By default, the interceptor will trace with apm.DefaultTracer, and will not recover any panics. Use WithTracer to specify an alternative tracer, and WithRecovery to enable panic recovery.

type ClientOption Uses

type ClientOption func(*clientOptions)

ClientOption sets options for client-side tracing.

type RequestIgnorerFunc Uses

type RequestIgnorerFunc func(*grpc.UnaryServerInfo) bool

RequestIgnorerFunc is the type of a function for use in WithServerRequestIgnorer.

func DefaultServerRequestIgnorer Uses

func DefaultServerRequestIgnorer() RequestIgnorerFunc

DefaultServerRequestIgnorer returns the default RequestIgnorer to use in handlers.

func NewRegexpRequestIgnorer Uses

func NewRegexpRequestIgnorer(re *regexp.Regexp) RequestIgnorerFunc

NewRegexpRequestIgnorer returns a RequestIgnorerFunc which matches requests' URLs against re. Note that for server requests, typically only Path and possibly RawQuery will be set, so the regular expression should take this into account.

type ServerOption Uses

type ServerOption func(*serverOptions)

ServerOption sets options for server-side tracing.

func WithRecovery Uses

func WithRecovery() ServerOption

WithRecovery returns a ServerOption which enables panic recovery in the gRPC server interceptor.

The interceptor will report panics as errors to Elastic APM, but unless this is enabled, they will still cause the server to be terminated. With recovery enabled, panics will be translated to gRPC errors with the code gprc/codes.Internal.

func WithServerRequestIgnorer Uses

func WithServerRequestIgnorer(r RequestIgnorerFunc) ServerOption

WithServerRequestIgnorer returns a ServerOption which sets r as the function to use to determine whether or not a server request should be ignored. If r is nil, all requests will be reported.

func WithTracer Uses

func WithTracer(t *apm.Tracer) ServerOption

WithTracer returns a ServerOption which sets t as the tracer to use for tracing server requests.

Package apmgrpc imports 11 packages (graph). Updated 2020-05-30. Refresh now. Tools for package owners.