diff --git a/contribute/backend/errors.md b/contribute/backend/errors.md index 674e3d84305..840e0c09829 100644 --- a/contribute/backend/errors.md +++ b/contribute/backend/errors.md @@ -105,6 +105,18 @@ unfortunately not readily available on pkg.go.dev because Grafana is not fully Go modules compatible, but can be viewed using [godoc](https://go.dev/cmd/godoc/) from the Grafana directory. +### Error source + +You can optionally specify an error source that describes from where an +error originates. By default it's _server_ and means the error originates +from within the application, e.g. Grafana. The `errutil.WithDownstream()` +option may be appended to the NewBase function call to denote an error +originates from a _downstream_ server/service. The error source information +is used in the API layer to distinguish between Grafana errors and +non-Grafana errors to include this information when instrumenting the +application and by that allowing Grafana operators to define SLO's +based on actual Grafana errors. + ### Handling errors in the API API handlers use the `github.com/grafana/grafana/pkg/api/response.Err`