You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dev.md
+22-11
Original file line number
Diff line number
Diff line change
@@ -21,36 +21,47 @@ The [k8s instrumentation logging guidelines](https://github.com/kubernetes/commu
21
21
*`klog.V(4).InfoS` - Debug level verbosity
22
22
*`klog.V(5).InfoS` - Trace level verbosity
23
23
24
+
We thus define the following constants to help choosing the level:
25
+
```
26
+
const(
27
+
REQUIRED=0
28
+
DEFAULT_MINIMAL=1
29
+
DEFAULT=2
30
+
VERBOSE=3
31
+
DEBUG=4
32
+
TRACE=5
33
+
)
34
+
```
24
35
25
36
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:
26
37
27
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.
28
-
*`klog.V(0).InfoS` = `klog.InfoS` Default, log things such as startup flags
39
+
*`klog.V(REQUIRED).InfoS` = `klog.InfoS` Default, log things such as startup flags
29
40
30
-
2. Reconciler loops. The reconciler loops watches 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.
41
+
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.
31
42
32
-
*`klog.V(1).InfoS`
43
+
*`klog.V(DEFAULT_MINIMAL).InfoS`
33
44
* Default log level in the reconcilers.
34
45
* Information about config (listening on X, watching Y)
35
46
* Errors that repeat frequently that relate to conditions that can be corrected (e.g., inference model not initialized yet)
36
-
*`klog.V(2).InfoS`
47
+
*`klog.V(DEFAULT).InfoS`
37
48
* System state changing (adding/removing objects in the data store)
38
-
*`V(3)` and above: Use your best judgement.
49
+
*`V(VERBOSE)` and above: Use your best judgement.
39
50
40
51
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.
41
52
42
-
*`klog.V(2).InfoS`
53
+
*`klog.V(DEFAULT).InfoS`
43
54
* Logging HTTP requests and their exit code
44
55
* Important decision making such as picking the target model, target pod
45
-
*`klog.V(3).InfoS`
56
+
*`klog.V(VERBOSE).InfoS`
46
57
* Detailed request scheduling algorithm operations, such as running the filtering logic
47
-
*`V(4)` and above: Use your best judgement.
58
+
*`V(DEBUG)` and above: Use your best judgement.
48
59
49
60
4. Metric scraping loops. These loops run at a very high frequency, and logs can be very spammy if not handled properly.
50
-
*`klog.V(4).InfoS`
61
+
*`klog.V(DEBUG).InfoS`
51
62
* Transient errors/warnings, such as failure to get response from a pod.
52
-
*`klog.V(5).InfoS` - Default
63
+
*`klog.V(TRACE).InfoS` - For other logs.
53
64
54
65
5. Misc
55
-
*`klog.V(3).InfoS`
66
+
*`klog.V(VERBOSE).InfoS`
56
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.
0 commit comments