mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:51:57 +00:00
Fixes GRAPH-695 The syntactic code intel worker now actually performs indexing of repositories by piping the TAR archive stream from Gitserver straight into scip-syntax CLI, and then manually invoking the upload enqueuer. ## Test plan - New integration test verifying that indexing worker handles the records correctly and uploads valid indexes <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c -->
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package uploadhandler
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
|
|
"github.com/sourcegraph/sourcegraph/internal/metrics"
|
|
"github.com/sourcegraph/sourcegraph/internal/observation"
|
|
"github.com/sourcegraph/sourcegraph/lib/errors"
|
|
)
|
|
|
|
type EnqueuerOperations struct {
|
|
enqueueSinglePayload *observation.Operation
|
|
}
|
|
|
|
func NewEnqueuerOperations(observationCtx *observation.Context) *EnqueuerOperations {
|
|
redMetrics := metrics.NewREDMetrics(
|
|
observationCtx.Registerer,
|
|
"upload_enqueuer",
|
|
metrics.WithLabels("op"),
|
|
metrics.WithCountHelp("Total number of method invocations."),
|
|
)
|
|
|
|
op := func(name string) *observation.Operation {
|
|
return observationCtx.Operation(observation.Op{
|
|
Name: fmt.Sprintf("upload_enqueuer.%s", name),
|
|
MetricLabelValues: []string{name},
|
|
Metrics: redMetrics,
|
|
ErrorFilter: func(err error) observation.ErrorFilterBehaviour {
|
|
var errno syscall.Errno
|
|
if errors.As(err, &errno) && errno == syscall.ECONNREFUSED {
|
|
return observation.EmitForDefault ^ observation.EmitForSentry
|
|
}
|
|
return observation.EmitForDefault
|
|
},
|
|
})
|
|
}
|
|
|
|
return &EnqueuerOperations{
|
|
enqueueSinglePayload: op("enqueueSinglePayload"),
|
|
}
|
|
}
|