Skip to content

Commit c0f4727

Browse files
committed
Address comments, simply to 3 levels
1 parent f53ac17 commit c0f4727

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

docs/dev.md

+10-12
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,33 @@ The [k8s instrumentation logging guidelines](https://github.com/kubernetes/commu
2121
* `klog.V(4).InfoS` - Debug level verbosity
2222
* `klog.V(5).InfoS` - Trace level verbosity
2323

24-
We thus define the following constants to help choosing the level:
24+
We choose to simplify to the following 3 common levels.
2525
```
2626
const(
27-
REQUIRED=0
28-
DEFAULT_MINIMAL=1
2927
DEFAULT=2
3028
VERBOSE=3
3129
DEBUG=4
32-
TRACE=5
3330
)
3431
```
3532

3633
The guidelines are written in the context of a k8s controller. Our [ext-proc](../pkg/ext-proc/) does more things such as handling requests and scraping metrics, therefore we adapt the guidelines as follows:
3734

38-
1. The server startup process. Logging at the default verbosity level is generally welcome here as this is only logged once at startup, and provides useful info for debugging.
39-
* `klog.V(REQUIRED).InfoS` = `klog.InfoS` Default, log things such as startup flags
35+
1. The server startup process and configuration.
36+
* `klog.InfoS` Logging at the `V(0)` verbosity level is generally welcome here as this is only logged once at startup, and provides useful info for debugging.
4037

4138
2. Reconciler loops. The reconciler loops watch for CR changes such as the `InferenceModel` CR. And given changes in these CRs significantly affect the behavior of the extension, we recommend using v=1 verbosity level as default, and sparsely use higher verbosity levels.
4239

43-
* `klog.V(DEFAULT_MINIMAL).InfoS`
40+
* `klog.V(DEFAULT).InfoS`
4441
* Default log level in the reconcilers.
4542
* Information about config (listening on X, watching Y)
4643
* Errors that repeat frequently that relate to conditions that can be corrected (e.g., inference model not initialized yet)
47-
* `klog.V(DEFAULT).InfoS`
4844
* System state changing (adding/removing objects in the data store)
4945
* `V(VERBOSE)` and above: Use your best judgement.
5046

5147
3. Inference request handling. These requests are expected to be much higher volume than the control flow in the reconcilers and therefore we should be mindful of log spamming. We recommend using v=2 to log important info about a request, such as the HTTP response code, and higher verbosity levels for less important info.
5248

5349
* `klog.V(DEFAULT).InfoS`
54-
* Logging HTTP requests and their exit code
50+
* Logging the status code of an HTTP request
5551
* Important decision making such as picking the target model, target pod
5652
* `klog.V(VERBOSE).InfoS`
5753
* Detailed request scheduling algorithm operations, such as running the filtering logic
@@ -60,8 +56,10 @@ The guidelines are written in the context of a k8s controller. Our [ext-proc](..
6056
4. Metric scraping loops. These loops run at a very high frequency, and logs can be very spammy if not handled properly.
6157
* `klog.V(DEBUG).InfoS`
6258
* Transient errors/warnings, such as failure to get response from a pod.
63-
* `klog.V(TRACE).InfoS` - For other logs.
59+
* Important state changes, such as updating a metric.
6460

6561
5. Misc
66-
* `klog.V(VERBOSE).InfoS`
67-
* A periodically (every 5s) printed debug message with the current pods and metrics. This is very important to debug the request scheduling algorithm, and yet not spammy compared to the metric scraping loop logs.
62+
1. Periodic (every 5s) debug loop which prints the current pods and metrics.
63+
* `klog.WarningS` If the metrics are not fresh enough, which indicates an error occurred during the metric scraping loop.
64+
* `klog.V(VERBOSE).InfoS`
65+
* This is very important to debug the request scheduling algorithm, and yet not spammy compared to the metric scraping loop logs.

0 commit comments

Comments
 (0)