Skip to content

Commit

Permalink
Update readme to show usage of Request-Id middleware (#47)
Browse files Browse the repository at this point in the history
- Add help to show steps to include request-id middleware
  • Loading branch information
kumaya authored and Evgeniy-L committed May 31, 2018
1 parent 06ca289 commit e3ff318
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,36 @@ func (s *MyService) MyMethod(ctx context.Context, req *MyMethodRequest) (*MyMeth
}
```

##### Request-Id

We support cases where each request need to be assigned with its own request_id, so when the request goes from one service to another it can be easily traced in logs.

Request-Id interceptor will extract Request-Id from incoming metadata and update context with the same.

##### How can I add support for Request-Id to track my requests?

You can enable support of Request-Id middleware in your gRPC-Server by adding

```golang
import (
...
...
"github.com/infobloxopen/atlas-app-toolkit/requestid"
)
func main() {
server := grpc.NewServer(
grpc.UnaryInterceptor(
grpc_middleware.ChainUnaryServer( // middleware chain
...
requestid.UnaryServerInterceptor(), // Request-Id middleware
...
),
),
)
...
}
```

#### Validation
We recommend to use [this validation plugin](https://github.com/lyft/protoc-gen-validate) to generate
`Validate` method for your gRPC requests.
Expand Down

0 comments on commit e3ff318

Please sign in to comment.