mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: added server too busy stats (#717)
This commit is contained in:
@@ -227,7 +227,7 @@ func transformTimeout(e error, isRetriable bool) error {
|
|||||||
func (a *agent) handleStatsDequeue(ctx context.Context, call *call, err error) {
|
func (a *agent) handleStatsDequeue(ctx context.Context, call *call, err error) {
|
||||||
if err == context.DeadlineExceeded {
|
if err == context.DeadlineExceeded {
|
||||||
a.stats.Dequeue(ctx, call.AppName, call.Path)
|
a.stats.Dequeue(ctx, call.AppName, call.Path)
|
||||||
// note that this is not a timeout from the perspective of the caller, so don't increment the timeout count
|
a.stats.IncrementTooBusy(ctx)
|
||||||
} else {
|
} else {
|
||||||
a.stats.DequeueAndFail(ctx, call.AppName, call.Path)
|
a.stats.DequeueAndFail(ctx, call.AppName, call.Path)
|
||||||
a.stats.IncrementErrors(ctx)
|
a.stats.IncrementErrors(ctx)
|
||||||
|
|||||||
@@ -149,6 +149,10 @@ func (s *stats) IncrementErrors(ctx context.Context) {
|
|||||||
common.IncrementCounter(ctx, errorsMetricName)
|
common.IncrementCounter(ctx, errorsMetricName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *stats) IncrementTooBusy(ctx context.Context) {
|
||||||
|
common.IncrementCounter(ctx, serverBusyMetricName)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *stats) Stats() Stats {
|
func (s *stats) Stats() Stats {
|
||||||
var stats Stats
|
var stats Stats
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
@@ -166,11 +170,12 @@ func (s *stats) Stats() Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
queuedMetricName = "queued"
|
queuedMetricName = "queued"
|
||||||
callsMetricName = "calls"
|
callsMetricName = "calls"
|
||||||
runningMetricName = "running"
|
runningMetricName = "running"
|
||||||
completedMetricName = "completed"
|
completedMetricName = "completed"
|
||||||
failedMetricName = "failed"
|
failedMetricName = "failed"
|
||||||
timedoutMetricName = "timeouts"
|
timedoutMetricName = "timeouts"
|
||||||
errorsMetricName = "errors"
|
errorsMetricName = "errors"
|
||||||
|
serverBusyMetricName = "server_busy"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"type": "grafana",
|
"type": "grafana",
|
||||||
"id": "grafana",
|
"id": "grafana",
|
||||||
"name": "Grafana",
|
"name": "Grafana",
|
||||||
"version": "4.6.2"
|
"version": "4.6.3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
@@ -309,7 +309,7 @@
|
|||||||
"thresholdLabels": false,
|
"thresholdLabels": false,
|
||||||
"thresholdMarkers": true
|
"thresholdMarkers": true
|
||||||
},
|
},
|
||||||
"id": 13,
|
"id": 14,
|
||||||
"interval": null,
|
"interval": null,
|
||||||
"links": [],
|
"links": [],
|
||||||
"mappingType": 1,
|
"mappingType": 1,
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
"nullText": null,
|
"nullText": null,
|
||||||
"postfix": "",
|
"postfix": "",
|
||||||
"postfixFontSize": "50%",
|
"postfixFontSize": "50%",
|
||||||
"prefix": "Failed:",
|
"prefix": "Incomplete:",
|
||||||
"prefixFontSize": "50%",
|
"prefixFontSize": "50%",
|
||||||
"rangeMaps": [
|
"rangeMaps": [
|
||||||
{
|
{
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
"tableColumn": "",
|
"tableColumn": "",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "sum(fn_failed)",
|
"expr": "sum(fn_failed) + sum(fn_timeouts) + sum(fn_server_busy)",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"intervalFactor": 2,
|
"intervalFactor": 2,
|
||||||
"legendFormat": "",
|
"legendFormat": "",
|
||||||
@@ -650,12 +650,26 @@
|
|||||||
"legendFormat": "Total failed",
|
"legendFormat": "Total failed",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"step": 2
|
"step": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "sum(fn_timeouts)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "Total timeouts",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "sum(fn_server_busy)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "Total server too busy",
|
||||||
|
"refId": "C"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"thresholds": [],
|
"thresholds": [],
|
||||||
"timeFrom": null,
|
"timeFrom": null,
|
||||||
"timeShift": null,
|
"timeShift": null,
|
||||||
"title": "Total failed",
|
"title": "Total incomplete",
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"shared": true,
|
"shared": true,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
@@ -989,15 +1003,29 @@
|
|||||||
"expr": "fn_failed",
|
"expr": "fn_failed",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"intervalFactor": 2,
|
"intervalFactor": 2,
|
||||||
"legendFormat": "{{fn_appname}} {{fn_path}}",
|
"legendFormat": "{{fn_appname}} {{fn_path}} failed",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"step": 2
|
"step": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "fn_timeouts",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{fn_appname}} {{fn_path}} timeouts",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "fn_server_busy",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{fn_appname}} {{fn_path}} server busy",
|
||||||
|
"refId": "C"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"thresholds": [],
|
"thresholds": [],
|
||||||
"timeFrom": null,
|
"timeFrom": null,
|
||||||
"timeShift": null,
|
"timeShift": null,
|
||||||
"title": "Failed",
|
"title": "Incomplete",
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"shared": true,
|
"shared": true,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
@@ -1076,5 +1104,5 @@
|
|||||||
},
|
},
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"title": "Fn usage",
|
"title": "Fn usage",
|
||||||
"version": 5
|
"version": 1
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user