You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: daprdocs/content/en/operations/observability/metrics/metrics-overview.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,38 @@ spec:
70
70
enabled: false
71
71
```
72
72
73
+
## Configuring metrics for error codes
74
+
75
+
You can enable additional metrics for [Dapr API error codes](https://docs.dapr.io/reference/api/error_codes/) by setting `spec.metrics.recordErrorCodes` to `true`. Dapr APIs which communicate back to their caller may return standardized error codes. As described in the [Dapr development docs](https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics.md), a new metric called `error_code_total` is recorded, which allows monitoring of error codes triggered by application, code, and category. See [the `errorcodes` package](https://github.com/dapr/dapr/blob/master/pkg/messages/errorcodes/errorcodes.go) for specific codes and categories.
76
+
77
+
Example configuration:
78
+
```yaml
79
+
apiVersion: dapr.io/v1alpha1
80
+
kind: Configuration
81
+
metadata:
82
+
name: tracing
83
+
namespace: default
84
+
spec:
85
+
metrics:
86
+
enabled: true
87
+
recordErrorCodes: true
88
+
```
89
+
90
+
Example metric:
91
+
```json
92
+
{
93
+
"app_id": "publisher-app",
94
+
"category": "state",
95
+
"dapr_io_enabled": "true",
96
+
"error_code": "ERR_STATE_STORE_NOT_CONFIGURED",
97
+
"instance": "10.244.1.64:9090",
98
+
"job": "kubernetes-service-endpoints",
99
+
"namespace": "my-app",
100
+
"node": "my-node",
101
+
"service": "publisher-app-dapr"
102
+
}
103
+
```
104
+
73
105
## Optimizing HTTP metrics reporting with path matching
74
106
75
107
When invoking Dapr using HTTP, metrics are created for each requested method by default. This can result in a high number of metrics, known as high cardinality, which can impact memory usage and CPU.
For http calls made to Dapr runtime, when an error is encountered, an error json is returned in http response body. The json contains an error code and an descriptive error message, e.g.
10
+
10
11
```
11
12
{
12
13
"errorCode": "ERR_STATE_GET",
13
14
"message": "Requested state key does not exist in state store."
14
15
}
15
16
```
16
17
17
-
Following table lists the error codes returned by Dapr runtime:
0 commit comments