Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move VCS service handler from querier to query frontend #3709

Merged
merged 1 commit into from
Nov 20, 2024
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: 4 additions & 0 deletions pkg/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import (

"github.com/grafana/dskit/tenant"

"github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1/vcsv1connect"
"github.com/grafana/pyroscope/pkg/frontend/frontendpb"
"github.com/grafana/pyroscope/pkg/frontend/vcs"
"github.com/grafana/pyroscope/pkg/querier/stats"
"github.com/grafana/pyroscope/pkg/scheduler/schedulerdiscovery"
"github.com/grafana/pyroscope/pkg/util/connectgrpc"
Expand Down Expand Up @@ -80,6 +82,7 @@ func (cfg *Config) Validate() error {
type Frontend struct {
services.Service
connectgrpc.GRPCRoundTripper
vcsv1connect.VCSServiceHandler
frontendpb.UnimplementedFrontendForQuerierServer

cfg Config
Expand Down Expand Up @@ -150,6 +153,7 @@ func NewFrontend(cfg Config, limits Limits, log log.Logger, reg prometheus.Regis
schedulerWorkers: schedulerWorkers,
schedulerWorkersWatcher: services.NewFailureWatcher(),
requests: newRequestsInProgress(),
VCSServiceHandler: vcs.New(log, reg),
}
f.GRPCRoundTripper = &realFrontendRoundTripper{frontend: f}
// Randomize to avoid getting responses from queries sent before restart, which could lead to mixing results
Expand Down
49 changes: 0 additions & 49 deletions pkg/frontend/frontend_vcs.go

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/querier/vcs/service.go → pkg/frontend/vcs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

vcsv1 "github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1"
"github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1/vcsv1connect"
"github.com/grafana/pyroscope/pkg/querier/vcs/client"
"github.com/grafana/pyroscope/pkg/querier/vcs/source"
"github.com/grafana/pyroscope/pkg/frontend/vcs/client"
"github.com/grafana/pyroscope/pkg/frontend/vcs/source"
)

var _ vcsv1connect.VCSServiceHandler = (*Service)(nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
giturl "github.com/kubescape/go-git-url"

vcsv1 "github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1"
"github.com/grafana/pyroscope/pkg/querier/vcs/client"
"github.com/grafana/pyroscope/pkg/frontend/vcs/client"
)

type VCSClient interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"golang.org/x/mod/module"

vcsv1 "github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1"
"github.com/grafana/pyroscope/pkg/querier/vcs/client"
"github.com/grafana/pyroscope/pkg/querier/vcs/source/golang"
"github.com/grafana/pyroscope/pkg/frontend/vcs/client"
"github.com/grafana/pyroscope/pkg/frontend/vcs/source/golang"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
giturl "github.com/kubescape/go-git-url"
"github.com/stretchr/testify/assert"

"github.com/grafana/pyroscope/pkg/querier/vcs/client"
"github.com/grafana/pyroscope/pkg/frontend/vcs/client"
)

type VCSClientMock struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestStandardLibraryURL(t *testing.T) {
expectedOk bool
}{
{
input: "github.com/grafana/grafana/pkg/querier/vcs.go",
input: "github.com/grafana/grafana/pkg/frontend/vcs.go",
expected: "",
expectedOk: false,
},
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions pkg/phlare/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ import (
"github.com/grafana/pyroscope/pkg/frontend"
readpath "github.com/grafana/pyroscope/pkg/frontend/read_path"
queryfrontend "github.com/grafana/pyroscope/pkg/frontend/read_path/query_frontend"
"github.com/grafana/pyroscope/pkg/frontend/vcs"
"github.com/grafana/pyroscope/pkg/ingester"
objstoreclient "github.com/grafana/pyroscope/pkg/objstore/client"
"github.com/grafana/pyroscope/pkg/objstore/providers/filesystem"
"github.com/grafana/pyroscope/pkg/operations"
phlarecontext "github.com/grafana/pyroscope/pkg/phlare/context"
"github.com/grafana/pyroscope/pkg/querier"
"github.com/grafana/pyroscope/pkg/querier/vcs"
"github.com/grafana/pyroscope/pkg/querier/worker"
"github.com/grafana/pyroscope/pkg/scheduler"
"github.com/grafana/pyroscope/pkg/settings"
Expand Down Expand Up @@ -318,7 +318,6 @@ func (f *Phlare) initQuerier() (services.Service, error) {
if !f.isModuleActive(QueryFrontend) {
f.API.RegisterPyroscopeHandlers(querierSvc)
f.API.RegisterQuerierServiceHandler(querierSvc)
f.API.RegisterVCSServiceHandler(querierSvc)
}

qWorker, err := worker.NewQuerierWorker(
Expand Down
3 changes: 0 additions & 3 deletions pkg/querier/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ import (
"net/http"

"github.com/grafana/pyroscope/api/gen/proto/go/querier/v1/querierv1connect"
vcsv1connect "github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1/vcsv1connect"
connectapi "github.com/grafana/pyroscope/pkg/api/connect"
"github.com/grafana/pyroscope/pkg/util/connectgrpc"
httputil "github.com/grafana/pyroscope/pkg/util/http"
)

type QuerierSvc interface {
querierv1connect.QuerierServiceHandler
vcsv1connect.VCSServiceHandler
}

func NewGRPCHandler(svc QuerierSvc, useK6Middleware bool) connectgrpc.GRPCHandler {
mux := http.NewServeMux()
mux.Handle(querierv1connect.NewQuerierServiceHandler(svc, connectapi.DefaultHandlerOptions()...))
mux.Handle(vcsv1connect.NewVCSServiceHandler(svc, connectapi.DefaultHandlerOptions()...))

if useK6Middleware {
httpMiddleware := httputil.K6Middleware()
Expand Down
5 changes: 0 additions & 5 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ import (
ingestv1 "github.com/grafana/pyroscope/api/gen/proto/go/ingester/v1"
querierv1 "github.com/grafana/pyroscope/api/gen/proto/go/querier/v1"
typesv1 "github.com/grafana/pyroscope/api/gen/proto/go/types/v1"
"github.com/grafana/pyroscope/api/gen/proto/go/vcs/v1/vcsv1connect"
connectapi "github.com/grafana/pyroscope/pkg/api/connect"
"github.com/grafana/pyroscope/pkg/clientpool"
phlaremodel "github.com/grafana/pyroscope/pkg/model"
phlareobj "github.com/grafana/pyroscope/pkg/objstore"
"github.com/grafana/pyroscope/pkg/phlaredb/bucketindex"
"github.com/grafana/pyroscope/pkg/pprof"
"github.com/grafana/pyroscope/pkg/querier/vcs"
"github.com/grafana/pyroscope/pkg/storegateway"
pmath "github.com/grafana/pyroscope/pkg/util/math"
"github.com/grafana/pyroscope/pkg/util/spanlogger"
Expand Down Expand Up @@ -71,8 +69,6 @@ type Querier struct {
ingesterQuerier *IngesterQuerier
storeGatewayQuerier *StoreGatewayQuerier

vcsv1connect.VCSServiceHandler

storageBucket phlareobj.Bucket
tenantConfigProvider phlareobj.TenantConfigProvider

Expand Down Expand Up @@ -133,7 +129,6 @@ func New(params *NewQuerierParams) (*Querier, error) {
params.IngestersRing,
),
storeGatewayQuerier: storeGatewayQuerier,
VCSServiceHandler: vcs.New(params.Logger, params.Reg),
storageBucket: params.StorageBucket,
tenantConfigProvider: params.CfgProvider,
limits: params.Overrides,
Expand Down
Loading