Provide a way to log successful and failed requests#719
Provide a way to log successful and failed requests#719
Conversation
Motivation:
TBU
Modifications:
TBU
Result:
Logging configuration example:
```json
{
"targetGroups": [ "API", "HEALTH" ],
"loggerName": "centraldogma.test",
"requestLogLevel": "DEBUG",
"successfulResponseLevel": "DEBUG",
"failureResponseLevel": "ERROR",
"successSamplingRate": 0.4,
"failureSamplingRate": 0.6
}
```
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #719 +/- ##
============================================
+ Coverage 70.31% 70.40% +0.08%
- Complexity 3418 3444 +26
============================================
Files 349 351 +2
Lines 13470 13565 +95
Branches 1454 1466 +12
============================================
+ Hits 9472 9550 +78
- Misses 3139 3153 +14
- Partials 859 862 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| logHealthCheck = true; | ||
| logMetrics = true; | ||
| } else { | ||
| for (RequestLogGroup logGroup : requestLogGroups) { |
There was a problem hiding this comment.
Question: Is it possible that users may want to configure different logging parameters for different paths?
e.g.
- METRIC: debug
- API: info
- ...
There was a problem hiding this comment.
Oh... It is so nice! 👍
There was a problem hiding this comment.
We can implement it by adding different LoggingServices.
minwoox
left a comment
There was a problem hiding this comment.
Thanks! Left some suggestions. 😄
|
|
||
| private final Set<RequestLogGroup> targetGroups; | ||
|
|
||
| private final LogLevel requestLogLevel; |
There was a problem hiding this comment.
Shouldn't we allow to set different settings per RequestLogGroup?
| logHealthCheck = true; | ||
| logMetrics = true; | ||
| } else { | ||
| for (RequestLogGroup logGroup : requestLogGroups) { |
There was a problem hiding this comment.
How about also supporting the specified path? e.g. /api/v1
|
Motivation:
To diagnose an exception error on the client-side, request logs are important to check request parameters, response duration and application errors.
Modifications:
RequestLogConfigwhich can limit the sampling rate, adjust target groups, and set the logging levels.TransientServiceOption.WITH_SERVICE_LOGGINGis specified toHealthCheckServiceorPrometheusExpositionServiceif
METRICSorHEALTHgroup is defined inRequestLogConfigResult:
{ "targetGroups": [ "API", "HEALTH" ], "loggerName": "centraldogma.test", "requestLogLevel": "DEBUG", "successfulResponseLevel": "DEBUG", "failureResponseLevel": "ERROR", "successSamplingRate": 0.4, "failureSamplingRate": 0.6 }LoggingServicein Central Dogma server #718