Instrumentation Control
Kitex supports flexible enabling of basic and fine-grained Instrumentation.
Stats Level:
- LevelDisabled, disable all events
- LevelBase, enable basic events
- LevelDetailed, enable basic events and detailed events.
Stats Level
Default Stats Level:
- No tracer is available, LevelDisabled by default
- At least one tracer is available, LevelDetailed by default
Client tracing stats level control:
import "github.com/cloudwego/kitex/client"
import "github.com/cloudwego/kitex/pkg/stats"
...
baseStats := client.WithStatsLevel(stats.LevelBase)
client, err := echo.NewClient("echo", baseStats)
if err != nil {
log.Fatal(err)
}
Server tracing stats level control:
import "github.com/cloudwego/kitex/server"
import "github.com/cloudwego/kitex/pkg/stats"
...
baseStats := server.WithStatsLevel(stats.LevelBase)
svr, err := echo.NewServer(baseStats)
if err := svr.Run(); err != nil {
log.Println("server stopped with error:", err)
} else {
log.Println("server stopped")
}
Stats introduction
Basic Stats Event:
- RPCStart,(client/server)RPC call start
- RPCFinish,(client)RPC call finish
Detailed Stats Event(client):
- ClientConnStart, connection establishment start
- ClientConnFinish,connection establishment finish
- WriteStart, request send (serialization including) start
- WriteFinish, request send (serialization including) finish
- ReadStart, response receive (deserialization including) start
- WaitReadStart, response stream read start (
Fast Codec
only) - WaitReadFinish, response stream read finish (
Fast Codec
only) - ReadFinish, response receive (deserialization including) finish
Detailed Stats Event(server):
- ReadStart, request receive (deserialization including) start
- WaitReadStart, request stream read start (
Fast Codec
only) - WaitReadFinish, request stream read finish (
Fast Codec
only) - ReadFinish, request receive (deserialization including) start
- ServerHandleStart, handler process start
- ServerHandleFinish, handler process finish
- WriteStart, response send (serialization including) start
- WriteFinish, response send (serialization including) start
Timeline:
client stats events timeline:
server stats events timeline:
Last modified
April 4, 2023
: optimzie: custom_tpl docs (#597) (b3e25f4)