Skip to content

Commit

Permalink
grpc: Add StaticMethod CallOption (grpc#6926)
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq committed Feb 15, 2024
1 parent 8a4ca0c commit 1120f38
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions rpc_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ type EmptyCallOption struct{}
func (EmptyCallOption) before(*callInfo) error { return nil }
func (EmptyCallOption) after(*callInfo, *csAttempt) {}

// StaticMethod returns a CallOption which specifies that a call is being made
// to a method that is static, which means the method is known at compile time
// and doesn't change at runtime. This can be used as a signal to stats plugins
// that this method is safe to include as a key to a measurement.
func StaticMethod() CallOption {
return StaticMethodCallOption{}
}

// StaticMethodCallOption is a CallOption that specifies that a call comes
// from a static method.
type StaticMethodCallOption struct {
EmptyCallOption
}

// Header returns a CallOptions that retrieves the header metadata
// for a unary RPC.
func Header(md *metadata.MD) CallOption {
Expand Down Expand Up @@ -958,6 +972,7 @@ const (
SupportPackageIsVersion5 = true
SupportPackageIsVersion6 = true
SupportPackageIsVersion7 = true
SupportPackageIsVersion8 = true
)

const grpcUA = "grpc-go/" + Version

0 comments on commit 1120f38

Please sign in to comment.