Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 6eb2e92

Browse files
authored
codeintel: Do not alert on limit errors (#47751)
1 parent 007252a commit 6eb2e92

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

enterprise/internal/codeintel/autoindexing/internal/background/job_scheduler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func NewScheduler(
7373
Metrics: redMetrics,
7474
ErrorFilter: func(err error) observation.ErrorFilterBehaviour {
7575
if errors.As(err, &inference.LimitError{}) {
76-
return observation.EmitForDefault.Without(observation.EmitForMetrics)
76+
return observation.EmitForNone
7777
}
7878
return observation.EmitForDefault
7979
},
@@ -135,9 +135,11 @@ func (b indexSchedulerJob) handleScheduler(
135135
go func(repositoryID int) {
136136
defer sema.Release(1)
137137
if repositoryErr := b.handleRepository(ctx, repositoryID, policyBatchSize, now); repositoryErr != nil {
138-
errMu.Lock()
139-
errs = errors.Append(errs, repositoryErr)
140-
errMu.Unlock()
138+
if !errors.As(err, &inference.LimitError{}) {
139+
errMu.Lock()
140+
errs = errors.Append(errs, repositoryErr)
141+
errMu.Unlock()
142+
}
141143
}
142144
}(repositoryID)
143145
}

enterprise/internal/codeintel/autoindexing/internal/enqueuer/observability.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package enqueuer
33
import (
44
"fmt"
55

6+
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/autoindexing/internal/inference"
67
"github.com/sourcegraph/sourcegraph/internal/metrics"
78
"github.com/sourcegraph/sourcegraph/internal/observation"
9+
"github.com/sourcegraph/sourcegraph/lib/errors"
810
)
911

1012
type operations struct {
@@ -29,6 +31,12 @@ func newOperations(observationCtx *observation.Context) *operations {
2931
Name: fmt.Sprintf("codeintel.autoindexing.enqueuer.%s", name),
3032
MetricLabelValues: []string{name},
3133
Metrics: m,
34+
ErrorFilter: func(err error) observation.ErrorFilterBehaviour {
35+
if errors.As(err, &inference.LimitError{}) {
36+
return observation.EmitForNone
37+
}
38+
return observation.EmitForDefault
39+
},
3240
})
3341
}
3442

enterprise/internal/codeintel/autoindexing/internal/inference/observability.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/sourcegraph/sourcegraph/internal/metrics"
77
"github.com/sourcegraph/sourcegraph/internal/observation"
8+
"github.com/sourcegraph/sourcegraph/lib/errors"
89
)
910

1011
type operations struct {
@@ -35,6 +36,12 @@ func newOperations(observationCtx *observation.Context) *operations {
3536
Name: fmt.Sprintf("codeintel.autoindexing.inference.%s", name),
3637
MetricLabelValues: []string{name},
3738
Metrics: redMetrics,
39+
ErrorFilter: func(err error) observation.ErrorFilterBehaviour {
40+
if errors.As(err, &LimitError{}) {
41+
return observation.EmitForNone
42+
}
43+
return observation.EmitForDefault
44+
},
3845
})
3946
}
4047

enterprise/internal/codeintel/autoindexing/observability.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package autoindexing
33
import (
44
"fmt"
55

6+
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/autoindexing/internal/inference"
67
"github.com/sourcegraph/sourcegraph/internal/metrics"
78
"github.com/sourcegraph/sourcegraph/internal/observation"
9+
"github.com/sourcegraph/sourcegraph/lib/errors"
810
)
911

1012
type operations struct {
@@ -61,6 +63,12 @@ func newOperations(observationCtx *observation.Context) *operations {
6163
Name: fmt.Sprintf("codeintel.autoindexing.%s", name),
6264
MetricLabelValues: []string{name},
6365
Metrics: m,
66+
ErrorFilter: func(err error) observation.ErrorFilterBehaviour {
67+
if errors.As(err, &inference.LimitError{}) {
68+
return observation.EmitForNone
69+
}
70+
return observation.EmitForDefault
71+
},
6472
})
6573
}
6674

0 commit comments

Comments
 (0)