Skip to content

Fault Injection: Support gRPC status code in abort fault #10323

@vijayrajput1

Description

@vijayrajput1

Description:

Currently, the Envoy fault injection filter supports the ability to inject an ‘abort’ fault into a response stream. These faults can be configured with an HTTP status code that will be returned to the client when the request is failed.

For gRPC services, the status of the request is returned to the caller in a combination of both an HTTP status code and a gRPC status code, both of which are carried in HTTP/2 headers (or trailers). Envoy’s fault injection filter doesn’t currently support a way of specifying the gRPC status code to return in case of failure, instead, it implicitly maps the HTTP status code to gRPC status code based on this. In order to simulate specific gRPC failure modes, we need to add support for configuring gRPC status code in abort fault similar to the HTTP status code.

Implementation details

A new ‘grpc_status’ field will be added to the envoy fault injection filter configuration. When this field is set and the conditions for fault injection are met, Envoy will fail the gRPC call. The upstream service will not be invoked and a ‘Trailers-Only’ gRPC response will be sent to the client. The gRPC status code in this response will be set to the configured value.

The utility function which is being used to send the fault response, already has the functionality to use a specific gRPC status code instead of deriving it based on an HTTP status code, but it is currently being passed null for the gRPC status code.

Changes required to achieve this functionality will be:

  • Introduce a new field “grpc_status” (uint32) in envoy’s fault filter configuration inside FaultAbort here
  • Read the new field and pass it to the utility function via this when set.
  • Add new unit test(s) for gRPC code here
  • Documentation update here and here

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions