grpcapmkit

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package grpcapmkit provides grpc-apm related helper

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStreamServerInterceptor

func NewStreamServerInterceptor(o ...ServerOption) grpc.StreamServerInterceptor

NewStreamServerInterceptor returns a grpc.StreamServerInterceptor that traces gRPC stream requests with the given options.

The interceptor will trace transactions with the "request" type for each incoming stream 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.

func NewUnaryServerInterceptor

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 "request" 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.

Types

type ServerOption

type ServerOption func(*serverOptions)

ServerOption sets options for server-side tracing.

func WithElasticTracer

func WithElasticTracer(t *apm.Tracer) ServerOption

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

func WithPinpointAgent

func WithPinpointAgent(a pinpoint.Agent) ServerOption

WithPinpointAgent returns a ServerOption which sets a as the agent to use for tracing server requests.

Jump to

Keyboard shortcuts

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