Commit 681ce45 1 parent 0101924 commit 681ce45 Copy full SHA for 681ce45
File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -128,15 +128,21 @@ func (ti *TelemetryInterceptor) Intercept(
128
128
metricsHandler .Counter (metrics .ServiceRequests .GetMetricName ()).Record (1 )
129
129
130
130
startTime := time .Now ().UTC ()
131
+ userLatencyDuration := time .Duration (0 )
131
132
defer func () {
132
- metricsHandler .Timer (metrics .ServiceLatency .GetMetricName ()).Record (time .Since (startTime ))
133
- metricsHandler .Timer (metrics .ServiceLatencyNoUserLatency .GetMetricName ()).Record (time .Since (startTime ))
133
+ latency := time .Since (startTime )
134
+ metricsHandler .Timer (metrics .ServiceLatency .GetMetricName ()).Record (latency )
135
+ noUserLatency := latency - userLatencyDuration
136
+ if noUserLatency < 0 {
137
+ noUserLatency = 0
138
+ }
139
+ metricsHandler .Timer (metrics .ServiceLatencyNoUserLatency .GetMetricName ()).Record (noUserLatency )
134
140
}()
135
141
136
142
resp , err := handler (ctx , req )
137
143
138
144
if val , ok := metrics .ContextCounterGet (ctx , metrics .HistoryWorkflowExecutionCacheLatency .GetMetricName ()); ok {
139
- userLatencyDuration : = time .Duration (val )
145
+ userLatencyDuration = time .Duration (val )
140
146
startTime .Add (userLatencyDuration )
141
147
metricsHandler .Timer (metrics .ServiceLatencyUserLatency .GetMetricName ()).Record (userLatencyDuration )
142
148
}
You can’t perform that action at this time.
0 commit comments