grpc_trace

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of message transmitted or received.
	RPCNameKey = attribute.Key("name")

	// Type of message transmitted or received.
	RPCMessageTypeKey = attribute.Key("message.type")

	// Identifier of message transmitted or received.
	RPCMessageIDKey = attribute.Key("message.id")

	// The compressed size of the message transmitted or received in bytes.
	RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size")

	// The uncompressed size of the message transmitted or received in
	// bytes.
	RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size")
)

Semantic conventions for attribute keys for gRPC.

View Source
const (
	// GRPCStatusCodeKey is convention for numeric status code of a gRPC request.
	GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code")
)

Variables

View Source
var (
	// Semantic convention for gRPC as the remoting system.
	RPCSystemGRPC = semconv.RPCSystemKey.String("grpc")

	// Semantic convention for a message named message.
	RPCNameMessage = RPCNameKey.String("message")

	// Semantic conventions for RPC message types.
	RPCMessageTypeSent     = RPCMessageTypeKey.String("SENT")
	RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED")
)

Semantic conventions for common RPC attributes.

Functions

func Extract

func Extract(ctx context.Context, metadata *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext)

Extract returns the correlation context and span context that another service encoded in the gRPC metadata object with Inject. This function is meant to be used on incoming requests.

func Inject

func Inject(ctx context.Context, metadata *metadata.MD, opts ...Option)

Inject injects correlation context and span context into the gRPC metadata object. This function is meant to be used on outgoing requests.

func ParseFullMethod

func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue)

ParseFullMethod returns a span name following the OpenTelemetry semantic conventions as well as all applicable span attribute.KeyValue attributes based on a gRPC's FullMethod.

func SemVersion

func SemVersion() string

SemVersion is the semantic version to be supplied to tracer/meter creation.

func StreamClientInterceptor

func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor

StreamClientInterceptor returns a grpc.StreamClientInterceptor suitable for use in a grpc.Dial call.

func StreamServerInterceptor

func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor

StreamServerInterceptor returns a grpc.StreamServerInterceptor suitable for use in a grpc.NewServer call.

func UnaryClientInterceptor

func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a grpc.UnaryClientInterceptor suitable for use in a grpc.Dial call.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable for use in a grpc.NewServer call.

func Version

func Version() string

Version is the current release version of the gRPC instrumentation.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option applies an option value for a config.

func WithExcludeRegexEndpoint

func WithExcludeRegexEndpoint(excludeRegexEndpoint []string) Option

WithExcludeRegexEndpoint set excludeRegexEndpoint function regexp

func WithExcludeRegexMethod

func WithExcludeRegexMethod(excludeRegexMethod []string) Option

WithExcludeRegexMethod set excludeRegexMethod function regexp

func WithExcludeRegexStatus

func WithExcludeRegexStatus(excludeRegexStatus []string) Option

WithExcludeRegexStatus set excludeRegexStatus function regexp

func WithName

func WithName(name string) Option

WithName name default Service

func WithSpanIdKey

func WithSpanIdKey(spanIdKey string) Option

WithSpanIdKey spanIdKey default span-id

func WithTraceIdKey

func WithTraceIdKey(traceIdKey string) Option

WithTraceIdKey traceIdKey default trace-id

func WithTracer

func WithTracer(tracerServer *tracer.Server) Option

WithTracer tracerServer tracer.Server

func WithWriterSpanId

func WithWriterSpanId() Option

WithWriterSpanId writer spanId function

func WithWriterTraceId

func WithWriterTraceId() Option

WithWriterTraceId writer traceId function

Jump to

Keyboard shortcuts

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