-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds custom durationFieldFunc to request/response log entries (#670)
the request and response log messages include a duration string, but does not make use of the `durationFieldFunc` like other parts of the request lifecycle. The `durationFieldFunc` function is useful when conducting log analysis with log aggregator tools out there, because it normalizes the value to a number that can be filtered by or compared to. For example, a GCP Log Explorer does not support converting log field types like a duration to an integer, so you cannot run queries like "give me all logs that took more than 50ms" because it would be interpreted as a string comparison. This makes very tedious to audit application logs that log API calls using this gRPC middleware. The perhaps controversial part of this change is that request/response logs have a different naming convention for the duration. I personally don't find use for a different field name - grpc.time and grpc.time_ms would seem expressive enough to support the 4 logged entries, but maybe I'm missing something here. I would suggest to rename those fields as well, but I understand that may be a "breaking change", if we consider the log fields a contract.
- Loading branch information
1 parent
9a90441
commit 3ade00c
Showing
2 changed files
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters