@@ -17,10 +17,14 @@ func table(config Config) (t trace.Table) {
1717 wait := config .WithSystem ("pool" ).GaugeVec ("wait" )
1818 waitLatency := config .WithSystem ("pool" ).WithSystem ("wait" ).TimerVec ("latency" )
1919 alive := config .GaugeVec ("sessions" , "node_id" )
20- doAttempts := config .WithSystem ("do" ).HistogramVec ("attempts" , []float64 {0 , 1 , 2 , 5 , 10 })
21- doErrors := config .WithSystem ("do" ).WithSystem ("intermediate" ).CounterVec ("errors" , "status" )
22- doTxAttempts := config .WithSystem ("doTx" ).HistogramVec ("attempts" , []float64 {0 , 1 , 2 , 5 , 10 })
23- doTxErrors := config .WithSystem ("doTx" ).WithSystem ("intermediate" ).CounterVec ("errors" , "status" )
20+ doAttempts := config .WithSystem ("do" ).HistogramVec ("attempts" , []float64 {0 , 1 , 2 , 5 , 10 }, "name" )
21+ doErrors := config .WithSystem ("do" ).CounterVec ("errors" , "status" , "name" )
22+ doIntermediateErrors := config .WithSystem ("do" ).WithSystem ("intermediate" ).CounterVec ("errors" , "status" , "name" )
23+ doLatency := config .WithSystem ("do" ).TimerVec ("latency" , "status" , "name" )
24+ doTxAttempts := config .WithSystem ("doTx" ).HistogramVec ("attempts" , []float64 {0 , 1 , 2 , 5 , 10 }, "name" )
25+ doTxIntermediateErrors := config .WithSystem ("doTx" ).WithSystem ("intermediate" ).CounterVec ("errors" , "status" , "name" )
26+ doTxErrors := config .WithSystem ("doTx" ).CounterVec ("errors" , "status" , "name" )
27+ doTxLatency := config .WithSystem ("doTx" ).TimerVec ("latency" , "status" , "name" )
2428 t .OnInit = func (info trace.TableInitStartInfo ) func (trace.TableInitDoneInfo ) {
2529 return func (info trace.TableInitDoneInfo ) {
2630 limit .With (nil ).Set (float64 (info .Limit ))
@@ -31,15 +35,28 @@ func table(config Config) (t trace.Table) {
3135 ) func (
3236 trace.TableDoDoneInfo ,
3337 ) {
38+ var (
39+ name = info .ID
40+ start = time .Now ()
41+ )
3442 return func (info trace.TableDoIntermediateInfo ) func (trace.TableDoDoneInfo ) {
3543 if info .Error != nil && config .Details ()& trace .TableEvents != 0 {
36- doErrors .With (map [string ]string {
44+ doIntermediateErrors .With (map [string ]string {
3745 "status" : errorBrief (info .Error ),
46+ "name" : name ,
3847 }).Inc ()
3948 }
4049 return func (info trace.TableDoDoneInfo ) {
4150 if config .Details ()& trace .TableEvents != 0 {
4251 doAttempts .With (nil ).Record (float64 (info .Attempts ))
52+ doErrors .With (map [string ]string {
53+ "status" : errorBrief (info .Error ),
54+ "name" : name ,
55+ }).Inc ()
56+ doLatency .With (map [string ]string {
57+ "status" : errorBrief (info .Error ),
58+ "name" : name ,
59+ }).Record (time .Since (start ))
4360 }
4461 }
4562 }
@@ -49,15 +66,28 @@ func table(config Config) (t trace.Table) {
4966 ) func (
5067 trace.TableDoTxDoneInfo ,
5168 ) {
69+ var (
70+ name = info .ID
71+ start = time .Now ()
72+ )
5273 return func (info trace.TableDoTxIntermediateInfo ) func (trace.TableDoTxDoneInfo ) {
5374 if info .Error != nil && config .Details ()& trace .TableEvents != 0 {
54- doTxErrors .With (map [string ]string {
75+ doTxIntermediateErrors .With (map [string ]string {
5576 "status" : errorBrief (info .Error ),
77+ "name" : name ,
5678 }).Inc ()
5779 }
5880 return func (info trace.TableDoTxDoneInfo ) {
5981 if config .Details ()& trace .TableEvents != 0 {
6082 doTxAttempts .With (nil ).Record (float64 (info .Attempts ))
83+ doTxErrors .With (map [string ]string {
84+ "status" : errorBrief (info .Error ),
85+ "name" : name ,
86+ }).Inc ()
87+ doTxLatency .With (map [string ]string {
88+ "status" : errorBrief (info .Error ),
89+ "name" : name ,
90+ }).Record (time .Since (start ))
6191 }
6292 }
6393 }
0 commit comments