@@ -75,13 +75,13 @@ public void init(boolean collectJvmMetrics, String applicationVersion, double...
75
75
76
76
requestSeconds = Histogram .build ().name (REQUESTS_SECONDS_METRIC_NAME )
77
77
.help ("records in a histogram the number of http requests and their duration in seconds" )
78
- .labelNames ("type" , "status" , "method" , "addr" , "isError" )
78
+ .labelNames ("type" , "status" , "method" , "addr" , "isError" , "errorMessage" )
79
79
.buckets (buckets )
80
80
.register (collectorRegistry );
81
81
82
82
responseSize = Counter .build ().name (RESPONSE_SIZE_METRIC_NAME )
83
83
.help ("counts the size of each http response" )
84
- .labelNames ("type" , "status" , "method" , "addr" , "isError" )
84
+ .labelNames ("type" , "status" , "method" , "addr" , "isError" , "errorMessage" )
85
85
.register (collectorRegistry );
86
86
87
87
dependencyRequestSeconds = Histogram .build ().name (DEPENDENCY_REQUESTS_SECONDS_METRIC_NAME )
@@ -117,11 +117,12 @@ public void init(boolean collectJvmMetrics, String applicationVersion, double...
117
117
* @param method the request method(e.g. HTTP methods GET, POST, PUT)
118
118
* @param addr the requested endpoint address
119
119
* @param isError if the status code reported is an error or not
120
+ * @param errorMessage the error message from a request with error
120
121
* @param elapsedSeconds how long time did the request has executed
121
122
*/
122
- public void collectTime (String type , String status , String method , String addr , boolean isError , double elapsedSeconds ) {
123
+ public void collectTime (String type , String status , String method , String addr , boolean isError , String errorMessage , double elapsedSeconds ) {
123
124
if (initialized ) {
124
- requestSeconds .labels (type , status , method , addr , Boolean .toString (isError ))
125
+ requestSeconds .labels (type , status , method , addr , Boolean .toString (isError ), errorMessage )
125
126
.observe (elapsedSeconds );
126
127
}
127
128
}
@@ -134,11 +135,13 @@ public void collectTime(String type, String status, String method, String addr,
134
135
* @param method the request method(e.g. HTTP methods GET, POST, PUT)
135
136
* @param addr the requested endpoint address
136
137
* @param isError if the status code reported is an error or not
138
+ * @param errorMessage the error message from a request with error
137
139
* @param size the response content size
138
140
*/
139
- public void collectSize (String type , String status , String method , String addr , boolean isError , final long size ) {
141
+ public void collectSize (String type , String status , String method , String addr , boolean isError , String errorMessage , final long size ) {
140
142
if (initialized ) {
141
- MonitorMetrics .INSTANCE .responseSize .labels (type , status , method , addr , Boolean .toString (isError )).inc (size );
143
+ MonitorMetrics .INSTANCE .responseSize .labels (type , status , method , addr , Boolean .toString (isError ), errorMessage )
144
+ .inc (size );
142
145
}
143
146
}
144
147
0 commit comments