1 // Copyright The OpenTelemetry Authors 2 // SPDX-License-Identifier: Apache-2.0 3 4 package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" 5 6 import ( 7 "google.golang.org/grpc" 8 ) 9 10 // InterceptorType is the flag to define which gRPC interceptor 11 // the InterceptorInfo object is. 12 type InterceptorType uint8 13 14 const ( 15 // UndefinedInterceptor is the type for the interceptor information that is not 16 // well initialized or categorized to other types. 17 UndefinedInterceptor InterceptorType = iota 18 // UnaryClient is the type for grpc.UnaryClient interceptor. 19 UnaryClient 20 // StreamClient is the type for grpc.StreamClient interceptor. 21 StreamClient 22 // UnaryServer is the type for grpc.UnaryServer interceptor. 23 UnaryServer 24 // StreamServer is the type for grpc.StreamServer interceptor. 25 StreamServer 26 ) 27 28 // InterceptorInfo is the union of some arguments to four types of 29 // gRPC interceptors. 30 type InterceptorInfo struct { 31 // Method is method name registered to UnaryClient and StreamClient 32 Method string 33 // UnaryServerInfo is the metadata for UnaryServer 34 UnaryServerInfo *grpc.UnaryServerInfo 35 // StreamServerInfo if the metadata for StreamServer 36 StreamServerInfo *grpc.StreamServerInfo 37 // Type is the type for interceptor 38 Type InterceptorType 39 } 40