v1.62.0 Latest Latest

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 19 Imported by: 4



Package grpc is a generated protocol buffer package.

It is generated from these files:


It has these top-level messages:


Package grpc provides functions to trace the package v1.2.

Example (Client)
package main

import (

	grpctrace ""


func main() {
	// Create the client interceptor using the grpc trace package.
	i := grpctrace.UnaryClientInterceptor(grpctrace.WithServiceName("my-grpc-client"))

	// Dial in using the created interceptor...
	conn, err := grpc.Dial("localhost:50051", grpc.WithInsecure(), grpc.WithUnaryInterceptor(i))
	if err != nil {
	defer conn.Close()

	// And continue using the connection as normal.

Example (Server)
package main

import (

	grpctrace ""


func main() {
	// Create a listener for the server.
	ln, err := net.Listen("tcp", ":50051")
	if err != nil {

	// Create the unary server interceptor using the grpc trace package.
	i := grpctrace.UnaryServerInterceptor(grpctrace.WithServiceName("my-grpc-client"))

	// Initialize the grpc server as normal, using the tracing interceptor.
	s := grpc.NewServer(grpc.UnaryInterceptor(i))

	// ... register your services

	// Start serving incoming connections.
	if err := s.Serve(ln); err != nil {
		log.Fatalf("failed to serve: %v", err)




This section is empty.


This section is empty.


func RegisterFixtureServer

func RegisterFixtureServer(s *grpc1.Server, srv FixtureServer)

func UnaryClientInterceptor

func UnaryClientInterceptor(opts ...InterceptorOption) grpc.UnaryClientInterceptor

UnaryClientInterceptor will add tracing to a grpc client.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...InterceptorOption) grpc.UnaryServerInterceptor

UnaryServerInterceptor will trace requests to the given grpc server.


type FixtureClient

type FixtureClient interface {
	Ping(ctx context.Context, in *FixtureRequest, opts ...grpc1.CallOption) (*FixtureReply, error)

func NewFixtureClient

func NewFixtureClient(cc *grpc1.ClientConn) FixtureClient

type FixtureReply

type FixtureReply struct {
	Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`

The response message containing the greetings

func (*FixtureReply) Descriptor

func (*FixtureReply) Descriptor() ([]byte, []int)

func (*FixtureReply) GetMessage

func (m *FixtureReply) GetMessage() string

func (*FixtureReply) ProtoMessage

func (*FixtureReply) ProtoMessage()

func (*FixtureReply) Reset

func (m *FixtureReply) Reset()

func (*FixtureReply) String

func (m *FixtureReply) String() string

type FixtureRequest

type FixtureRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`

The request message containing the user's name.

func (*FixtureRequest) Descriptor

func (*FixtureRequest) Descriptor() ([]byte, []int)

func (*FixtureRequest) GetName

func (m *FixtureRequest) GetName() string

func (*FixtureRequest) ProtoMessage

func (*FixtureRequest) ProtoMessage()

func (*FixtureRequest) Reset

func (m *FixtureRequest) Reset()

func (*FixtureRequest) String

func (m *FixtureRequest) String() string

type FixtureServer

type FixtureServer interface {
	Ping(context.Context, *FixtureRequest) (*FixtureReply, error)

type InterceptorOption

type InterceptorOption func(*interceptorConfig)

InterceptorOption represents an option that can be passed to the grpc unary client and server interceptors.

func WithAnalytics added in v1.11.0

func WithAnalytics(on bool) InterceptorOption

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate added in v1.11.0

func WithAnalyticsRate(rate float64) InterceptorOption

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithServiceName

func WithServiceName(name string) InterceptorOption

WithServiceName sets the given service name for the intercepted client.

func WithSpanOptions added in v1.49.0

func WithSpanOptions(opts ...ddtrace.StartSpanOption) InterceptorOption

WithSpanOptions defines a set of additional ddtrace.StartSpanOption to be added to spans started by the integration.

Jump to

Keyboard shortcuts

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