Class: Labkit::Logging::GRPC::ServerInterceptor

Inherits:
GRPC::ServerInterceptor
  • Object
show all
Includes:
Correlation::GRPC::GRPCCommon
Defined in:
lib/labkit/logging/grpc/server_interceptor.rb

Constant Summary collapse

CODE_STRINGS =
{
  ::GRPC::Core::StatusCodes::OK => "OK",
  ::GRPC::Core::StatusCodes::CANCELLED => "Canceled",
  ::GRPC::Core::StatusCodes::UNKNOWN => "Unknown",
  ::GRPC::Core::StatusCodes::INVALID_ARGUMENT => "InvalidArgument",
  ::GRPC::Core::StatusCodes::DEADLINE_EXCEEDED => "DeadlineExceeded",
  ::GRPC::Core::StatusCodes::NOT_FOUND => "NotFound",
  ::GRPC::Core::StatusCodes::ALREADY_EXISTS => "AlreadyExists",
  ::GRPC::Core::StatusCodes::PERMISSION_DENIED => "PermissionDenied",
  ::GRPC::Core::StatusCodes::RESOURCE_EXHAUSTED => "ResourceExhausted",
  ::GRPC::Core::StatusCodes::FAILED_PRECONDITION => "FailedPrecondition",
  ::GRPC::Core::StatusCodes::ABORTED => "Aborted",
  ::GRPC::Core::StatusCodes::OUT_OF_RANGE => "OutOfRange",
  ::GRPC::Core::StatusCodes::UNIMPLEMENTED => "Unimplemented",
  ::GRPC::Core::StatusCodes::INTERNAL => "Internal",
  ::GRPC::Core::StatusCodes::UNAVAILABLE => "Unavailable",
  ::GRPC::Core::StatusCodes::DATA_LOSS => "DataLoss",
  ::GRPC::Core::StatusCodes::UNAUTHENTICATED => "Unauthenticated",
}.freeze

Constants included from Correlation::GRPC::GRPCCommon

Correlation::GRPC::GRPCCommon::CORRELATION_METADATA_KEY

Instance Method Summary collapse

Methods included from Correlation::GRPC::GRPCCommon

#rpc_split

Constructor Details

#initialize(log_file, default_tags) ⇒ ServerInterceptor

Returns a new instance of ServerInterceptor.



34
35
36
37
38
39
40
# File 'lib/labkit/logging/grpc/server_interceptor.rb', line 34

def initialize(log_file, default_tags)
  @log_file = log_file
  @log_file.sync = true
  @default_tags = default_tags

  super()
end

Instance Method Details

#bidi_streamer(requests: nil, call: nil, method: nil) ⇒ Object



54
55
56
# File 'lib/labkit/logging/grpc/server_interceptor.rb', line 54

def bidi_streamer(requests: nil, call: nil, method: nil)
  log_request(method, call) { yield }
end

#client_streamer(call: nil, method: nil) ⇒ Object



50
51
52
# File 'lib/labkit/logging/grpc/server_interceptor.rb', line 50

def client_streamer(call: nil, method: nil)
  log_request(method, call) { yield }
end

#request_response(request: nil, call: nil, method: nil) ⇒ Object



42
43
44
# File 'lib/labkit/logging/grpc/server_interceptor.rb', line 42

def request_response(request: nil, call: nil, method: nil)
  log_request(method, call) { yield }
end

#server_streamer(request: nil, call: nil, method: nil) ⇒ Object



46
47
48
# File 'lib/labkit/logging/grpc/server_interceptor.rb', line 46

def server_streamer(request: nil, call: nil, method: nil)
  log_request(method, call) { yield }
end