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

[Backport 5.1] zoekt: update to 3ce1f2b24c80b3dea89d237600d2b0879342ed1b #56551

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6241,8 +6241,8 @@ def go_dependencies():
name = "com_github_sourcegraph_zoekt",
build_file_proto_mode = "disable_global",
importpath = "github.com/sourcegraph/zoekt",
sum = "h1:kqYHOCtMTKwkM2F6AbpelFE+Olt2qqJyxBCNps1oIjQ=",
version = "v0.0.0-20230825171831-40a9a23bb04b",
sum = "h1:jz6dUd7NKcULoGoC0KcsdWw1dh58S8/cM50rl1K2b00=",
version = "v0.0.0-20230912152407-3ce1f2b24c80",
)

go_repository(
Expand Down
102 changes: 51 additions & 51 deletions doc/admin/observability/alerts.md

Large diffs are not rendered by default.

893 changes: 678 additions & 215 deletions doc/admin/observability/dashboards.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ require (
github.com/sourcegraph/conc v0.2.0
github.com/sourcegraph/mountinfo v0.0.0-20230106004439-7026e28cef67
github.com/sourcegraph/sourcegraph/monitoring v0.0.0-20230124144931-b2d81b1accb6
github.com/sourcegraph/zoekt v0.0.0-20230825171831-40a9a23bb04b
github.com/sourcegraph/zoekt v0.0.0-20230912152407-3ce1f2b24c80
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2026,8 +2026,8 @@ github.com/sourcegraph/scip v0.3.1-0.20230627154934-45df7f6d33fc h1:o+eq0cjVV3B5
github.com/sourcegraph/scip v0.3.1-0.20230627154934-45df7f6d33fc/go.mod h1:7ZKAtLIUmiMvOIgG5LMcBxdtBXVa0v2GWC4Hm1ASYQ0=
github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152 h1:z/MpntplPaW6QW95pzcAR/72Z5TWDyDnSo0EOcyij9o=
github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
github.com/sourcegraph/zoekt v0.0.0-20230825171831-40a9a23bb04b h1:kqYHOCtMTKwkM2F6AbpelFE+Olt2qqJyxBCNps1oIjQ=
github.com/sourcegraph/zoekt v0.0.0-20230825171831-40a9a23bb04b/go.mod h1:3rlMtZdLxkc7P1R14qWq20fWDDyRQwL6TmAqH81WQ4M=
github.com/sourcegraph/zoekt v0.0.0-20230912152407-3ce1f2b24c80 h1:jz6dUd7NKcULoGoC0KcsdWw1dh58S8/cM50rl1K2b00=
github.com/sourcegraph/zoekt v0.0.0-20230912152407-3ce1f2b24c80/go.mod h1:49Y2VVQuWxaSUXeFphZnZX+/zVy2G/sqd+cg/oqQTBk=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v0.0.0-20170901052352-ee1bd8ee15a1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/search/backend/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions internal/search/backend/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"

"github.com/sourcegraph/zoekt"
v1 "github.com/sourcegraph/zoekt/grpc/v1"
proto "github.com/sourcegraph/zoekt/grpc/protos/zoekt/webserver/v1"
"github.com/sourcegraph/zoekt/query"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -55,7 +55,7 @@ func (c *switchableZoektGRPCClient) String() string {
// zoektGRPCClient is a zoekt.Streamer that uses gRPC for its RPC layer
type zoektGRPCClient struct {
endpoint string
client v1.WebserverServiceClient
client proto.WebserverServiceClient

// We capture the dial error to return it lazily.
// This allows us to treat Dial as infallible, which is
Expand All @@ -70,9 +70,11 @@ func (z *zoektGRPCClient) StreamSearch(ctx context.Context, q query.Q, opts *zoe
return z.dialErr
}

req := &v1.SearchRequest{
Query: query.QToProto(q),
Opts: opts.ToProto(),
req := &proto.StreamSearchRequest{
Request: &proto.SearchRequest{
Query: query.QToProto(q),
Opts: opts.ToProto(),
},
}

ss, err := z.client.StreamSearch(ctx, req)
Expand All @@ -89,7 +91,7 @@ func (z *zoektGRPCClient) StreamSearch(ctx context.Context, q query.Q, opts *zoe
var repoURLS map[string]string // We don't use repoURLs in Sourcegraph
var lineFragments map[string]string // We don't use lineFragments in Sourcegraph

sender.Send(zoekt.SearchResultFromProto(msg, repoURLS, lineFragments))
sender.Send(zoekt.SearchResultFromProto(msg.GetResponseChunk(), repoURLS, lineFragments))
}
}

Expand All @@ -98,7 +100,7 @@ func (z *zoektGRPCClient) Search(ctx context.Context, q query.Q, opts *zoekt.Sea
return nil, z.dialErr
}

req := &v1.SearchRequest{
req := &proto.SearchRequest{
Query: query.QToProto(q),
Opts: opts.ToProto(),
}
Expand All @@ -121,7 +123,7 @@ func (z *zoektGRPCClient) List(ctx context.Context, q query.Q, opts *zoekt.ListO
return nil, z.dialErr
}

req := &v1.ListRequest{
req := &proto.ListRequest{
Query: query.QToProto(q),
Opts: opts.ToProto(),
}
Expand Down
4 changes: 2 additions & 2 deletions internal/search/backend/zoekt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/sourcegraph/log"
"github.com/sourcegraph/zoekt"
"github.com/sourcegraph/zoekt/grpc/v1"
proto "github.com/sourcegraph/zoekt/grpc/protos/zoekt/webserver/v1"
"github.com/sourcegraph/zoekt/rpc"
zoektstream "github.com/sourcegraph/zoekt/stream"
"google.golang.org/grpc"
Expand Down Expand Up @@ -125,7 +125,7 @@ func ZoektDialGRPC(endpoint string) zoekt.Streamer {
)
return NewMeteredSearcher(endpoint, &zoektGRPCClient{
endpoint: endpoint,
client: v1.NewWebserverServiceClient(conn),
client: proto.NewWebserverServiceClient(conn),
dialErr: err,
})
}
Expand Down
15 changes: 8 additions & 7 deletions monitoring/definitions/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func Frontend() *monitoring.Dashboard {
Query: `histogram_quantile(0.9, sum by(le) (rate(src_http_request_duration_seconds_bucket{route="blob"}[10m])))`,
Critical: monitoring.Alert().GreaterOrEqual(5),
Panel: monitoring.Panel().LegendFormat("latency").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
NextSteps: `
- Confirm that the Sourcegraph frontend has enough CPU/memory using the provisioning panels.
- Trace a request to see what the slowest part is: https://docs.sourcegraph.com/admin/observability/tracing
Expand Down Expand Up @@ -418,6 +418,7 @@ func Frontend() *monitoring.Dashboard {
shared.GRPCInternalErrorMetricsOptions{
HumanServiceName: "frontend",
RawGRPCServiceName: grpcZoektConfigurationServiceName,
Namespace: "", // intentionally empty

MethodFilterRegex: fmt.Sprintf("${%s:regex}", grpcMethodVariable.Name),
}, monitoring.ObservableOwnerSearchCore),
Expand Down Expand Up @@ -468,7 +469,7 @@ func Frontend() *monitoring.Dashboard {
Query: `histogram_quantile(0.99, sum by (le,category)(rate(src_gitserver_request_duration_seconds_bucket{job=~"(sourcegraph-)?frontend"}[5m])))`,
Warning: monitoring.Alert().GreaterOrEqual(20),
Panel: monitoring.Panel().LegendFormat("{{category}}").Unit(monitoring.Seconds),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
NextSteps: "none",
},
{
Expand All @@ -477,7 +478,7 @@ func Frontend() *monitoring.Dashboard {
Query: `sum by (category)(increase(src_gitserver_request_duration_seconds_count{job=~"(sourcegraph-)?frontend",code!~"2.."}[5m])) / ignoring(code) group_left sum by (category)(increase(src_gitserver_request_duration_seconds_count{job=~"(sourcegraph-)?frontend"}[5m])) * 100`,
Warning: monitoring.Alert().GreaterOrEqual(5).For(15 * time.Minute),
Panel: monitoring.Panel().LegendFormat("{{category}}").Unit(monitoring.Percentage),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
NextSteps: "none",
},
},
Expand Down Expand Up @@ -648,7 +649,7 @@ func Frontend() *monitoring.Dashboard {
Warning: monitoring.Alert().GreaterOrEqual(15000).For(5 * time.Minute),
Critical: monitoring.Alert().GreaterOrEqual(30000).For(5 * time.Minute),
Panel: monitoring.Panel().Unit(monitoring.Number),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
NextSteps: `
- Revert recent commits that cause extensive listing from "external_services" and/or "user_external_accounts" tables.
`,
Expand All @@ -659,7 +660,7 @@ func Frontend() *monitoring.Dashboard {
Query: `min by (kubernetes_name) (src_encryption_cache_hit_total/(src_encryption_cache_hit_total+src_encryption_cache_miss_total))`,
NoAlert: true,
Panel: monitoring.Panel().Unit(monitoring.Number),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
Interpretation: `
- Encryption cache hit ratio (hits/(hits+misses)) - minimum across all instances of a workload.
`,
Expand All @@ -670,7 +671,7 @@ func Frontend() *monitoring.Dashboard {
Query: `sum by (kubernetes_name) (irate(src_encryption_cache_eviction_total[5m]))`,
NoAlert: true,
Panel: monitoring.Panel().Unit(monitoring.Number),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
Interpretation: `
- Rate of encryption cache evictions (caused by cache exceeding its maximum size) - sum across all instances of a workload
`,
Expand Down Expand Up @@ -1036,7 +1037,7 @@ func Frontend() *monitoring.Dashboard {
Query: "histogram_quantile(0.95, sum (rate(src_http_request_duration_seconds_bucket{route=~\"webhooks|github.webhooks|gitlab.webhooks|bitbucketServer.webhooks|bitbucketCloud.webhooks\"}[5m])) by (le, route))",
NoAlert: true,
Panel: monitoring.Panel().LegendFormat("duration").Unit(monitoring.Seconds).With(monitoring.PanelOptions.NoLegend()),
Owner: monitoring.ObservableOwnerRepoManagement,
Owner: monitoring.ObservableOwnerSource,
Interpretation: `
p95 response time to incoming webhook requests from code hosts.

Expand Down
Loading
Loading