-
Notifications
You must be signed in to change notification settings - Fork 456
/
errors.go
602 lines (497 loc) · 20 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
// SPDX-License-Identifier: AGPL-3.0-only
// Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/pkg/ingester/errors.go
// Provenance-includes-license: Apache-2.0
// Provenance-includes-copyright: The Cortex Authors.
package ingester
import (
"errors"
"fmt"
"net/http"
"time"
"github.com/grafana/dskit/grpcutil"
"github.com/grafana/dskit/httpgrpc"
"github.com/grafana/dskit/middleware"
"github.com/grafana/dskit/services"
"github.com/prometheus/common/model"
"google.golang.org/grpc/codes"
"github.com/grafana/mimir/pkg/mimirpb"
"github.com/grafana/mimir/pkg/util/globalerror"
"github.com/grafana/mimir/pkg/util/log"
"github.com/grafana/mimir/pkg/util/validation"
)
const (
integerUnavailableMsgFormat = "ingester is unavailable (current state: %s)"
ingesterTooBusyMsg = "ingester is currently too busy to process queries, try again later"
ingesterPushGrpcDisabledMsg = "ingester is configured with Push gRPC method disabled"
)
var (
errTooBusy = ingesterTooBusyError{}
errPushGrpcDisabled = newErrorWithStatus(ingesterPushGrpcDisabledError{}, codes.Unimplemented)
)
// newErrorWithStatus creates a new ErrorWithStatus backed by the given error,
// and containing the given gRPC code. If the given error is an ingesterError,
// the resulting ErrorWithStatus will be enriched by the details backed by
// ingesterError.errorCause. These details are of type mimirpb.ErrorDetails.
func newErrorWithStatus(originalErr error, code codes.Code) globalerror.ErrorWithStatus {
var (
ingesterErr ingesterError
errorDetails *mimirpb.ErrorDetails
)
if errors.As(originalErr, &ingesterErr) {
errorDetails = &mimirpb.ErrorDetails{Cause: ingesterErr.errorCause()}
}
return globalerror.WrapErrorWithGRPCStatus(originalErr, code, errorDetails)
}
// newErrorWithHTTPStatus creates a new ErrorWithStatus backed by the given error,
// and containing the given HTTP status code.
func newErrorWithHTTPStatus(err error, code int) globalerror.ErrorWithStatus {
errWithHTTPStatus := httpgrpc.Errorf(code, err.Error())
stat, _ := grpcutil.ErrorToStatus(errWithHTTPStatus)
return globalerror.ErrorWithStatus{
UnderlyingErr: err,
Status: stat,
}
}
// ingesterError is a marker interface for the errors returned by ingester, and that are safe to wrap.
type ingesterError interface {
errorCause() mimirpb.ErrorCause
}
// softError is a marker interface for the errors on which ingester.Push should not stop immediately.
type softError interface {
error
soft()
}
type softErrorFunction func() softError
// wrapOrAnnotateWithUser prepends the given userID to the given error.
// If the given error matches one of the errors from this package, the
// returned error retains a reference to the former.
func wrapOrAnnotateWithUser(err error, userID string) error {
// If err is an ingesterError, we wrap it with userID and return it.
var ingesterErr ingesterError
if errors.As(err, &ingesterErr) {
return fmt.Errorf("user=%s: %w", userID, err)
}
// Otherwise, we just annotate it with userID and return it.
return fmt.Errorf("user=%s: %s", userID, err)
}
// sampleError is an ingesterError indicating a problem with a sample.
type sampleError struct {
errID globalerror.ID
errMsg string
timestamp model.Time
series string
}
func (e sampleError) Error() string {
return fmt.Sprintf(
"%s. The affected sample has timestamp %s and is from series %s",
e.errID.Message(e.errMsg),
e.timestamp.Time().UTC().Format(time.RFC3339Nano),
e.series,
)
}
func (e sampleError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e sampleError) soft() {}
// Ensure that sampleError is an ingesterError.
var _ ingesterError = sampleError{}
// Ensure that sampleError is a softError.
var _ softError = sampleError{}
func newSampleError(errID globalerror.ID, errMsg string, timestamp model.Time, labels []mimirpb.LabelAdapter) sampleError {
return sampleError{
errID: errID,
errMsg: errMsg,
timestamp: timestamp,
series: mimirpb.FromLabelAdaptersToString(labels),
}
}
func newSampleTimestampTooOldError(timestamp model.Time, labels []mimirpb.LabelAdapter) sampleError {
return newSampleError(globalerror.SampleTimestampTooOld, "the sample has been rejected because its timestamp is too old", timestamp, labels)
}
func newSampleTimestampTooOldOOOEnabledError(timestamp model.Time, labels []mimirpb.LabelAdapter, oooTimeWindow time.Duration) sampleError {
return newSampleError(globalerror.SampleTimestampTooOld, fmt.Sprintf("the sample has been rejected because another sample with a more recent timestamp has already been ingested and this sample is beyond the out-of-order time window of %s", model.Duration(oooTimeWindow).String()), timestamp, labels)
}
func newSampleTimestampTooFarInFutureError(timestamp model.Time, labels []mimirpb.LabelAdapter) sampleError {
return newSampleError(globalerror.SampleTooFarInFuture, "received a sample whose timestamp is too far in the future", timestamp, labels)
}
func newSampleOutOfOrderError(timestamp model.Time, labels []mimirpb.LabelAdapter) sampleError {
return newSampleError(globalerror.SampleOutOfOrder, "the sample has been rejected because another sample with a more recent timestamp has already been ingested and out-of-order samples are not allowed", timestamp, labels)
}
func newSampleDuplicateTimestampError(timestamp model.Time, labels []mimirpb.LabelAdapter) sampleError {
return newSampleError(globalerror.SampleDuplicateTimestamp, "the sample has been rejected because another sample with the same timestamp, but a different value, has already been ingested", timestamp, labels)
}
// exemplarError is an ingesterError indicating a problem with an exemplar.
type exemplarError struct {
errID globalerror.ID
errMsg string
timestamp model.Time
seriesLabels string
exemplarLabels string
}
func (e exemplarError) Error() string {
return fmt.Sprintf(
"%s. The affected exemplar is %s with timestamp %s for series %s",
e.errID.Message(e.errMsg),
e.exemplarLabels,
e.timestamp.Time().UTC().Format(time.RFC3339Nano),
e.seriesLabels,
)
}
func (e exemplarError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e exemplarError) soft() {}
// Ensure that exemplarError is an ingesterError.
var _ ingesterError = exemplarError{}
// Ensure that exemplarError is an softError.
var _ softError = exemplarError{}
func newExemplarError(errID globalerror.ID, errMsg string, timestamp model.Time, seriesLabels, exemplarLabels []mimirpb.LabelAdapter) exemplarError {
return exemplarError{
errID: errID,
errMsg: errMsg,
timestamp: timestamp,
seriesLabels: mimirpb.FromLabelAdaptersToString(seriesLabels),
exemplarLabels: mimirpb.FromLabelAdaptersToString(exemplarLabels),
}
}
func newExemplarMissingSeriesError(timestamp model.Time, seriesLabels, exemplarLabels []mimirpb.LabelAdapter) exemplarError {
return newExemplarError(globalerror.ExemplarSeriesMissing, "the exemplar has been rejected because the related series has not been ingested yet", timestamp, seriesLabels, exemplarLabels)
}
func newExemplarTimestampTooFarInFutureError(timestamp model.Time, seriesLabels, exemplarLabels []mimirpb.LabelAdapter) exemplarError {
return newExemplarError(globalerror.ExemplarTooFarInFuture, "received an exemplar whose timestamp is too far in the future", timestamp, seriesLabels, exemplarLabels)
}
// tsdbIngestExemplarErr is an ingesterError indicating a problem with an exemplar.
type tsdbIngestExemplarErr struct {
originalErr error
timestamp model.Time
seriesLabels string
exemplarLabels string
}
func (e tsdbIngestExemplarErr) Error() string {
return fmt.Sprintf("err: %v. timestamp=%s, series=%s, exemplar=%s",
e.originalErr,
e.timestamp.Time().UTC().Format(time.RFC3339Nano),
e.seriesLabels,
e.exemplarLabels,
)
}
func (e tsdbIngestExemplarErr) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e tsdbIngestExemplarErr) soft() {}
// Ensure that tsdbIngestExemplarErr is an ingesterError.
var _ ingesterError = tsdbIngestExemplarErr{}
// Ensure that tsdbIngestExemplarErr is an softError.
var _ softError = tsdbIngestExemplarErr{}
func newTSDBIngestExemplarErr(ingestErr error, timestamp model.Time, seriesLabels, exemplarLabels []mimirpb.LabelAdapter) tsdbIngestExemplarErr {
return tsdbIngestExemplarErr{
originalErr: ingestErr,
timestamp: timestamp,
seriesLabels: mimirpb.FromLabelAdaptersToString(seriesLabels),
exemplarLabels: mimirpb.FromLabelAdaptersToString(exemplarLabels),
}
}
// perUserSeriesLimitReachedError is an ingesterError indicating that a per-user series limit has been reached.
type perUserSeriesLimitReachedError struct {
limit int
}
// newPerUserSeriesLimitReachedError creates a new perUserMetadataLimitReachedError indicating that a per-user series limit has been reached.
func newPerUserSeriesLimitReachedError(limit int) perUserSeriesLimitReachedError {
return perUserSeriesLimitReachedError{
limit: limit,
}
}
func (e perUserSeriesLimitReachedError) Error() string {
return globalerror.MaxSeriesPerUser.MessageWithPerTenantLimitConfig(
fmt.Sprintf("per-user series limit of %d exceeded", e.limit),
validation.MaxSeriesPerUserFlag,
)
}
func (e perUserSeriesLimitReachedError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e perUserSeriesLimitReachedError) soft() {}
// Ensure that perUserSeriesLimitReachedError is an ingesterError.
var _ ingesterError = perUserSeriesLimitReachedError{}
// Ensure that perUserSeriesLimitReachedError is an softError.
var _ softError = perUserSeriesLimitReachedError{}
// perUserMetadataLimitReachedError is an ingesterError indicating that a per-user metadata limit has been reached.
type perUserMetadataLimitReachedError struct {
limit int
}
// newPerUserMetadataLimitReachedError creates a new perUserMetadataLimitReachedError indicating that a per-user metadata limit has been reached.
func newPerUserMetadataLimitReachedError(limit int) perUserMetadataLimitReachedError {
return perUserMetadataLimitReachedError{
limit: limit,
}
}
func (e perUserMetadataLimitReachedError) Error() string {
return globalerror.MaxMetadataPerUser.MessageWithPerTenantLimitConfig(
fmt.Sprintf("per-user metric metadata limit of %d exceeded", e.limit),
validation.MaxMetadataPerUserFlag,
)
}
func (e perUserMetadataLimitReachedError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e perUserMetadataLimitReachedError) soft() {}
// Ensure that perUserMetadataLimitReachedError is an ingesterError.
var _ ingesterError = perUserMetadataLimitReachedError{}
// Ensure that perUserMetadataLimitReachedError is an softError.
var _ softError = perUserMetadataLimitReachedError{}
// perMetricSeriesLimitReachedError is an ingesterError indicating that a per-metric series limit has been reached.
type perMetricSeriesLimitReachedError struct {
limit int
series string
}
// newPerMetricSeriesLimitReachedError creates a new perMetricMetadataLimitReachedError indicating that a per-metric series limit has been reached.
func newPerMetricSeriesLimitReachedError(limit int, labels []mimirpb.LabelAdapter) perMetricSeriesLimitReachedError {
return perMetricSeriesLimitReachedError{
limit: limit,
series: mimirpb.FromLabelAdaptersToString(labels),
}
}
func (e perMetricSeriesLimitReachedError) Error() string {
return fmt.Sprintf("%s This is for series %s",
globalerror.MaxSeriesPerMetric.MessageWithPerTenantLimitConfig(
fmt.Sprintf("per-metric series limit of %d exceeded", e.limit),
validation.MaxSeriesPerMetricFlag,
),
e.series,
)
}
func (e perMetricSeriesLimitReachedError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e perMetricSeriesLimitReachedError) soft() {}
// Ensure that perMetricSeriesLimitReachedError is an ingesterError.
var _ ingesterError = perMetricSeriesLimitReachedError{}
// Ensure that perMetricSeriesLimitReachedError is an softError.
var _ softError = perMetricSeriesLimitReachedError{}
// perMetricMetadataLimitReachedError is an ingesterError indicating that a per-metric metadata limit has been reached.
type perMetricMetadataLimitReachedError struct {
limit int
family string
}
// newPerMetricMetadataLimitReachedError creates a new perMetricMetadataLimitReachedError indicating that a per-metric metadata limit has been reached.
func newPerMetricMetadataLimitReachedError(limit int, family string) perMetricMetadataLimitReachedError {
return perMetricMetadataLimitReachedError{
limit: limit,
family: family,
}
}
func (e perMetricMetadataLimitReachedError) Error() string {
return fmt.Sprintf("%s This is for metric %s",
globalerror.MaxMetadataPerMetric.MessageWithPerTenantLimitConfig(
fmt.Sprintf("per-metric metadata limit of %d exceeded", e.limit),
validation.MaxMetadataPerMetricFlag,
),
e.family,
)
}
func (e perMetricMetadataLimitReachedError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e perMetricMetadataLimitReachedError) soft() {}
// Ensure that perMetricMetadataLimitReachedError is an ingesterError.
var _ ingesterError = perMetricMetadataLimitReachedError{}
// Ensure that perMetricMetadataLimitReachedError is an softError.
var _ softError = perMetricMetadataLimitReachedError{}
// nativeHistogramValidationError indicates that native histogram bucket counts did not add up to the overall count.
type nativeHistogramValidationError struct {
id globalerror.ID
originalErr error
seriesLabels []mimirpb.LabelAdapter
timestamp model.Time
}
func newNativeHistogramValidationError(id globalerror.ID, originalErr error, timestamp model.Time, seriesLabels []mimirpb.LabelAdapter) nativeHistogramValidationError {
return nativeHistogramValidationError{
id: id,
originalErr: originalErr,
seriesLabels: seriesLabels,
timestamp: timestamp,
}
}
func (e nativeHistogramValidationError) Error() string {
return e.id.Message(fmt.Sprintf("err: %v. timestamp=%s, series=%s",
e.originalErr,
e.timestamp.Time().UTC().Format(time.RFC3339Nano),
e.seriesLabels,
))
}
func (e nativeHistogramValidationError) errorCause() mimirpb.ErrorCause {
return mimirpb.BAD_DATA
}
func (e nativeHistogramValidationError) soft() {}
// Ensure that histogramBucketCountMismatchError is an ingesterError.
var _ ingesterError = nativeHistogramValidationError{}
// Ensure that histogramBucketCountMismatchError is an softError.
var _ softError = nativeHistogramValidationError{}
// unavailableError is an ingesterError indicating that the ingester is unavailable.
type unavailableError struct {
state services.State
}
func (e unavailableError) Error() string {
return fmt.Sprintf(integerUnavailableMsgFormat, e.state.String())
}
func (e unavailableError) errorCause() mimirpb.ErrorCause {
return mimirpb.SERVICE_UNAVAILABLE
}
// Ensure that unavailableError is an ingesterError.
var _ ingesterError = unavailableError{}
func newUnavailableError(state services.State) unavailableError {
return unavailableError{state: state}
}
type instanceLimitReachedError struct {
message string
}
func newInstanceLimitReachedError(message string) instanceLimitReachedError {
return instanceLimitReachedError{message: message}
}
func (e instanceLimitReachedError) Error() string {
return e.message
}
func (e instanceLimitReachedError) errorCause() mimirpb.ErrorCause {
return mimirpb.INSTANCE_LIMIT
}
// Ensure that instanceLimitReachedError is an ingesterError.
var _ ingesterError = instanceLimitReachedError{}
// tsdbUnavailableError is an ingesterError indicating that the TSDB is unavailable.
type tsdbUnavailableError struct {
message string
}
func newTSDBUnavailableError(message string) tsdbUnavailableError {
return tsdbUnavailableError{message: message}
}
func (e tsdbUnavailableError) Error() string {
return e.message
}
func (e tsdbUnavailableError) errorCause() mimirpb.ErrorCause {
return mimirpb.TSDB_UNAVAILABLE
}
// Ensure that tsdbUnavailableError is an ingesterError.
var _ ingesterError = tsdbUnavailableError{}
type ingesterTooBusyError struct{}
func (e ingesterTooBusyError) Error() string {
return ingesterTooBusyMsg
}
func (e ingesterTooBusyError) errorCause() mimirpb.ErrorCause {
return mimirpb.TOO_BUSY
}
// Ensure that ingesterTooBusyError is an ingesterError.
var _ ingesterError = ingesterTooBusyError{}
type ingesterPushGrpcDisabledError struct{}
func (e ingesterPushGrpcDisabledError) Error() string {
return ingesterPushGrpcDisabledMsg
}
func (e ingesterPushGrpcDisabledError) errorCause() mimirpb.ErrorCause {
return mimirpb.METHOD_NOT_ALLOWED
}
// Ensure that ingesterPushGrpcDisabledError is an ingesterError.
var _ ingesterError = ingesterPushGrpcDisabledError{}
type ingesterErrSamplers struct {
sampleTimestampTooOld *log.Sampler
sampleTimestampTooOldOOOEnabled *log.Sampler
sampleTimestampTooFarInFuture *log.Sampler
sampleOutOfOrder *log.Sampler
sampleDuplicateTimestamp *log.Sampler
maxSeriesPerMetricLimitExceeded *log.Sampler
maxMetadataPerMetricLimitExceeded *log.Sampler
maxSeriesPerUserLimitExceeded *log.Sampler
maxMetadataPerUserLimitExceeded *log.Sampler
nativeHistogramValidationError *log.Sampler
}
func newIngesterErrSamplers(freq int64) ingesterErrSamplers {
return ingesterErrSamplers{
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
log.NewSampler(freq),
}
}
// mapPushErrorToErrorWithStatus maps the given error to the corresponding error of type globalerror.ErrorWithStatus.
func mapPushErrorToErrorWithStatus(err error) error {
var (
ingesterErr ingesterError
errCode = codes.Internal
wrappedErr = err
)
if errors.As(err, &ingesterErr) {
switch ingesterErr.errorCause() {
case mimirpb.BAD_DATA:
errCode = codes.FailedPrecondition
case mimirpb.SERVICE_UNAVAILABLE:
errCode = codes.Unavailable
case mimirpb.INSTANCE_LIMIT:
errCode = codes.Unavailable
wrappedErr = middleware.DoNotLogError{Err: err}
case mimirpb.TSDB_UNAVAILABLE:
errCode = codes.Internal
case mimirpb.METHOD_NOT_ALLOWED:
errCode = codes.Unimplemented
}
}
return newErrorWithStatus(wrappedErr, errCode)
}
// mapPushErrorToErrorWithHTTPOrGRPCStatus maps ingesterError objects to an appropriate
// globalerror.ErrorWithStatus, which may contain both HTTP and gRPC error codes.
func mapPushErrorToErrorWithHTTPOrGRPCStatus(err error) error {
var ingesterErr ingesterError
if errors.As(err, &ingesterErr) {
switch ingesterErr.errorCause() {
case mimirpb.BAD_DATA:
return newErrorWithHTTPStatus(err, http.StatusBadRequest)
case mimirpb.SERVICE_UNAVAILABLE:
return newErrorWithStatus(err, codes.Unavailable)
case mimirpb.INSTANCE_LIMIT:
return newErrorWithStatus(middleware.DoNotLogError{Err: err}, codes.Unavailable)
case mimirpb.TSDB_UNAVAILABLE:
return newErrorWithHTTPStatus(err, http.StatusServiceUnavailable)
case mimirpb.METHOD_NOT_ALLOWED:
return newErrorWithStatus(err, codes.Unimplemented)
}
}
return err
}
// mapReadErrorToErrorWithStatus maps the given error to the corresponding error of type globalerror.ErrorWithStatus.
func mapReadErrorToErrorWithStatus(err error) error {
var (
ingesterErr ingesterError
errCode = codes.Internal
)
if errors.As(err, &ingesterErr) {
switch ingesterErr.errorCause() {
case mimirpb.TOO_BUSY:
errCode = codes.ResourceExhausted
case mimirpb.SERVICE_UNAVAILABLE:
errCode = codes.Unavailable
case mimirpb.METHOD_NOT_ALLOWED:
return newErrorWithStatus(err, codes.Unimplemented)
}
}
return newErrorWithStatus(err, errCode)
}
// mapReadErrorToErrorWithHTTPOrGRPCStatus maps ingesterError objects to an appropriate
// globalerror.ErrorWithStatus, which may contain both HTTP and gRPC error codes.
func mapReadErrorToErrorWithHTTPOrGRPCStatus(err error) error {
var (
ingesterErr ingesterError
)
if errors.As(err, &ingesterErr) {
switch ingesterErr.errorCause() {
case mimirpb.TOO_BUSY:
return newErrorWithHTTPStatus(err, http.StatusServiceUnavailable)
case mimirpb.SERVICE_UNAVAILABLE:
return newErrorWithStatus(err, codes.Unavailable)
case mimirpb.METHOD_NOT_ALLOWED:
return newErrorWithStatus(err, codes.Unimplemented)
}
}
return err
}