worker: Migrate codeintel auto indexing jobs (#21977)

This commit is contained in:
Eric Fritz 2021-06-10 13:18:26 -05:00 committed by GitHub
parent 0517ceb801
commit 22ee5fc4b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 230 additions and 209 deletions

View File

@ -800,50 +800,6 @@ To learn more about Sourcegraph's alerting and how to set up alerts, see [our al
<br />
## frontend: codeintel_indexing_errors
<p class="subtitle">indexing errors every 5m</p>
**Descriptions**
- <span class="badge badge-warning">warning</span> frontend: 20+ indexing errors every 5m
**Possible solutions**
- **Silence this alert:** If you are aware of this alert and want to silence notifications for it, add the following to your site configuration and set a reminder to re-evaluate the alert:
```json
"observability.silenceAlerts": [
"warning_frontend_codeintel_indexing_errors"
]
```
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
## frontend: codeintel_autoindex_enqueuer_errors
<p class="subtitle">index enqueuer errors every 5m</p>
**Descriptions**
- <span class="badge badge-warning">warning</span> frontend: 20+ index enqueuer errors every 5m
**Possible solutions**
- **Silence this alert:** If you are aware of this alert and want to silence notifications for it, add the following to your site configuration and set a reminder to re-evaluate the alert:
```json
"observability.silenceAlerts": [
"warning_frontend_codeintel_autoindex_enqueuer_errors"
]
```
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
## frontend: out_of_band_migrations_up_errors
<p class="subtitle">out-of-band up migration errors every 5m</p>
@ -3128,6 +3084,50 @@ To learn more about Sourcegraph's alerting and how to set up alerts, see [our al
<br />
## worker: codeintel_indexing_errors
<p class="subtitle">indexing errors every 5m</p>
**Descriptions**
- <span class="badge badge-warning">warning</span> worker: 20+ indexing errors every 5m
**Possible solutions**
- **Silence this alert:** If you are aware of this alert and want to silence notifications for it, add the following to your site configuration and set a reminder to re-evaluate the alert:
```json
"observability.silenceAlerts": [
"warning_worker_codeintel_indexing_errors"
]
```
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
## worker: codeintel_autoindex_enqueuer_errors
<p class="subtitle">index enqueuer errors every 5m</p>
**Descriptions**
- <span class="badge badge-warning">warning</span> worker: 20+ index enqueuer errors every 5m
**Possible solutions**
- **Silence this alert:** If you are aware of this alert and want to silence notifications for it, add the following to your site configuration and set a reminder to re-evaluate the alert:
```json
"observability.silenceAlerts": [
"warning_worker_codeintel_autoindex_enqueuer_errors"
]
```
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
## worker: frontend_internal_api_error_responses
<p class="subtitle">frontend-internal API error responses every 5m by route</p>

View File

@ -360,44 +360,6 @@ This panel indicates gitserver client errors every 5m.
<br />
### Frontend: Auto-indexing
#### frontend: codeintel_indexing_99th_percentile_duration
This panel indicates 99th percentile successful indexing operation duration over 5m.
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### frontend: codeintel_indexing_errors
This panel indicates indexing errors every 5m.
> NOTE: Alerts related to this panel are documented in the [alert solutions reference](./alert_solutions.md#frontend-codeintel-indexing-errors).
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### frontend: codeintel_autoindex_enqueuer_99th_percentile_duration
This panel indicates 99th percentile successful index enqueuer operation duration over 5m.
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### frontend: codeintel_autoindex_enqueuer_errors
This panel indicates index enqueuer errors every 5m.
> NOTE: Alerts related to this panel are documented in the [alert solutions reference](./alert_solutions.md#frontend-codeintel-autoindex-enqueuer-errors).
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
### Frontend: Out of band migrations
#### frontend: out_of_band_migrations_up_99th_percentile_duration
@ -1851,6 +1813,44 @@ This panel indicates index records errored due to repeated reset every 5m.
<br />
### Worker: Auto-indexing
#### worker: codeintel_indexing_99th_percentile_duration
This panel indicates 99th percentile successful indexing operation duration over 5m.
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### worker: codeintel_indexing_errors
This panel indicates indexing errors every 5m.
> NOTE: Alerts related to this panel are documented in the [alert solutions reference](./alert_solutions.md#worker-codeintel-indexing-errors).
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### worker: codeintel_autoindex_enqueuer_99th_percentile_duration
This panel indicates 99th percentile successful index enqueuer operation duration over 5m.
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
#### worker: codeintel_autoindex_enqueuer_errors
This panel indicates index enqueuer errors every 5m.
> NOTE: Alerts related to this panel are documented in the [alert solutions reference](./alert_solutions.md#worker-codeintel-autoindex-enqueuer-errors).
<sub>*Managed by the [Sourcegraph Code-intelligence team](https://about.sourcegraph.com/handbook/engineering/code-intelligence).*</sub>
<br />
### Worker: Internal service requests
#### worker: frontend_internal_api_error_responses

View File

@ -11,14 +11,7 @@ type Config struct {
env.BaseConfig
UploadStoreConfig *uploadstore.Config
AutoIndexingTaskInterval time.Duration
AutoIndexingSkipManualInterval time.Duration
HunkCacheSize int
IndexBatchSize int
MinimumTimeSinceLastEnqueue time.Duration
MinimumSearchCount int
MinimumSearchRatio int
MinimumPreciseCount int
DiagnosticsCountMigrationBatchSize int
DiagnosticsCountMigrationBatchInterval time.Duration
DefinitionsCountMigrationBatchSize int
@ -29,8 +22,6 @@ type Config struct {
DocumentColumnSplitMigrationBatchInterval time.Duration
CommittedAtMigrationBatchSize int
CommittedAtMigrationBatchInterval time.Duration
DependencyIndexerSchedulerPollInterval time.Duration
DependencyIndexerSchedulerConcurrency int
}
var config = &Config{}
@ -41,13 +32,6 @@ func init() {
config.UploadStoreConfig = uploadStoreConfig
config.HunkCacheSize = config.GetInt("PRECISE_CODE_INTEL_HUNK_CACHE_SIZE", "1000", "The capacity of the git diff hunk cache.")
config.AutoIndexingTaskInterval = config.GetInterval("PRECISE_CODE_INTEL_AUTO_INDEXING_TASK_INTERVAL", "10m", "The frequency with which to run periodic codeintel auto-indexing tasks.")
config.AutoIndexingSkipManualInterval = config.GetInterval("PRECISE_CODE_INTEL_AUTO_INDEXING_SKIP_MANUAL", "24h", "The duration the auto-indexer will wait after a manual upload to a repository before it starts auto-indexing again. Manually queueing an auto-index run will cancel this waiting period.")
config.IndexBatchSize = config.GetInt("PRECISE_CODE_INTEL_INDEX_BATCH_SIZE", "100", "The number of indexable repositories to schedule at a time.")
config.MinimumTimeSinceLastEnqueue = config.GetInterval("PRECISE_CODE_INTEL_MINIMUM_TIME_SINCE_LAST_ENQUEUE", "24h", "The minimum time between auto-index enqueues for the same repository.")
config.MinimumSearchCount = config.GetInt("PRECISE_CODE_INTEL_MINIMUM_SEARCH_COUNT", "50", "The minimum number of search-based code intel events that triggers auto-indexing on a repository.")
config.MinimumSearchRatio = config.GetInt("PRECISE_CODE_INTEL_MINIMUM_SEARCH_RATIO", "50", "The minimum ratio of search-based to total code intel events that triggers auto-indexing on a repository.")
config.MinimumPreciseCount = config.GetInt("PRECISE_CODE_INTEL_MINIMUM_PRECISE_COUNT", "1", "The minimum number of precise code intel events that triggers auto-indexing on a repository.")
config.DiagnosticsCountMigrationBatchSize = config.GetInt("PRECISE_CODE_INTEL_DIAGNOSTICS_COUNT_MIGRATION_BATCH_SIZE", "1000", "The maximum number of document records to migrate at a time.")
config.DiagnosticsCountMigrationBatchInterval = config.GetInterval("PRECISE_CODE_INTEL_DIAGNOSTICS_COUNT_MIGRATION_BATCH_INTERVAL", "1s", "The timeout between processing migration batches.")
config.DefinitionsCountMigrationBatchSize = config.GetInt("PRECISE_CODE_INTEL_DEFINITIONS_COUNT_MIGRATION_BATCH_SIZE", "1000", "The maximum number of definition records to migrate at once.")
@ -58,6 +42,4 @@ func init() {
config.DocumentColumnSplitMigrationBatchInterval = config.GetInterval("PRECISE_CODE_INTEL_DOCUMENT_COLUMN_SPLIT_MIGRATION_BATCH_INTERVAL", "1s", "The timeout between processing migration batches.")
config.CommittedAtMigrationBatchSize = config.GetInt("PRECISE_CODE_INTEL_COMMITTED_AT_MIGRATION_BATCH_SIZE", "100", "The maximum number of upload records to migrate at a time.")
config.CommittedAtMigrationBatchInterval = config.GetInterval("PRECISE_CODE_INTEL_COMMITTED_AT_MIGRATION_BATCH_INTERVAL", "1s", "The timeout between processing migration batches.")
config.DependencyIndexerSchedulerPollInterval = config.GetInterval("PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_POLL_INTERVAL", "1s", "Interval between queries to the dependency indexing job queue.")
config.DependencyIndexerSchedulerConcurrency = config.GetInt("PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_CONCURRENCY", "1", "The maximum number of dependency graphs that can be processed concurrently.")
}

View File

@ -11,16 +11,12 @@ import (
"github.com/sourcegraph/sourcegraph/cmd/frontend/enterprise"
gql "github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
"github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/background/indexing"
codeintelresolvers "github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/resolvers"
codeintelgqlresolvers "github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/resolvers/graphql"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/database/dbutil"
"github.com/sourcegraph/sourcegraph/internal/goroutine"
"github.com/sourcegraph/sourcegraph/internal/observation"
"github.com/sourcegraph/sourcegraph/internal/oobmigration"
"github.com/sourcegraph/sourcegraph/internal/trace"
"github.com/sourcegraph/sourcegraph/internal/workerutil"
)
func Init(ctx context.Context, db dbutil.DB, outOfBandMigrationRunner *oobmigration.Runner, enterpriseServices *enterprise.Services) error {
@ -48,21 +44,8 @@ func Init(ctx context.Context, db dbutil.DB, outOfBandMigrationRunner *oobmigrat
return err
}
routines := newBackgroundRoutines(observationContext)
enterpriseServices.CodeIntelResolver = resolver
enterpriseServices.NewCodeIntelUploadHandler = uploadHandler
// TODO(efritz) - return these to the frontend to run.
// Requires refactoring of the frontend server setup
// so I'm going to kick that can down the road for a
// short while.
//
// Repo updater is currently doing something similar
// here and would also be ripe for a refresher of the
// startup flow.
go goroutine.MonitorBackgroundRoutines(context.Background(), routines...)
return nil
}
@ -106,44 +89,3 @@ func newUploadHandler(ctx context.Context, db dbutil.DB) (func(internal bool) ht
return uploadHandler, nil
}
func newBackgroundRoutines(observationContext *observation.Context) (routines []goroutine.BackgroundRoutine) {
routines = append(routines, newIndexingRoutines(observationContext)...)
return routines
}
func newIndexingRoutines(observationContext *observation.Context) []goroutine.BackgroundRoutine {
dbStore := &indexing.DBStoreShim{Store: services.dbStore}
return []goroutine.BackgroundRoutine{
indexing.NewIndexScheduler(
dbStore,
services.indexEnqueuer,
config.IndexBatchSize,
config.MinimumTimeSinceLastEnqueue,
config.MinimumSearchCount,
float64(config.MinimumSearchRatio)/100,
config.MinimumPreciseCount,
config.AutoIndexingTaskInterval,
observationContext,
),
indexing.NewIndexabilityUpdater(
dbStore,
services.gitserverClient,
config.MinimumSearchCount,
float64(config.MinimumSearchRatio)/100,
config.MinimumPreciseCount,
config.AutoIndexingSkipManualInterval,
config.AutoIndexingTaskInterval,
observationContext,
),
indexing.NewDependencyIndexingScheduler(
dbStore,
dbstore.WorkerutilDependencyIndexingJobStore(services.dbStore, observationContext),
services.indexEnqueuer,
config.DependencyIndexerSchedulerPollInterval,
config.DependencyIndexerSchedulerConcurrency,
workerutil.NewMetrics(observationContext, "codeintel_dependency_indexing_processor", nil),
),
}
}

View File

@ -18,7 +18,7 @@ func NewCodeIntelUploadHandler(ctx context.Context, db dbutil.DB, internal bool)
}
handler := codeintelhttpapi.NewUploadHandler(
&httpapi.DBStoreShim{services.dbStore},
&httpapi.DBStoreShim{Store: services.dbStore},
services.uploadStore,
internal,
)

View File

@ -1,5 +1,5 @@
package indexing
//go:generate env GOBIN=$PWD/.bin GO111MODULE=on go install github.com/derision-test/go-mockgen/cmd/go-mockgen
//go:generate $PWD/.bin/go-mockgen -f github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/background/indexing -i DBStore -i GitserverClient -i IndexEnqueuer -o mock_iface_test.go
//go:generate $PWD/.bin/go-mockgen -f github.com/sourcegraph/sourcegraph/enterprise/cmd/worker/internal/codeintel/indexing -i DBStore -i GitserverClient -i IndexEnqueuer -o mock_iface_test.go
//go:generate $PWD/.bin/go-mockgen -f github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore -i PackageReferenceScanner -o mock_scanner_test.go

View File

@ -16,7 +16,7 @@ import (
// MockDBStore is a mock implementation of the DBStore interface (from the
// package
// github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/background/indexing)
// github.com/sourcegraph/sourcegraph/enterprise/cmd/worker/internal/codeintel/indexing)
// used for unit testing.
type MockDBStore struct {
// GetRepositoriesWithIndexConfigurationFunc is an instance of a mock
@ -1121,7 +1121,7 @@ func (c DBStoreWithFuncCall) Results() []interface{} {
// MockGitserverClient is a mock implementation of the GitserverClient
// interface (from the package
// github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/background/indexing)
// github.com/sourcegraph/sourcegraph/enterprise/cmd/worker/internal/codeintel/indexing)
// used for unit testing.
type MockGitserverClient struct {
// FileExistsFunc is an instance of a mock function object controlling
@ -1767,7 +1767,7 @@ func (c GitserverClientResolveRevisionFuncCall) Results() []interface{} {
// MockIndexEnqueuer is a mock implementation of the IndexEnqueuer interface
// (from the package
// github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend/internal/codeintel/background/indexing)
// github.com/sourcegraph/sourcegraph/enterprise/cmd/worker/internal/codeintel/indexing)
// used for unit testing.
type MockIndexEnqueuer struct {
// QueueIndexesForPackageFunc is an instance of a mock function object

View File

@ -0,0 +1,35 @@
package codeintel
import (
"time"
"github.com/sourcegraph/sourcegraph/internal/env"
)
type indexingConfig struct {
env.BaseConfig
AutoIndexingTaskInterval time.Duration
AutoIndexingSkipManualInterval time.Duration
IndexBatchSize int
MinimumTimeSinceLastEnqueue time.Duration
MinimumSearchCount int
MinimumSearchRatio int
MinimumPreciseCount int
DependencyIndexerSchedulerPollInterval time.Duration
DependencyIndexerSchedulerConcurrency int
}
var indexingConfigInst = &indexingConfig{}
func (c *indexingConfig) Load() {
c.AutoIndexingTaskInterval = c.GetInterval("PRECISE_CODE_INTEL_AUTO_INDEXING_TASK_INTERVAL", "10m", "The frequency with which to run periodic codeintel auto-indexing tasks.")
c.AutoIndexingSkipManualInterval = c.GetInterval("PRECISE_CODE_INTEL_AUTO_INDEXING_SKIP_MANUAL", "24h", "The duration the auto-indexer will wait after a manual upload to a repository before it starts auto-indexing again. Manually queueing an auto-index run will cancel this waiting period.")
c.IndexBatchSize = c.GetInt("PRECISE_CODE_INTEL_INDEX_BATCH_SIZE", "100", "The number of indexable repositories to schedule at a time.")
c.MinimumTimeSinceLastEnqueue = c.GetInterval("PRECISE_CODE_INTEL_MINIMUM_TIME_SINCE_LAST_ENQUEUE", "24h", "The minimum time between auto-index enqueues for the same repository.")
c.MinimumSearchCount = c.GetInt("PRECISE_CODE_INTEL_MINIMUM_SEARCH_COUNT", "50", "The minimum number of search-based code intel events that triggers auto-indexing on a repository.")
c.MinimumSearchRatio = c.GetInt("PRECISE_CODE_INTEL_MINIMUM_SEARCH_RATIO", "50", "The minimum ratio of search-based to total code intel events that triggers auto-indexing on a repository.")
c.MinimumPreciseCount = c.GetInt("PRECISE_CODE_INTEL_MINIMUM_PRECISE_COUNT", "1", "The minimum number of precise code intel events that triggers auto-indexing on a repository.")
c.DependencyIndexerSchedulerPollInterval = c.GetInterval("PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_POLL_INTERVAL", "1s", "Interval between queries to the dependency indexing job queue.")
c.DependencyIndexerSchedulerConcurrency = c.GetInt("PRECISE_CODE_INTEL_DEPENDENCY_INDEXER_SCHEDULER_CONCURRENCY", "1", "The maximum number of dependency graphs that can be processed concurrently.")
}

View File

@ -0,0 +1,61 @@
package codeintel
import (
"context"
"github.com/inconshreveable/log15"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/sourcegraph/sourcegraph/cmd/worker/shared"
"github.com/sourcegraph/sourcegraph/enterprise/cmd/worker/internal/codeintel/indexing"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/autoindex/enqueuer"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/env"
"github.com/sourcegraph/sourcegraph/internal/goroutine"
"github.com/sourcegraph/sourcegraph/internal/observation"
"github.com/sourcegraph/sourcegraph/internal/repoupdater"
"github.com/sourcegraph/sourcegraph/internal/trace"
"github.com/sourcegraph/sourcegraph/internal/workerutil"
)
type indexingJob struct{}
func NewIndexingJob() shared.Job {
return &indexingJob{}
}
func (j *indexingJob) Config() []env.Config {
return []env.Config{indexingConfigInst}
}
func (j *indexingJob) Routines(ctx context.Context) ([]goroutine.BackgroundRoutine, error) {
observationContext := &observation.Context{
Logger: log15.Root(),
Tracer: &trace.Tracer{Tracer: opentracing.GlobalTracer()},
Registerer: prometheus.DefaultRegisterer,
}
dbStore, err := InitDBStore()
if err != nil {
return nil, err
}
gitserverClient, err := InitGitserverClient()
if err != nil {
return nil, err
}
dbStoreShim := &indexing.DBStoreShim{Store: dbStore}
enqueuerDBStoreShim := &enqueuer.DBStoreShim{Store: dbStore}
indexEnqueuer := enqueuer.NewIndexEnqueuer(enqueuerDBStoreShim, gitserverClient, repoupdater.DefaultClient, observationContext)
metrics := workerutil.NewMetrics(observationContext, "codeintel_dependency_indexing_processor", nil)
routines := []goroutine.BackgroundRoutine{
indexing.NewIndexScheduler(dbStoreShim, indexEnqueuer, indexingConfigInst.IndexBatchSize, indexingConfigInst.MinimumTimeSinceLastEnqueue, indexingConfigInst.MinimumSearchCount, float64(indexingConfigInst.MinimumSearchRatio)/100, indexingConfigInst.MinimumPreciseCount, indexingConfigInst.AutoIndexingTaskInterval, observationContext),
indexing.NewIndexabilityUpdater(dbStoreShim, gitserverClient, indexingConfigInst.MinimumSearchCount, float64(indexingConfigInst.MinimumSearchRatio)/100, indexingConfigInst.MinimumPreciseCount, indexingConfigInst.AutoIndexingSkipManualInterval, indexingConfigInst.AutoIndexingTaskInterval, observationContext),
indexing.NewDependencyIndexingScheduler(dbStoreShim, dbstore.WorkerutilDependencyIndexingJobStore(dbStore, observationContext), indexEnqueuer, indexingConfigInst.DependencyIndexerSchedulerPollInterval, indexingConfigInst.DependencyIndexerSchedulerConcurrency, metrics),
}
return routines, nil
}

View File

@ -24,8 +24,9 @@ func main() {
go setAuthzProviders()
shared.Start(map[string]shared.Job{
"codeintel-commitgraph": codeintel.NewCommitGraphJob(),
"codeintel-janitor": codeintel.NewJanitorJob(),
"codeintel-commitgraph": codeintel.NewCommitGraphJob(),
"codeintel-janitor": codeintel.NewJanitorJob(),
"codeintel-auto-indexing": codeintel.NewIndexingJob(),
})
}

View File

@ -448,50 +448,6 @@ func Frontend() *monitoring.Container {
},
},
},
{
Title: "Auto-indexing",
Hidden: true,
Rows: []monitoring.Row{
{
{
Name: "codeintel_indexing_99th_percentile_duration",
Description: "99th percentile successful indexing operation duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_codeintel_indexing_duration_seconds_bucket{job=~"(sourcegraph-)?frontend"}[5m])))`,
NoAlert: true,
Panel: monitoring.Panel().LegendFormat("operations").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerCodeIntel,
Interpretation: "none",
},
{
Name: "codeintel_indexing_errors",
Description: "indexing errors every 5m",
Query: `sum(increase(src_codeintel_indexing_errors_total{job=~"(sourcegraph-)?frontend"}[5m]))`,
Warning: monitoring.Alert().GreaterOrEqual(20, nil),
Panel: monitoring.Panel().LegendFormat("errors"),
Owner: monitoring.ObservableOwnerCodeIntel,
PossibleSolutions: "none",
},
{
Name: "codeintel_autoindex_enqueuer_99th_percentile_duration",
Description: "99th percentile successful index enqueuer operation duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_codeintel_autoindex_enqueuer_duration_seconds_bucket{job=~"(sourcegraph-)?frontend"}[5m])))`,
NoAlert: true,
Panel: monitoring.Panel().LegendFormat("operations").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerCodeIntel,
Interpretation: "none",
},
{
Name: "codeintel_autoindex_enqueuer_errors",
Description: "index enqueuer errors every 5m",
Query: `sum(increase(src_codeintel_autoindex_enqueuer_errors_total{job=~"(sourcegraph-)?frontend"}[5m]))`,
Warning: monitoring.Alert().GreaterOrEqual(20, nil),
Panel: monitoring.Panel().LegendFormat("errors"),
Owner: monitoring.ObservableOwnerCodeIntel,
PossibleSolutions: "none",
},
},
},
},
{
Title: "Out of band migrations",
Hidden: true,

View File

@ -137,6 +137,50 @@ func Worker() *monitoring.Container {
},
},
},
{
Title: "Auto-indexing",
Hidden: true,
Rows: []monitoring.Row{
{
{
Name: "codeintel_indexing_99th_percentile_duration",
Description: "99th percentile successful indexing operation duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_codeintel_indexing_duration_seconds_bucket{job=~"(sourcegraph-)?frontend"}[5m])))`,
NoAlert: true,
Panel: monitoring.Panel().LegendFormat("operations").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerCodeIntel,
Interpretation: "none",
},
{
Name: "codeintel_indexing_errors",
Description: "indexing errors every 5m",
Query: `sum(increase(src_codeintel_indexing_errors_total{job=~"(sourcegraph-)?frontend"}[5m]))`,
Warning: monitoring.Alert().GreaterOrEqual(20, nil),
Panel: monitoring.Panel().LegendFormat("errors"),
Owner: monitoring.ObservableOwnerCodeIntel,
PossibleSolutions: "none",
},
{
Name: "codeintel_autoindex_enqueuer_99th_percentile_duration",
Description: "99th percentile successful index enqueuer operation duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_codeintel_autoindex_enqueuer_duration_seconds_bucket{job=~"(sourcegraph-)?frontend"}[5m])))`,
NoAlert: true,
Panel: monitoring.Panel().LegendFormat("operations").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerCodeIntel,
Interpretation: "none",
},
{
Name: "codeintel_autoindex_enqueuer_errors",
Description: "index enqueuer errors every 5m",
Query: `sum(increase(src_codeintel_autoindex_enqueuer_errors_total{job=~"(sourcegraph-)?frontend"}[5m]))`,
Warning: monitoring.Alert().GreaterOrEqual(20, nil),
Panel: monitoring.Panel().LegendFormat("errors"),
Owner: monitoring.ObservableOwnerCodeIntel,
PossibleSolutions: "none",
},
},
},
},
{
Title: "Internal service requests",
Hidden: true,