ceremonyclient/node/internal/grpc/middleware.go
petricadaipegsp 80c7ec2889
Add initial Prometheus support (#353)
* Add Prometheus server

* Add Prometheus gRPC metrics

* Add BlossomSub metrics

---------

Co-authored-by: Cassandra Heart <7929478+CassOnMars@users.noreply.github.com>
2024-11-16 17:53:19 -06:00

28 lines
712 B
Go

package grpc
import "google.golang.org/grpc"
// ServerOptions returns a list of grpc.ServerOptions which are commonly used.
func ServerOptions(opts ...grpc.ServerOption) []grpc.ServerOption {
return append(opts,
grpc.ChainUnaryInterceptor(
serverMetrics.UnaryServerInterceptor(),
),
grpc.ChainStreamInterceptor(
serverMetrics.StreamServerInterceptor(),
),
)
}
// ClientOptions returns a list of grpc.DialOptions which are commonly used.
func ClientOptions(opts ...grpc.DialOption) []grpc.DialOption {
return append(opts,
grpc.WithChainStreamInterceptor(
clientMetrics.StreamClientInterceptor(),
),
grpc.WithChainUnaryInterceptor(
clientMetrics.UnaryClientInterceptor(),
),
)
}