diff --git a/buf.gen.yaml b/buf.gen.yaml index cb7b8ba6d53..d74b83addab 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -12,6 +12,11 @@ plugins: out: gen/proto/go opt: paths=source_relative + # renovate: datasource=github-releases depName=bufbuild/connect-go + - plugin: connect-go + out: gen/proto/go + opt: paths=source_relative + # renovate: datasource=github-releases depName=planetscale/vtprotobuf - plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0 out: gen/proto/go @@ -25,15 +30,14 @@ plugins: - long_type_string - generate_dependencies - # renovate: datasource=github-releases depName=grpc-ecosystem/grpc-gateway - - plugin: buf.build/grpc-ecosystem/gateway:v2.15.2 - out: gen/proto/go + # renovate: datasource=github-releases depName=bufbuild/connect-es + - plugin: es + out: ui/packages/shared/client/src opt: - - paths=source_relative - - generate_unbound_methods=true + - target=ts - # renovate: datasource=github-releases depName=grpc-ecosystem/grpc-gateway - - plugin: buf.build/grpc-ecosystem/openapiv2:v2.15.2 - out: gen/proto/swagger + # renovate: datasource=github-releases depName=bufbuild/connect-web + - plugin: connect-web + out: ui/packages/shared/client/src opt: - - allow_merge=false + - target=ts diff --git a/gen/.gitignore b/gen/.gitignore deleted file mode 100644 index 5afae7314ac..00000000000 --- a/gen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -proto/swagger/google/pprof diff --git a/gen/proto/go/grpc/health/v1/health.pb.gw.go b/gen/proto/go/grpc/health/v1/health.pb.gw.go deleted file mode 100644 index e157591a514..00000000000 --- a/gen/proto/go/grpc/health/v1/health.pb.gw.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: grpc/health/v1/health.proto - -/* -Package healthv1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package healthv1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_Health_Check_0(ctx context.Context, marshaler runtime.Marshaler, client HealthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq HealthCheckRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Check(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Health_Check_0(ctx context.Context, marshaler runtime.Marshaler, server HealthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq HealthCheckRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Check(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Health_Watch_0(ctx context.Context, marshaler runtime.Marshaler, client HealthClient, req *http.Request, pathParams map[string]string) (Health_WatchClient, runtime.ServerMetadata, error) { - var protoReq HealthCheckRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - stream, err := client.Watch(ctx, &protoReq) - if err != nil { - return nil, metadata, err - } - header, err := stream.Header() - if err != nil { - return nil, metadata, err - } - metadata.HeaderMD = header - return stream, metadata, nil - -} - -// RegisterHealthHandlerServer registers the http handlers for service Health to "mux". -// UnaryRPC :call HealthServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterHealthHandlerFromEndpoint instead. -func RegisterHealthHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HealthServer) error { - - mux.Handle("POST", pattern_Health_Check_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.health.v1.Health/Check", runtime.WithHTTPPathPattern("/grpc.health.v1.Health/Check")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Health_Check_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Health_Check_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Health_Watch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - }) - - return nil -} - -// RegisterHealthHandlerFromEndpoint is same as RegisterHealthHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterHealthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterHealthHandler(ctx, mux, conn) -} - -// RegisterHealthHandler registers the http handlers for service Health to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterHealthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterHealthHandlerClient(ctx, mux, NewHealthClient(conn)) -} - -// RegisterHealthHandlerClient registers the http handlers for service Health -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HealthClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HealthClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "HealthClient" to call the correct interceptors. -func RegisterHealthHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HealthClient) error { - - mux.Handle("POST", pattern_Health_Check_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.health.v1.Health/Check", runtime.WithHTTPPathPattern("/grpc.health.v1.Health/Check")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Health_Check_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Health_Check_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Health_Watch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.health.v1.Health/Watch", runtime.WithHTTPPathPattern("/grpc.health.v1.Health/Watch")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Health_Watch_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Health_Watch_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Health_Check_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"grpc.health.v1.Health", "Check"}, "")) - - pattern_Health_Watch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"grpc.health.v1.Health", "Watch"}, "")) -) - -var ( - forward_Health_Check_0 = runtime.ForwardResponseMessage - - forward_Health_Watch_0 = runtime.ForwardResponseStream -) diff --git a/gen/proto/go/grpc/health/v1/healthv1connect/health.connect.go b/gen/proto/go/grpc/health/v1/healthv1connect/health.connect.go new file mode 100644 index 00000000000..1f5c2a205d9 --- /dev/null +++ b/gen/proto/go/grpc/health/v1/healthv1connect/health.connect.go @@ -0,0 +1,142 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: grpc/health/v1/health.proto + +package healthv1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1 "github.com/parca-dev/parca/gen/proto/go/grpc/health/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // HealthName is the fully-qualified name of the Health service. + HealthName = "grpc.health.v1.Health" +) + +// HealthClient is a client for the grpc.health.v1.Health service. +type HealthClient interface { + // If the requested service is unknown, the call will fail with status + // NOT_FOUND. + Check(context.Context, *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.Response[v1.HealthCheckResponse], error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(context.Context, *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.ServerStreamForClient[v1.HealthCheckResponse], error) +} + +// NewHealthClient constructs a client for the grpc.health.v1.Health service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewHealthClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) HealthClient { + baseURL = strings.TrimRight(baseURL, "/") + return &healthClient{ + check: connect_go.NewClient[v1.HealthCheckRequest, v1.HealthCheckResponse]( + httpClient, + baseURL+"/grpc.health.v1.Health/Check", + opts..., + ), + watch: connect_go.NewClient[v1.HealthCheckRequest, v1.HealthCheckResponse]( + httpClient, + baseURL+"/grpc.health.v1.Health/Watch", + opts..., + ), + } +} + +// healthClient implements HealthClient. +type healthClient struct { + check *connect_go.Client[v1.HealthCheckRequest, v1.HealthCheckResponse] + watch *connect_go.Client[v1.HealthCheckRequest, v1.HealthCheckResponse] +} + +// Check calls grpc.health.v1.Health.Check. +func (c *healthClient) Check(ctx context.Context, req *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.Response[v1.HealthCheckResponse], error) { + return c.check.CallUnary(ctx, req) +} + +// Watch calls grpc.health.v1.Health.Watch. +func (c *healthClient) Watch(ctx context.Context, req *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.ServerStreamForClient[v1.HealthCheckResponse], error) { + return c.watch.CallServerStream(ctx, req) +} + +// HealthHandler is an implementation of the grpc.health.v1.Health service. +type HealthHandler interface { + // If the requested service is unknown, the call will fail with status + // NOT_FOUND. + Check(context.Context, *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.Response[v1.HealthCheckResponse], error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(context.Context, *connect_go.Request[v1.HealthCheckRequest], *connect_go.ServerStream[v1.HealthCheckResponse]) error +} + +// NewHealthHandler builds an HTTP handler from the service implementation. It returns the path on +// which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewHealthHandler(svc HealthHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/grpc.health.v1.Health/Check", connect_go.NewUnaryHandler( + "/grpc.health.v1.Health/Check", + svc.Check, + opts..., + )) + mux.Handle("/grpc.health.v1.Health/Watch", connect_go.NewServerStreamHandler( + "/grpc.health.v1.Health/Watch", + svc.Watch, + opts..., + )) + return "/grpc.health.v1.Health/", mux +} + +// UnimplementedHealthHandler returns CodeUnimplemented from all methods. +type UnimplementedHealthHandler struct{} + +func (UnimplementedHealthHandler) Check(context.Context, *connect_go.Request[v1.HealthCheckRequest]) (*connect_go.Response[v1.HealthCheckResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("grpc.health.v1.Health.Check is not implemented")) +} + +func (UnimplementedHealthHandler) Watch(context.Context, *connect_go.Request[v1.HealthCheckRequest], *connect_go.ServerStream[v1.HealthCheckResponse]) error { + return connect_go.NewError(connect_go.CodeUnimplemented, errors.New("grpc.health.v1.Health.Watch is not implemented")) +} diff --git a/gen/proto/go/parca/debuginfo/v1alpha1/debuginfo.pb.gw.go b/gen/proto/go/parca/debuginfo/v1alpha1/debuginfo.pb.gw.go deleted file mode 100644 index 278a437e22c..00000000000 --- a/gen/proto/go/parca/debuginfo/v1alpha1/debuginfo.pb.gw.go +++ /dev/null @@ -1,418 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/debuginfo/v1alpha1/debuginfo.proto - -/* -Package debuginfov1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package debuginfov1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_DebuginfoService_Upload_0(ctx context.Context, marshaler runtime.Marshaler, client DebuginfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var metadata runtime.ServerMetadata - stream, err := client.Upload(ctx) - if err != nil { - grpclog.Infof("Failed to start streaming: %v", err) - return nil, metadata, err - } - dec := marshaler.NewDecoder(req.Body) - for { - var protoReq UploadRequest - err = dec.Decode(&protoReq) - if err == io.EOF { - break - } - if err != nil { - grpclog.Infof("Failed to decode request: %v", err) - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err = stream.Send(&protoReq); err != nil { - if err == io.EOF { - break - } - grpclog.Infof("Failed to send request: %v", err) - return nil, metadata, err - } - } - - if err := stream.CloseSend(); err != nil { - grpclog.Infof("Failed to terminate client stream: %v", err) - return nil, metadata, err - } - header, err := stream.Header() - if err != nil { - grpclog.Infof("Failed to get header from client: %v", err) - return nil, metadata, err - } - metadata.HeaderMD = header - - msg, err := stream.CloseAndRecv() - metadata.TrailerMD = stream.Trailer() - return msg, metadata, err - -} - -func request_DebuginfoService_ShouldInitiateUpload_0(ctx context.Context, marshaler runtime.Marshaler, client DebuginfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ShouldInitiateUploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ShouldInitiateUpload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_DebuginfoService_ShouldInitiateUpload_0(ctx context.Context, marshaler runtime.Marshaler, server DebuginfoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ShouldInitiateUploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ShouldInitiateUpload(ctx, &protoReq) - return msg, metadata, err - -} - -func request_DebuginfoService_InitiateUpload_0(ctx context.Context, marshaler runtime.Marshaler, client DebuginfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq InitiateUploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.InitiateUpload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_DebuginfoService_InitiateUpload_0(ctx context.Context, marshaler runtime.Marshaler, server DebuginfoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq InitiateUploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.InitiateUpload(ctx, &protoReq) - return msg, metadata, err - -} - -func request_DebuginfoService_MarkUploadFinished_0(ctx context.Context, marshaler runtime.Marshaler, client DebuginfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarkUploadFinishedRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.MarkUploadFinished(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_DebuginfoService_MarkUploadFinished_0(ctx context.Context, marshaler runtime.Marshaler, server DebuginfoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarkUploadFinishedRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.MarkUploadFinished(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterDebuginfoServiceHandlerServer registers the http handlers for service DebuginfoService to "mux". -// UnaryRPC :call DebuginfoServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDebuginfoServiceHandlerFromEndpoint instead. -func RegisterDebuginfoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DebuginfoServiceServer) error { - - mux.Handle("POST", pattern_DebuginfoService_Upload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - }) - - mux.Handle("POST", pattern_DebuginfoService_ShouldInitiateUpload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_DebuginfoService_ShouldInitiateUpload_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_ShouldInitiateUpload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_DebuginfoService_InitiateUpload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_DebuginfoService_InitiateUpload_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_InitiateUpload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_DebuginfoService_MarkUploadFinished_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_DebuginfoService_MarkUploadFinished_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_MarkUploadFinished_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterDebuginfoServiceHandlerFromEndpoint is same as RegisterDebuginfoServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterDebuginfoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterDebuginfoServiceHandler(ctx, mux, conn) -} - -// RegisterDebuginfoServiceHandler registers the http handlers for service DebuginfoService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterDebuginfoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterDebuginfoServiceHandlerClient(ctx, mux, NewDebuginfoServiceClient(conn)) -} - -// RegisterDebuginfoServiceHandlerClient registers the http handlers for service DebuginfoService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DebuginfoServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DebuginfoServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "DebuginfoServiceClient" to call the correct interceptors. -func RegisterDebuginfoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DebuginfoServiceClient) error { - - mux.Handle("POST", pattern_DebuginfoService_Upload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/Upload", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/Upload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_DebuginfoService_Upload_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_Upload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_DebuginfoService_ShouldInitiateUpload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_DebuginfoService_ShouldInitiateUpload_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_ShouldInitiateUpload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_DebuginfoService_InitiateUpload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_DebuginfoService_InitiateUpload_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_InitiateUpload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_DebuginfoService_MarkUploadFinished_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished", runtime.WithHTTPPathPattern("/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_DebuginfoService_MarkUploadFinished_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_DebuginfoService_MarkUploadFinished_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_DebuginfoService_Upload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.debuginfo.v1alpha1.DebuginfoService", "Upload"}, "")) - - pattern_DebuginfoService_ShouldInitiateUpload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.debuginfo.v1alpha1.DebuginfoService", "ShouldInitiateUpload"}, "")) - - pattern_DebuginfoService_InitiateUpload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.debuginfo.v1alpha1.DebuginfoService", "InitiateUpload"}, "")) - - pattern_DebuginfoService_MarkUploadFinished_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.debuginfo.v1alpha1.DebuginfoService", "MarkUploadFinished"}, "")) -) - -var ( - forward_DebuginfoService_Upload_0 = runtime.ForwardResponseMessage - - forward_DebuginfoService_ShouldInitiateUpload_0 = runtime.ForwardResponseMessage - - forward_DebuginfoService_InitiateUpload_0 = runtime.ForwardResponseMessage - - forward_DebuginfoService_MarkUploadFinished_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/debuginfo/v1alpha1/debuginfov1alpha1connect/debuginfo.connect.go b/gen/proto/go/parca/debuginfo/v1alpha1/debuginfov1alpha1connect/debuginfo.connect.go new file mode 100644 index 00000000000..c156d9f0b30 --- /dev/null +++ b/gen/proto/go/parca/debuginfo/v1alpha1/debuginfov1alpha1connect/debuginfo.connect.go @@ -0,0 +1,161 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/debuginfo/v1alpha1/debuginfo.proto + +package debuginfov1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/debuginfo/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // DebuginfoServiceName is the fully-qualified name of the DebuginfoService service. + DebuginfoServiceName = "parca.debuginfo.v1alpha1.DebuginfoService" +) + +// DebuginfoServiceClient is a client for the parca.debuginfo.v1alpha1.DebuginfoService service. +type DebuginfoServiceClient interface { + // Upload ingests debug info for a given build_id + Upload(context.Context) *connect_go.ClientStreamForClient[v1alpha1.UploadRequest, v1alpha1.UploadResponse] + // ShouldInitiateUpload returns whether an upload for a given build_id should be initiated or not. + ShouldInitiateUpload(context.Context, *connect_go.Request[v1alpha1.ShouldInitiateUploadRequest]) (*connect_go.Response[v1alpha1.ShouldInitiateUploadResponse], error) + // InitiateUpload returns a strategy and information to upload debug info for a given build_id. + InitiateUpload(context.Context, *connect_go.Request[v1alpha1.InitiateUploadRequest]) (*connect_go.Response[v1alpha1.InitiateUploadResponse], error) + // MarkUploadFinished marks the upload as finished for a given build_id. + MarkUploadFinished(context.Context, *connect_go.Request[v1alpha1.MarkUploadFinishedRequest]) (*connect_go.Response[v1alpha1.MarkUploadFinishedResponse], error) +} + +// NewDebuginfoServiceClient constructs a client for the parca.debuginfo.v1alpha1.DebuginfoService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDebuginfoServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DebuginfoServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &debuginfoServiceClient{ + upload: connect_go.NewClient[v1alpha1.UploadRequest, v1alpha1.UploadResponse]( + httpClient, + baseURL+"/parca.debuginfo.v1alpha1.DebuginfoService/Upload", + opts..., + ), + shouldInitiateUpload: connect_go.NewClient[v1alpha1.ShouldInitiateUploadRequest, v1alpha1.ShouldInitiateUploadResponse]( + httpClient, + baseURL+"/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload", + opts..., + ), + initiateUpload: connect_go.NewClient[v1alpha1.InitiateUploadRequest, v1alpha1.InitiateUploadResponse]( + httpClient, + baseURL+"/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload", + opts..., + ), + markUploadFinished: connect_go.NewClient[v1alpha1.MarkUploadFinishedRequest, v1alpha1.MarkUploadFinishedResponse]( + httpClient, + baseURL+"/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished", + opts..., + ), + } +} + +// debuginfoServiceClient implements DebuginfoServiceClient. +type debuginfoServiceClient struct { + upload *connect_go.Client[v1alpha1.UploadRequest, v1alpha1.UploadResponse] + shouldInitiateUpload *connect_go.Client[v1alpha1.ShouldInitiateUploadRequest, v1alpha1.ShouldInitiateUploadResponse] + initiateUpload *connect_go.Client[v1alpha1.InitiateUploadRequest, v1alpha1.InitiateUploadResponse] + markUploadFinished *connect_go.Client[v1alpha1.MarkUploadFinishedRequest, v1alpha1.MarkUploadFinishedResponse] +} + +// Upload calls parca.debuginfo.v1alpha1.DebuginfoService.Upload. +func (c *debuginfoServiceClient) Upload(ctx context.Context) *connect_go.ClientStreamForClient[v1alpha1.UploadRequest, v1alpha1.UploadResponse] { + return c.upload.CallClientStream(ctx) +} + +// ShouldInitiateUpload calls parca.debuginfo.v1alpha1.DebuginfoService.ShouldInitiateUpload. +func (c *debuginfoServiceClient) ShouldInitiateUpload(ctx context.Context, req *connect_go.Request[v1alpha1.ShouldInitiateUploadRequest]) (*connect_go.Response[v1alpha1.ShouldInitiateUploadResponse], error) { + return c.shouldInitiateUpload.CallUnary(ctx, req) +} + +// InitiateUpload calls parca.debuginfo.v1alpha1.DebuginfoService.InitiateUpload. +func (c *debuginfoServiceClient) InitiateUpload(ctx context.Context, req *connect_go.Request[v1alpha1.InitiateUploadRequest]) (*connect_go.Response[v1alpha1.InitiateUploadResponse], error) { + return c.initiateUpload.CallUnary(ctx, req) +} + +// MarkUploadFinished calls parca.debuginfo.v1alpha1.DebuginfoService.MarkUploadFinished. +func (c *debuginfoServiceClient) MarkUploadFinished(ctx context.Context, req *connect_go.Request[v1alpha1.MarkUploadFinishedRequest]) (*connect_go.Response[v1alpha1.MarkUploadFinishedResponse], error) { + return c.markUploadFinished.CallUnary(ctx, req) +} + +// DebuginfoServiceHandler is an implementation of the parca.debuginfo.v1alpha1.DebuginfoService +// service. +type DebuginfoServiceHandler interface { + // Upload ingests debug info for a given build_id + Upload(context.Context, *connect_go.ClientStream[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) + // ShouldInitiateUpload returns whether an upload for a given build_id should be initiated or not. + ShouldInitiateUpload(context.Context, *connect_go.Request[v1alpha1.ShouldInitiateUploadRequest]) (*connect_go.Response[v1alpha1.ShouldInitiateUploadResponse], error) + // InitiateUpload returns a strategy and information to upload debug info for a given build_id. + InitiateUpload(context.Context, *connect_go.Request[v1alpha1.InitiateUploadRequest]) (*connect_go.Response[v1alpha1.InitiateUploadResponse], error) + // MarkUploadFinished marks the upload as finished for a given build_id. + MarkUploadFinished(context.Context, *connect_go.Request[v1alpha1.MarkUploadFinishedRequest]) (*connect_go.Response[v1alpha1.MarkUploadFinishedResponse], error) +} + +// NewDebuginfoServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDebuginfoServiceHandler(svc DebuginfoServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.debuginfo.v1alpha1.DebuginfoService/Upload", connect_go.NewClientStreamHandler( + "/parca.debuginfo.v1alpha1.DebuginfoService/Upload", + svc.Upload, + opts..., + )) + mux.Handle("/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload", connect_go.NewUnaryHandler( + "/parca.debuginfo.v1alpha1.DebuginfoService/ShouldInitiateUpload", + svc.ShouldInitiateUpload, + opts..., + )) + mux.Handle("/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload", connect_go.NewUnaryHandler( + "/parca.debuginfo.v1alpha1.DebuginfoService/InitiateUpload", + svc.InitiateUpload, + opts..., + )) + mux.Handle("/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished", connect_go.NewUnaryHandler( + "/parca.debuginfo.v1alpha1.DebuginfoService/MarkUploadFinished", + svc.MarkUploadFinished, + opts..., + )) + return "/parca.debuginfo.v1alpha1.DebuginfoService/", mux +} + +// UnimplementedDebuginfoServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDebuginfoServiceHandler struct{} + +func (UnimplementedDebuginfoServiceHandler) Upload(context.Context, *connect_go.ClientStream[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.debuginfo.v1alpha1.DebuginfoService.Upload is not implemented")) +} + +func (UnimplementedDebuginfoServiceHandler) ShouldInitiateUpload(context.Context, *connect_go.Request[v1alpha1.ShouldInitiateUploadRequest]) (*connect_go.Response[v1alpha1.ShouldInitiateUploadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.debuginfo.v1alpha1.DebuginfoService.ShouldInitiateUpload is not implemented")) +} + +func (UnimplementedDebuginfoServiceHandler) InitiateUpload(context.Context, *connect_go.Request[v1alpha1.InitiateUploadRequest]) (*connect_go.Response[v1alpha1.InitiateUploadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.debuginfo.v1alpha1.DebuginfoService.InitiateUpload is not implemented")) +} + +func (UnimplementedDebuginfoServiceHandler) MarkUploadFinished(context.Context, *connect_go.Request[v1alpha1.MarkUploadFinishedRequest]) (*connect_go.Response[v1alpha1.MarkUploadFinishedResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.debuginfo.v1alpha1.DebuginfoService.MarkUploadFinished is not implemented")) +} diff --git a/gen/proto/go/parca/metastore/v1alpha1/metastore.pb.gw.go b/gen/proto/go/parca/metastore/v1alpha1/metastore.pb.gw.go deleted file mode 100644 index f2fbb7f0c9e..00000000000 --- a/gen/proto/go/parca/metastore/v1alpha1/metastore.pb.gw.go +++ /dev/null @@ -1,936 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/metastore/v1alpha1/metastore.proto - -/* -Package metastorev1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package metastorev1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_MetastoreService_GetOrCreateMappings_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateMappingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetOrCreateMappings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_GetOrCreateMappings_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateMappingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetOrCreateMappings(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_GetOrCreateFunctions_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateFunctionsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetOrCreateFunctions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_GetOrCreateFunctions_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateFunctionsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetOrCreateFunctions(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_GetOrCreateLocations_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateLocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetOrCreateLocations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_GetOrCreateLocations_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateLocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetOrCreateLocations(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_GetOrCreateStacktraces_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateStacktracesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetOrCreateStacktraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_GetOrCreateStacktraces_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOrCreateStacktracesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetOrCreateStacktraces(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_UnsymbolizedLocations_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UnsymbolizedLocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UnsymbolizedLocations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_UnsymbolizedLocations_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UnsymbolizedLocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UnsymbolizedLocations(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_CreateLocationLines_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateLocationLinesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CreateLocationLines(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_CreateLocationLines_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateLocationLinesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.CreateLocationLines(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_Locations_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Locations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_Locations_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LocationsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Locations(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_Functions_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq FunctionsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Functions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_Functions_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq FunctionsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Functions(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_Mappings_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MappingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Mappings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_Mappings_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MappingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Mappings(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MetastoreService_Stacktraces_0(ctx context.Context, marshaler runtime.Marshaler, client MetastoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq StacktracesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Stacktraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MetastoreService_Stacktraces_0(ctx context.Context, marshaler runtime.Marshaler, server MetastoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq StacktracesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Stacktraces(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterMetastoreServiceHandlerServer registers the http handlers for service MetastoreService to "mux". -// UnaryRPC :call MetastoreServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMetastoreServiceHandlerFromEndpoint instead. -func RegisterMetastoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetastoreServiceServer) error { - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateMappings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_GetOrCreateMappings_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateMappings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateFunctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_GetOrCreateFunctions_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateFunctions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_GetOrCreateLocations_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateLocations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateStacktraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_GetOrCreateStacktraces_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateStacktraces_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_UnsymbolizedLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_UnsymbolizedLocations_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_UnsymbolizedLocations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_CreateLocationLines_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_CreateLocationLines_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_CreateLocationLines_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Locations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Locations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Locations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_Locations_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Locations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Functions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Functions", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Functions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_Functions_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Functions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Mappings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Mappings", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Mappings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_Mappings_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Mappings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Stacktraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Stacktraces", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Stacktraces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MetastoreService_Stacktraces_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Stacktraces_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterMetastoreServiceHandlerFromEndpoint is same as RegisterMetastoreServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterMetastoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterMetastoreServiceHandler(ctx, mux, conn) -} - -// RegisterMetastoreServiceHandler registers the http handlers for service MetastoreService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterMetastoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterMetastoreServiceHandlerClient(ctx, mux, NewMetastoreServiceClient(conn)) -} - -// RegisterMetastoreServiceHandlerClient registers the http handlers for service MetastoreService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetastoreServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetastoreServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "MetastoreServiceClient" to call the correct interceptors. -func RegisterMetastoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetastoreServiceClient) error { - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateMappings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_GetOrCreateMappings_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateMappings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateFunctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_GetOrCreateFunctions_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateFunctions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_GetOrCreateLocations_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateLocations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_GetOrCreateStacktraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_GetOrCreateStacktraces_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_GetOrCreateStacktraces_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_UnsymbolizedLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_UnsymbolizedLocations_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_UnsymbolizedLocations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_CreateLocationLines_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_CreateLocationLines_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_CreateLocationLines_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Locations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Locations", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Locations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_Locations_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Locations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Functions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Functions", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Functions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_Functions_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Functions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Mappings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Mappings", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Mappings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_Mappings_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Mappings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MetastoreService_Stacktraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.metastore.v1alpha1.MetastoreService/Stacktraces", runtime.WithHTTPPathPattern("/parca.metastore.v1alpha1.MetastoreService/Stacktraces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetastoreService_Stacktraces_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetastoreService_Stacktraces_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_MetastoreService_GetOrCreateMappings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "GetOrCreateMappings"}, "")) - - pattern_MetastoreService_GetOrCreateFunctions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "GetOrCreateFunctions"}, "")) - - pattern_MetastoreService_GetOrCreateLocations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "GetOrCreateLocations"}, "")) - - pattern_MetastoreService_GetOrCreateStacktraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "GetOrCreateStacktraces"}, "")) - - pattern_MetastoreService_UnsymbolizedLocations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "UnsymbolizedLocations"}, "")) - - pattern_MetastoreService_CreateLocationLines_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "CreateLocationLines"}, "")) - - pattern_MetastoreService_Locations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "Locations"}, "")) - - pattern_MetastoreService_Functions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "Functions"}, "")) - - pattern_MetastoreService_Mappings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "Mappings"}, "")) - - pattern_MetastoreService_Stacktraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.metastore.v1alpha1.MetastoreService", "Stacktraces"}, "")) -) - -var ( - forward_MetastoreService_GetOrCreateMappings_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_GetOrCreateFunctions_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_GetOrCreateLocations_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_GetOrCreateStacktraces_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_UnsymbolizedLocations_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_CreateLocationLines_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_Locations_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_Functions_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_Mappings_0 = runtime.ForwardResponseMessage - - forward_MetastoreService_Stacktraces_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/metastore/v1alpha1/metastorev1alpha1connect/metastore.connect.go b/gen/proto/go/parca/metastore/v1alpha1/metastorev1alpha1connect/metastore.connect.go new file mode 100644 index 00000000000..440c88edd0d --- /dev/null +++ b/gen/proto/go/parca/metastore/v1alpha1/metastorev1alpha1connect/metastore.connect.go @@ -0,0 +1,327 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/metastore/v1alpha1/metastore.proto + +package metastorev1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/metastore/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // MetastoreServiceName is the fully-qualified name of the MetastoreService service. + MetastoreServiceName = "parca.metastore.v1alpha1.MetastoreService" +) + +// MetastoreServiceClient is a client for the parca.metastore.v1alpha1.MetastoreService service. +type MetastoreServiceClient interface { + // GetOrCreateMappings checks if the mappings in the request are already + // known and returns the known mapping (including its ID) if so. If a mapping + // does not already exist, it is written to the backing metastore. + GetOrCreateMappings(context.Context, *connect_go.Request[v1alpha1.GetOrCreateMappingsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateMappingsResponse], error) + // GetOrCreateFunctions checks if the functions in the request are already + // known and returns the known function (including its ID) if so. If a + // function does not already exist, it is written to the backing metastore. + GetOrCreateFunctions(context.Context, *connect_go.Request[v1alpha1.GetOrCreateFunctionsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateFunctionsResponse], error) + // GetOrCreateLocations checks if the locations in the request are already + // known and returns the known location (including its ID) if so. If a + // location does not already exist, it is written to the backing metastore. + GetOrCreateLocations(context.Context, *connect_go.Request[v1alpha1.GetOrCreateLocationsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateLocationsResponse], error) + // GetOrCreateStacktraces checks if the stacktraces in the request are + // already known and returns the known stacktrace (including its ID) if so. + // If a stacktrace does not already exist, it is written to the backing + // metastore. + GetOrCreateStacktraces(context.Context, *connect_go.Request[v1alpha1.GetOrCreateStacktracesRequest]) (*connect_go.Response[v1alpha1.GetOrCreateStacktracesResponse], error) + // UnsymbolizedLocations returns locations that can be symbolized but haven't + // been asynchronously symbolized yet. + UnsymbolizedLocations(context.Context, *connect_go.Request[v1alpha1.UnsymbolizedLocationsRequest]) (*connect_go.Response[v1alpha1.UnsymbolizedLocationsResponse], error) + // CreateLocationLines creates the location lines contained in the provided + // locations. + CreateLocationLines(context.Context, *connect_go.Request[v1alpha1.CreateLocationLinesRequest]) (*connect_go.Response[v1alpha1.CreateLocationLinesResponse], error) + // Locations retrieves locations. + Locations(context.Context, *connect_go.Request[v1alpha1.LocationsRequest]) (*connect_go.Response[v1alpha1.LocationsResponse], error) + // Functions retrieves functions. + Functions(context.Context, *connect_go.Request[v1alpha1.FunctionsRequest]) (*connect_go.Response[v1alpha1.FunctionsResponse], error) + // Mappings retrieves mappings. + Mappings(context.Context, *connect_go.Request[v1alpha1.MappingsRequest]) (*connect_go.Response[v1alpha1.MappingsResponse], error) + // Stacktraces retrieves mappings. + Stacktraces(context.Context, *connect_go.Request[v1alpha1.StacktracesRequest]) (*connect_go.Response[v1alpha1.StacktracesResponse], error) +} + +// NewMetastoreServiceClient constructs a client for the parca.metastore.v1alpha1.MetastoreService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewMetastoreServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) MetastoreServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &metastoreServiceClient{ + getOrCreateMappings: connect_go.NewClient[v1alpha1.GetOrCreateMappingsRequest, v1alpha1.GetOrCreateMappingsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings", + opts..., + ), + getOrCreateFunctions: connect_go.NewClient[v1alpha1.GetOrCreateFunctionsRequest, v1alpha1.GetOrCreateFunctionsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions", + opts..., + ), + getOrCreateLocations: connect_go.NewClient[v1alpha1.GetOrCreateLocationsRequest, v1alpha1.GetOrCreateLocationsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations", + opts..., + ), + getOrCreateStacktraces: connect_go.NewClient[v1alpha1.GetOrCreateStacktracesRequest, v1alpha1.GetOrCreateStacktracesResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces", + opts..., + ), + unsymbolizedLocations: connect_go.NewClient[v1alpha1.UnsymbolizedLocationsRequest, v1alpha1.UnsymbolizedLocationsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations", + opts..., + ), + createLocationLines: connect_go.NewClient[v1alpha1.CreateLocationLinesRequest, v1alpha1.CreateLocationLinesResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines", + opts..., + ), + locations: connect_go.NewClient[v1alpha1.LocationsRequest, v1alpha1.LocationsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/Locations", + opts..., + ), + functions: connect_go.NewClient[v1alpha1.FunctionsRequest, v1alpha1.FunctionsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/Functions", + opts..., + ), + mappings: connect_go.NewClient[v1alpha1.MappingsRequest, v1alpha1.MappingsResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/Mappings", + opts..., + ), + stacktraces: connect_go.NewClient[v1alpha1.StacktracesRequest, v1alpha1.StacktracesResponse]( + httpClient, + baseURL+"/parca.metastore.v1alpha1.MetastoreService/Stacktraces", + opts..., + ), + } +} + +// metastoreServiceClient implements MetastoreServiceClient. +type metastoreServiceClient struct { + getOrCreateMappings *connect_go.Client[v1alpha1.GetOrCreateMappingsRequest, v1alpha1.GetOrCreateMappingsResponse] + getOrCreateFunctions *connect_go.Client[v1alpha1.GetOrCreateFunctionsRequest, v1alpha1.GetOrCreateFunctionsResponse] + getOrCreateLocations *connect_go.Client[v1alpha1.GetOrCreateLocationsRequest, v1alpha1.GetOrCreateLocationsResponse] + getOrCreateStacktraces *connect_go.Client[v1alpha1.GetOrCreateStacktracesRequest, v1alpha1.GetOrCreateStacktracesResponse] + unsymbolizedLocations *connect_go.Client[v1alpha1.UnsymbolizedLocationsRequest, v1alpha1.UnsymbolizedLocationsResponse] + createLocationLines *connect_go.Client[v1alpha1.CreateLocationLinesRequest, v1alpha1.CreateLocationLinesResponse] + locations *connect_go.Client[v1alpha1.LocationsRequest, v1alpha1.LocationsResponse] + functions *connect_go.Client[v1alpha1.FunctionsRequest, v1alpha1.FunctionsResponse] + mappings *connect_go.Client[v1alpha1.MappingsRequest, v1alpha1.MappingsResponse] + stacktraces *connect_go.Client[v1alpha1.StacktracesRequest, v1alpha1.StacktracesResponse] +} + +// GetOrCreateMappings calls parca.metastore.v1alpha1.MetastoreService.GetOrCreateMappings. +func (c *metastoreServiceClient) GetOrCreateMappings(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrCreateMappingsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateMappingsResponse], error) { + return c.getOrCreateMappings.CallUnary(ctx, req) +} + +// GetOrCreateFunctions calls parca.metastore.v1alpha1.MetastoreService.GetOrCreateFunctions. +func (c *metastoreServiceClient) GetOrCreateFunctions(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrCreateFunctionsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateFunctionsResponse], error) { + return c.getOrCreateFunctions.CallUnary(ctx, req) +} + +// GetOrCreateLocations calls parca.metastore.v1alpha1.MetastoreService.GetOrCreateLocations. +func (c *metastoreServiceClient) GetOrCreateLocations(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrCreateLocationsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateLocationsResponse], error) { + return c.getOrCreateLocations.CallUnary(ctx, req) +} + +// GetOrCreateStacktraces calls parca.metastore.v1alpha1.MetastoreService.GetOrCreateStacktraces. +func (c *metastoreServiceClient) GetOrCreateStacktraces(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrCreateStacktracesRequest]) (*connect_go.Response[v1alpha1.GetOrCreateStacktracesResponse], error) { + return c.getOrCreateStacktraces.CallUnary(ctx, req) +} + +// UnsymbolizedLocations calls parca.metastore.v1alpha1.MetastoreService.UnsymbolizedLocations. +func (c *metastoreServiceClient) UnsymbolizedLocations(ctx context.Context, req *connect_go.Request[v1alpha1.UnsymbolizedLocationsRequest]) (*connect_go.Response[v1alpha1.UnsymbolizedLocationsResponse], error) { + return c.unsymbolizedLocations.CallUnary(ctx, req) +} + +// CreateLocationLines calls parca.metastore.v1alpha1.MetastoreService.CreateLocationLines. +func (c *metastoreServiceClient) CreateLocationLines(ctx context.Context, req *connect_go.Request[v1alpha1.CreateLocationLinesRequest]) (*connect_go.Response[v1alpha1.CreateLocationLinesResponse], error) { + return c.createLocationLines.CallUnary(ctx, req) +} + +// Locations calls parca.metastore.v1alpha1.MetastoreService.Locations. +func (c *metastoreServiceClient) Locations(ctx context.Context, req *connect_go.Request[v1alpha1.LocationsRequest]) (*connect_go.Response[v1alpha1.LocationsResponse], error) { + return c.locations.CallUnary(ctx, req) +} + +// Functions calls parca.metastore.v1alpha1.MetastoreService.Functions. +func (c *metastoreServiceClient) Functions(ctx context.Context, req *connect_go.Request[v1alpha1.FunctionsRequest]) (*connect_go.Response[v1alpha1.FunctionsResponse], error) { + return c.functions.CallUnary(ctx, req) +} + +// Mappings calls parca.metastore.v1alpha1.MetastoreService.Mappings. +func (c *metastoreServiceClient) Mappings(ctx context.Context, req *connect_go.Request[v1alpha1.MappingsRequest]) (*connect_go.Response[v1alpha1.MappingsResponse], error) { + return c.mappings.CallUnary(ctx, req) +} + +// Stacktraces calls parca.metastore.v1alpha1.MetastoreService.Stacktraces. +func (c *metastoreServiceClient) Stacktraces(ctx context.Context, req *connect_go.Request[v1alpha1.StacktracesRequest]) (*connect_go.Response[v1alpha1.StacktracesResponse], error) { + return c.stacktraces.CallUnary(ctx, req) +} + +// MetastoreServiceHandler is an implementation of the parca.metastore.v1alpha1.MetastoreService +// service. +type MetastoreServiceHandler interface { + // GetOrCreateMappings checks if the mappings in the request are already + // known and returns the known mapping (including its ID) if so. If a mapping + // does not already exist, it is written to the backing metastore. + GetOrCreateMappings(context.Context, *connect_go.Request[v1alpha1.GetOrCreateMappingsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateMappingsResponse], error) + // GetOrCreateFunctions checks if the functions in the request are already + // known and returns the known function (including its ID) if so. If a + // function does not already exist, it is written to the backing metastore. + GetOrCreateFunctions(context.Context, *connect_go.Request[v1alpha1.GetOrCreateFunctionsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateFunctionsResponse], error) + // GetOrCreateLocations checks if the locations in the request are already + // known and returns the known location (including its ID) if so. If a + // location does not already exist, it is written to the backing metastore. + GetOrCreateLocations(context.Context, *connect_go.Request[v1alpha1.GetOrCreateLocationsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateLocationsResponse], error) + // GetOrCreateStacktraces checks if the stacktraces in the request are + // already known and returns the known stacktrace (including its ID) if so. + // If a stacktrace does not already exist, it is written to the backing + // metastore. + GetOrCreateStacktraces(context.Context, *connect_go.Request[v1alpha1.GetOrCreateStacktracesRequest]) (*connect_go.Response[v1alpha1.GetOrCreateStacktracesResponse], error) + // UnsymbolizedLocations returns locations that can be symbolized but haven't + // been asynchronously symbolized yet. + UnsymbolizedLocations(context.Context, *connect_go.Request[v1alpha1.UnsymbolizedLocationsRequest]) (*connect_go.Response[v1alpha1.UnsymbolizedLocationsResponse], error) + // CreateLocationLines creates the location lines contained in the provided + // locations. + CreateLocationLines(context.Context, *connect_go.Request[v1alpha1.CreateLocationLinesRequest]) (*connect_go.Response[v1alpha1.CreateLocationLinesResponse], error) + // Locations retrieves locations. + Locations(context.Context, *connect_go.Request[v1alpha1.LocationsRequest]) (*connect_go.Response[v1alpha1.LocationsResponse], error) + // Functions retrieves functions. + Functions(context.Context, *connect_go.Request[v1alpha1.FunctionsRequest]) (*connect_go.Response[v1alpha1.FunctionsResponse], error) + // Mappings retrieves mappings. + Mappings(context.Context, *connect_go.Request[v1alpha1.MappingsRequest]) (*connect_go.Response[v1alpha1.MappingsResponse], error) + // Stacktraces retrieves mappings. + Stacktraces(context.Context, *connect_go.Request[v1alpha1.StacktracesRequest]) (*connect_go.Response[v1alpha1.StacktracesResponse], error) +} + +// NewMetastoreServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewMetastoreServiceHandler(svc MetastoreServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateMappings", + svc.GetOrCreateMappings, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateFunctions", + svc.GetOrCreateFunctions, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateLocations", + svc.GetOrCreateLocations, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/GetOrCreateStacktraces", + svc.GetOrCreateStacktraces, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/UnsymbolizedLocations", + svc.UnsymbolizedLocations, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/CreateLocationLines", + svc.CreateLocationLines, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/Locations", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/Locations", + svc.Locations, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/Functions", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/Functions", + svc.Functions, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/Mappings", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/Mappings", + svc.Mappings, + opts..., + )) + mux.Handle("/parca.metastore.v1alpha1.MetastoreService/Stacktraces", connect_go.NewUnaryHandler( + "/parca.metastore.v1alpha1.MetastoreService/Stacktraces", + svc.Stacktraces, + opts..., + )) + return "/parca.metastore.v1alpha1.MetastoreService/", mux +} + +// UnimplementedMetastoreServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedMetastoreServiceHandler struct{} + +func (UnimplementedMetastoreServiceHandler) GetOrCreateMappings(context.Context, *connect_go.Request[v1alpha1.GetOrCreateMappingsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateMappingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.GetOrCreateMappings is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) GetOrCreateFunctions(context.Context, *connect_go.Request[v1alpha1.GetOrCreateFunctionsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateFunctionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.GetOrCreateFunctions is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) GetOrCreateLocations(context.Context, *connect_go.Request[v1alpha1.GetOrCreateLocationsRequest]) (*connect_go.Response[v1alpha1.GetOrCreateLocationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.GetOrCreateLocations is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) GetOrCreateStacktraces(context.Context, *connect_go.Request[v1alpha1.GetOrCreateStacktracesRequest]) (*connect_go.Response[v1alpha1.GetOrCreateStacktracesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.GetOrCreateStacktraces is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) UnsymbolizedLocations(context.Context, *connect_go.Request[v1alpha1.UnsymbolizedLocationsRequest]) (*connect_go.Response[v1alpha1.UnsymbolizedLocationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.UnsymbolizedLocations is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) CreateLocationLines(context.Context, *connect_go.Request[v1alpha1.CreateLocationLinesRequest]) (*connect_go.Response[v1alpha1.CreateLocationLinesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.CreateLocationLines is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) Locations(context.Context, *connect_go.Request[v1alpha1.LocationsRequest]) (*connect_go.Response[v1alpha1.LocationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.Locations is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) Functions(context.Context, *connect_go.Request[v1alpha1.FunctionsRequest]) (*connect_go.Response[v1alpha1.FunctionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.Functions is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) Mappings(context.Context, *connect_go.Request[v1alpha1.MappingsRequest]) (*connect_go.Response[v1alpha1.MappingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.Mappings is not implemented")) +} + +func (UnimplementedMetastoreServiceHandler) Stacktraces(context.Context, *connect_go.Request[v1alpha1.StacktracesRequest]) (*connect_go.Response[v1alpha1.StacktracesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.metastore.v1alpha1.MetastoreService.Stacktraces is not implemented")) +} diff --git a/gen/proto/go/parca/profilestore/v1alpha1/profilestore.pb.gw.go b/gen/proto/go/parca/profilestore/v1alpha1/profilestore.pb.gw.go deleted file mode 100644 index 06b86ac2431..00000000000 --- a/gen/proto/go/parca/profilestore/v1alpha1/profilestore.pb.gw.go +++ /dev/null @@ -1,294 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/profilestore/v1alpha1/profilestore.proto - -/* -Package profilestorev1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package profilestorev1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_ProfileStoreService_WriteRaw_0(ctx context.Context, marshaler runtime.Marshaler, client ProfileStoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq WriteRawRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.WriteRaw(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ProfileStoreService_WriteRaw_0(ctx context.Context, marshaler runtime.Marshaler, server ProfileStoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq WriteRawRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.WriteRaw(ctx, &protoReq) - return msg, metadata, err - -} - -func request_AgentsService_Agents_0(ctx context.Context, marshaler runtime.Marshaler, client AgentsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AgentsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Agents(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_AgentsService_Agents_0(ctx context.Context, marshaler runtime.Marshaler, server AgentsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AgentsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Agents(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterProfileStoreServiceHandlerServer registers the http handlers for service ProfileStoreService to "mux". -// UnaryRPC :call ProfileStoreServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterProfileStoreServiceHandlerFromEndpoint instead. -func RegisterProfileStoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProfileStoreServiceServer) error { - - mux.Handle("POST", pattern_ProfileStoreService_WriteRaw_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.profilestore.v1alpha1.ProfileStoreService/WriteRaw", runtime.WithHTTPPathPattern("/profiles/writeraw")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ProfileStoreService_WriteRaw_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ProfileStoreService_WriteRaw_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterAgentsServiceHandlerServer registers the http handlers for service AgentsService to "mux". -// UnaryRPC :call AgentsServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAgentsServiceHandlerFromEndpoint instead. -func RegisterAgentsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AgentsServiceServer) error { - - mux.Handle("GET", pattern_AgentsService_Agents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.profilestore.v1alpha1.AgentsService/Agents", runtime.WithHTTPPathPattern("/agents")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_AgentsService_Agents_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_AgentsService_Agents_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterProfileStoreServiceHandlerFromEndpoint is same as RegisterProfileStoreServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterProfileStoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterProfileStoreServiceHandler(ctx, mux, conn) -} - -// RegisterProfileStoreServiceHandler registers the http handlers for service ProfileStoreService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterProfileStoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterProfileStoreServiceHandlerClient(ctx, mux, NewProfileStoreServiceClient(conn)) -} - -// RegisterProfileStoreServiceHandlerClient registers the http handlers for service ProfileStoreService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProfileStoreServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProfileStoreServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ProfileStoreServiceClient" to call the correct interceptors. -func RegisterProfileStoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProfileStoreServiceClient) error { - - mux.Handle("POST", pattern_ProfileStoreService_WriteRaw_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.profilestore.v1alpha1.ProfileStoreService/WriteRaw", runtime.WithHTTPPathPattern("/profiles/writeraw")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ProfileStoreService_WriteRaw_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ProfileStoreService_WriteRaw_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_ProfileStoreService_WriteRaw_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "writeraw"}, "")) -) - -var ( - forward_ProfileStoreService_WriteRaw_0 = runtime.ForwardResponseMessage -) - -// RegisterAgentsServiceHandlerFromEndpoint is same as RegisterAgentsServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterAgentsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterAgentsServiceHandler(ctx, mux, conn) -} - -// RegisterAgentsServiceHandler registers the http handlers for service AgentsService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterAgentsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterAgentsServiceHandlerClient(ctx, mux, NewAgentsServiceClient(conn)) -} - -// RegisterAgentsServiceHandlerClient registers the http handlers for service AgentsService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AgentsServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AgentsServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AgentsServiceClient" to call the correct interceptors. -func RegisterAgentsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AgentsServiceClient) error { - - mux.Handle("GET", pattern_AgentsService_Agents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.profilestore.v1alpha1.AgentsService/Agents", runtime.WithHTTPPathPattern("/agents")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_AgentsService_Agents_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_AgentsService_Agents_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_AgentsService_Agents_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"agents"}, "")) -) - -var ( - forward_AgentsService_Agents_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect/profilestore.connect.go b/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect/profilestore.connect.go new file mode 100644 index 00000000000..4a7596cbd70 --- /dev/null +++ b/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect/profilestore.connect.go @@ -0,0 +1,156 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/profilestore/v1alpha1/profilestore.proto + +package profilestorev1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // ProfileStoreServiceName is the fully-qualified name of the ProfileStoreService service. + ProfileStoreServiceName = "parca.profilestore.v1alpha1.ProfileStoreService" + // AgentsServiceName is the fully-qualified name of the AgentsService service. + AgentsServiceName = "parca.profilestore.v1alpha1.AgentsService" +) + +// ProfileStoreServiceClient is a client for the parca.profilestore.v1alpha1.ProfileStoreService +// service. +type ProfileStoreServiceClient interface { + // WriteRaw accepts a raw set of bytes of a pprof file + WriteRaw(context.Context, *connect_go.Request[v1alpha1.WriteRawRequest]) (*connect_go.Response[v1alpha1.WriteRawResponse], error) +} + +// NewProfileStoreServiceClient constructs a client for the +// parca.profilestore.v1alpha1.ProfileStoreService service. By default, it uses the Connect protocol +// with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To +// use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() +// options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewProfileStoreServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ProfileStoreServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &profileStoreServiceClient{ + writeRaw: connect_go.NewClient[v1alpha1.WriteRawRequest, v1alpha1.WriteRawResponse]( + httpClient, + baseURL+"/parca.profilestore.v1alpha1.ProfileStoreService/WriteRaw", + opts..., + ), + } +} + +// profileStoreServiceClient implements ProfileStoreServiceClient. +type profileStoreServiceClient struct { + writeRaw *connect_go.Client[v1alpha1.WriteRawRequest, v1alpha1.WriteRawResponse] +} + +// WriteRaw calls parca.profilestore.v1alpha1.ProfileStoreService.WriteRaw. +func (c *profileStoreServiceClient) WriteRaw(ctx context.Context, req *connect_go.Request[v1alpha1.WriteRawRequest]) (*connect_go.Response[v1alpha1.WriteRawResponse], error) { + return c.writeRaw.CallUnary(ctx, req) +} + +// ProfileStoreServiceHandler is an implementation of the +// parca.profilestore.v1alpha1.ProfileStoreService service. +type ProfileStoreServiceHandler interface { + // WriteRaw accepts a raw set of bytes of a pprof file + WriteRaw(context.Context, *connect_go.Request[v1alpha1.WriteRawRequest]) (*connect_go.Response[v1alpha1.WriteRawResponse], error) +} + +// NewProfileStoreServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewProfileStoreServiceHandler(svc ProfileStoreServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.profilestore.v1alpha1.ProfileStoreService/WriteRaw", connect_go.NewUnaryHandler( + "/parca.profilestore.v1alpha1.ProfileStoreService/WriteRaw", + svc.WriteRaw, + opts..., + )) + return "/parca.profilestore.v1alpha1.ProfileStoreService/", mux +} + +// UnimplementedProfileStoreServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedProfileStoreServiceHandler struct{} + +func (UnimplementedProfileStoreServiceHandler) WriteRaw(context.Context, *connect_go.Request[v1alpha1.WriteRawRequest]) (*connect_go.Response[v1alpha1.WriteRawResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.profilestore.v1alpha1.ProfileStoreService.WriteRaw is not implemented")) +} + +// AgentsServiceClient is a client for the parca.profilestore.v1alpha1.AgentsService service. +type AgentsServiceClient interface { + // Agents return the agents that pushed data to the server + Agents(context.Context, *connect_go.Request[v1alpha1.AgentsRequest]) (*connect_go.Response[v1alpha1.AgentsResponse], error) +} + +// NewAgentsServiceClient constructs a client for the parca.profilestore.v1alpha1.AgentsService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAgentsServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AgentsServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &agentsServiceClient{ + agents: connect_go.NewClient[v1alpha1.AgentsRequest, v1alpha1.AgentsResponse]( + httpClient, + baseURL+"/parca.profilestore.v1alpha1.AgentsService/Agents", + opts..., + ), + } +} + +// agentsServiceClient implements AgentsServiceClient. +type agentsServiceClient struct { + agents *connect_go.Client[v1alpha1.AgentsRequest, v1alpha1.AgentsResponse] +} + +// Agents calls parca.profilestore.v1alpha1.AgentsService.Agents. +func (c *agentsServiceClient) Agents(ctx context.Context, req *connect_go.Request[v1alpha1.AgentsRequest]) (*connect_go.Response[v1alpha1.AgentsResponse], error) { + return c.agents.CallUnary(ctx, req) +} + +// AgentsServiceHandler is an implementation of the parca.profilestore.v1alpha1.AgentsService +// service. +type AgentsServiceHandler interface { + // Agents return the agents that pushed data to the server + Agents(context.Context, *connect_go.Request[v1alpha1.AgentsRequest]) (*connect_go.Response[v1alpha1.AgentsResponse], error) +} + +// NewAgentsServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAgentsServiceHandler(svc AgentsServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.profilestore.v1alpha1.AgentsService/Agents", connect_go.NewUnaryHandler( + "/parca.profilestore.v1alpha1.AgentsService/Agents", + svc.Agents, + opts..., + )) + return "/parca.profilestore.v1alpha1.AgentsService/", mux +} + +// UnimplementedAgentsServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAgentsServiceHandler struct{} + +func (UnimplementedAgentsServiceHandler) Agents(context.Context, *connect_go.Request[v1alpha1.AgentsRequest]) (*connect_go.Response[v1alpha1.AgentsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.profilestore.v1alpha1.AgentsService.Agents is not implemented")) +} diff --git a/gen/proto/go/parca/query/v1alpha1/query.pb.gw.go b/gen/proto/go/parca/query/v1alpha1/query.pb.gw.go deleted file mode 100644 index ba8e5b3b595..00000000000 --- a/gen/proto/go/parca/query/v1alpha1/query.pb.gw.go +++ /dev/null @@ -1,709 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/query/v1alpha1/query.proto - -/* -Package queryv1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package queryv1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -var ( - filter_QueryService_QueryRange_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_QueryService_QueryRange_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRangeRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_QueryRange_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.QueryRange(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_QueryRange_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRangeRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_QueryRange_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.QueryRange(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_QueryService_Query_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_QueryService_Query_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Query_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Query(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_Query_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Query_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Query(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_QueryService_Series_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_QueryService_Series_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq SeriesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Series_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Series(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_Series_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq SeriesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Series_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Series(ctx, &protoReq) - return msg, metadata, err - -} - -func request_QueryService_ProfileTypes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ProfileTypesRequest - var metadata runtime.ServerMetadata - - msg, err := client.ProfileTypes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_ProfileTypes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ProfileTypesRequest - var metadata runtime.ServerMetadata - - msg, err := server.ProfileTypes(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_QueryService_Labels_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_QueryService_Labels_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LabelsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Labels_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Labels(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_Labels_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LabelsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Labels_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Labels(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_QueryService_Values_0 = &utilities.DoubleArray{Encoding: map[string]int{"label_name": 0, "labelName": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} -) - -func request_QueryService_Values_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ValuesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["label_name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label_name") - } - - protoReq.LabelName, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label_name", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Values_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Values(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_Values_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ValuesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["label_name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label_name") - } - - protoReq.LabelName, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label_name", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Values_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Values(ctx, &protoReq) - return msg, metadata, err - -} - -func request_QueryService_ShareProfile_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ShareProfileRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ShareProfile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_ShareProfile_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ShareProfileRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ShareProfile(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryServiceHandlerServer registers the http handlers for service QueryService to "mux". -// UnaryRPC :call QueryServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryServiceHandlerFromEndpoint instead. -func RegisterQueryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServiceServer) error { - - mux.Handle("GET", pattern_QueryService_QueryRange_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/QueryRange", runtime.WithHTTPPathPattern("/profiles/query_range")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_QueryRange_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_QueryRange_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Query", runtime.WithHTTPPathPattern("/profiles/query")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_Query_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Query_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Series_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Series", runtime.WithHTTPPathPattern("/profiles/series")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_Series_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Series_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_ProfileTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/ProfileTypes", runtime.WithHTTPPathPattern("/profiles/types")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_ProfileTypes_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_ProfileTypes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Labels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Labels", runtime.WithHTTPPathPattern("/profiles/labels")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_Labels_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Labels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Values_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Values", runtime.WithHTTPPathPattern("/profiles/labels/{label_name}/values")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_Values_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Values_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_QueryService_ShareProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/ShareProfile", runtime.WithHTTPPathPattern("/profiles/share")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_ShareProfile_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_ShareProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryServiceHandlerFromEndpoint is same as RegisterQueryServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryServiceHandler(ctx, mux, conn) -} - -// RegisterQueryServiceHandler registers the http handlers for service QueryService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryServiceHandlerClient(ctx, mux, NewQueryServiceClient(conn)) -} - -// RegisterQueryServiceHandlerClient registers the http handlers for service QueryService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryServiceClient" to call the correct interceptors. -func RegisterQueryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryServiceClient) error { - - mux.Handle("GET", pattern_QueryService_QueryRange_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/QueryRange", runtime.WithHTTPPathPattern("/profiles/query_range")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_QueryRange_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_QueryRange_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Query", runtime.WithHTTPPathPattern("/profiles/query")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_Query_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Query_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Series_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Series", runtime.WithHTTPPathPattern("/profiles/series")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_Series_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Series_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_ProfileTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/ProfileTypes", runtime.WithHTTPPathPattern("/profiles/types")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_ProfileTypes_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_ProfileTypes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Labels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Labels", runtime.WithHTTPPathPattern("/profiles/labels")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_Labels_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Labels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryService_Values_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/Values", runtime.WithHTTPPathPattern("/profiles/labels/{label_name}/values")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_Values_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Values_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_QueryService_ShareProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.query.v1alpha1.QueryService/ShareProfile", runtime.WithHTTPPathPattern("/profiles/share")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_ShareProfile_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_ShareProfile_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_QueryService_QueryRange_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "query_range"}, "")) - - pattern_QueryService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "query"}, "")) - - pattern_QueryService_Series_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "series"}, "")) - - pattern_QueryService_ProfileTypes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "types"}, "")) - - pattern_QueryService_Labels_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "labels"}, "")) - - pattern_QueryService_Values_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"profiles", "labels", "label_name", "values"}, "")) - - pattern_QueryService_ShareProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"profiles", "share"}, "")) -) - -var ( - forward_QueryService_QueryRange_0 = runtime.ForwardResponseMessage - - forward_QueryService_Query_0 = runtime.ForwardResponseMessage - - forward_QueryService_Series_0 = runtime.ForwardResponseMessage - - forward_QueryService_ProfileTypes_0 = runtime.ForwardResponseMessage - - forward_QueryService_Labels_0 = runtime.ForwardResponseMessage - - forward_QueryService_Values_0 = runtime.ForwardResponseMessage - - forward_QueryService_ShareProfile_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/query/v1alpha1/queryv1alpha1connect/query.connect.go b/gen/proto/go/parca/query/v1alpha1/queryv1alpha1connect/query.connect.go new file mode 100644 index 00000000000..bd50f2ab74c --- /dev/null +++ b/gen/proto/go/parca/query/v1alpha1/queryv1alpha1connect/query.connect.go @@ -0,0 +1,232 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/query/v1alpha1/query.proto + +package queryv1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/query/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // QueryServiceName is the fully-qualified name of the QueryService service. + QueryServiceName = "parca.query.v1alpha1.QueryService" +) + +// QueryServiceClient is a client for the parca.query.v1alpha1.QueryService service. +type QueryServiceClient interface { + // QueryRange performs a profile query over a time range + QueryRange(context.Context, *connect_go.Request[v1alpha1.QueryRangeRequest]) (*connect_go.Response[v1alpha1.QueryRangeResponse], error) + // Query performs a profile query + Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) + // Series is unimplemented + Series(context.Context, *connect_go.Request[v1alpha1.SeriesRequest]) (*connect_go.Response[v1alpha1.SeriesResponse], error) + // ProfileTypes returns the list of available profile types. + ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) + // Labels returns the set of label names against a given matching string and time frame + Labels(context.Context, *connect_go.Request[v1alpha1.LabelsRequest]) (*connect_go.Response[v1alpha1.LabelsResponse], error) + // Values returns the set of values that match a given label and time frame + Values(context.Context, *connect_go.Request[v1alpha1.ValuesRequest]) (*connect_go.Response[v1alpha1.ValuesResponse], error) + // ShareProfile uploads the given profile to pprof.me and returns a link to the profile. + ShareProfile(context.Context, *connect_go.Request[v1alpha1.ShareProfileRequest]) (*connect_go.Response[v1alpha1.ShareProfileResponse], error) +} + +// NewQueryServiceClient constructs a client for the parca.query.v1alpha1.QueryService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewQueryServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) QueryServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &queryServiceClient{ + queryRange: connect_go.NewClient[v1alpha1.QueryRangeRequest, v1alpha1.QueryRangeResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/QueryRange", + opts..., + ), + query: connect_go.NewClient[v1alpha1.QueryRequest, v1alpha1.QueryResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/Query", + opts..., + ), + series: connect_go.NewClient[v1alpha1.SeriesRequest, v1alpha1.SeriesResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/Series", + opts..., + ), + profileTypes: connect_go.NewClient[v1alpha1.ProfileTypesRequest, v1alpha1.ProfileTypesResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/ProfileTypes", + opts..., + ), + labels: connect_go.NewClient[v1alpha1.LabelsRequest, v1alpha1.LabelsResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/Labels", + opts..., + ), + values: connect_go.NewClient[v1alpha1.ValuesRequest, v1alpha1.ValuesResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/Values", + opts..., + ), + shareProfile: connect_go.NewClient[v1alpha1.ShareProfileRequest, v1alpha1.ShareProfileResponse]( + httpClient, + baseURL+"/parca.query.v1alpha1.QueryService/ShareProfile", + opts..., + ), + } +} + +// queryServiceClient implements QueryServiceClient. +type queryServiceClient struct { + queryRange *connect_go.Client[v1alpha1.QueryRangeRequest, v1alpha1.QueryRangeResponse] + query *connect_go.Client[v1alpha1.QueryRequest, v1alpha1.QueryResponse] + series *connect_go.Client[v1alpha1.SeriesRequest, v1alpha1.SeriesResponse] + profileTypes *connect_go.Client[v1alpha1.ProfileTypesRequest, v1alpha1.ProfileTypesResponse] + labels *connect_go.Client[v1alpha1.LabelsRequest, v1alpha1.LabelsResponse] + values *connect_go.Client[v1alpha1.ValuesRequest, v1alpha1.ValuesResponse] + shareProfile *connect_go.Client[v1alpha1.ShareProfileRequest, v1alpha1.ShareProfileResponse] +} + +// QueryRange calls parca.query.v1alpha1.QueryService.QueryRange. +func (c *queryServiceClient) QueryRange(ctx context.Context, req *connect_go.Request[v1alpha1.QueryRangeRequest]) (*connect_go.Response[v1alpha1.QueryRangeResponse], error) { + return c.queryRange.CallUnary(ctx, req) +} + +// Query calls parca.query.v1alpha1.QueryService.Query. +func (c *queryServiceClient) Query(ctx context.Context, req *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) { + return c.query.CallUnary(ctx, req) +} + +// Series calls parca.query.v1alpha1.QueryService.Series. +func (c *queryServiceClient) Series(ctx context.Context, req *connect_go.Request[v1alpha1.SeriesRequest]) (*connect_go.Response[v1alpha1.SeriesResponse], error) { + return c.series.CallUnary(ctx, req) +} + +// ProfileTypes calls parca.query.v1alpha1.QueryService.ProfileTypes. +func (c *queryServiceClient) ProfileTypes(ctx context.Context, req *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) { + return c.profileTypes.CallUnary(ctx, req) +} + +// Labels calls parca.query.v1alpha1.QueryService.Labels. +func (c *queryServiceClient) Labels(ctx context.Context, req *connect_go.Request[v1alpha1.LabelsRequest]) (*connect_go.Response[v1alpha1.LabelsResponse], error) { + return c.labels.CallUnary(ctx, req) +} + +// Values calls parca.query.v1alpha1.QueryService.Values. +func (c *queryServiceClient) Values(ctx context.Context, req *connect_go.Request[v1alpha1.ValuesRequest]) (*connect_go.Response[v1alpha1.ValuesResponse], error) { + return c.values.CallUnary(ctx, req) +} + +// ShareProfile calls parca.query.v1alpha1.QueryService.ShareProfile. +func (c *queryServiceClient) ShareProfile(ctx context.Context, req *connect_go.Request[v1alpha1.ShareProfileRequest]) (*connect_go.Response[v1alpha1.ShareProfileResponse], error) { + return c.shareProfile.CallUnary(ctx, req) +} + +// QueryServiceHandler is an implementation of the parca.query.v1alpha1.QueryService service. +type QueryServiceHandler interface { + // QueryRange performs a profile query over a time range + QueryRange(context.Context, *connect_go.Request[v1alpha1.QueryRangeRequest]) (*connect_go.Response[v1alpha1.QueryRangeResponse], error) + // Query performs a profile query + Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) + // Series is unimplemented + Series(context.Context, *connect_go.Request[v1alpha1.SeriesRequest]) (*connect_go.Response[v1alpha1.SeriesResponse], error) + // ProfileTypes returns the list of available profile types. + ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) + // Labels returns the set of label names against a given matching string and time frame + Labels(context.Context, *connect_go.Request[v1alpha1.LabelsRequest]) (*connect_go.Response[v1alpha1.LabelsResponse], error) + // Values returns the set of values that match a given label and time frame + Values(context.Context, *connect_go.Request[v1alpha1.ValuesRequest]) (*connect_go.Response[v1alpha1.ValuesResponse], error) + // ShareProfile uploads the given profile to pprof.me and returns a link to the profile. + ShareProfile(context.Context, *connect_go.Request[v1alpha1.ShareProfileRequest]) (*connect_go.Response[v1alpha1.ShareProfileResponse], error) +} + +// NewQueryServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewQueryServiceHandler(svc QueryServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.query.v1alpha1.QueryService/QueryRange", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/QueryRange", + svc.QueryRange, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/Query", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/Query", + svc.Query, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/Series", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/Series", + svc.Series, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/ProfileTypes", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/ProfileTypes", + svc.ProfileTypes, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/Labels", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/Labels", + svc.Labels, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/Values", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/Values", + svc.Values, + opts..., + )) + mux.Handle("/parca.query.v1alpha1.QueryService/ShareProfile", connect_go.NewUnaryHandler( + "/parca.query.v1alpha1.QueryService/ShareProfile", + svc.ShareProfile, + opts..., + )) + return "/parca.query.v1alpha1.QueryService/", mux +} + +// UnimplementedQueryServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedQueryServiceHandler struct{} + +func (UnimplementedQueryServiceHandler) QueryRange(context.Context, *connect_go.Request[v1alpha1.QueryRangeRequest]) (*connect_go.Response[v1alpha1.QueryRangeResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.QueryRange is not implemented")) +} + +func (UnimplementedQueryServiceHandler) Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.Query is not implemented")) +} + +func (UnimplementedQueryServiceHandler) Series(context.Context, *connect_go.Request[v1alpha1.SeriesRequest]) (*connect_go.Response[v1alpha1.SeriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.Series is not implemented")) +} + +func (UnimplementedQueryServiceHandler) ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.ProfileTypes is not implemented")) +} + +func (UnimplementedQueryServiceHandler) Labels(context.Context, *connect_go.Request[v1alpha1.LabelsRequest]) (*connect_go.Response[v1alpha1.LabelsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.Labels is not implemented")) +} + +func (UnimplementedQueryServiceHandler) Values(context.Context, *connect_go.Request[v1alpha1.ValuesRequest]) (*connect_go.Response[v1alpha1.ValuesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.Values is not implemented")) +} + +func (UnimplementedQueryServiceHandler) ShareProfile(context.Context, *connect_go.Request[v1alpha1.ShareProfileRequest]) (*connect_go.Response[v1alpha1.ShareProfileResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.query.v1alpha1.QueryService.ShareProfile is not implemented")) +} diff --git a/gen/proto/go/parca/scrape/v1alpha1/scrape.pb.gw.go b/gen/proto/go/parca/scrape/v1alpha1/scrape.pb.gw.go deleted file mode 100644 index 2e8f85d6654..00000000000 --- a/gen/proto/go/parca/scrape/v1alpha1/scrape.pb.gw.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/scrape/v1alpha1/scrape.proto - -/* -Package scrapev1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package scrapev1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -var ( - filter_ScrapeService_Targets_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_ScrapeService_Targets_0(ctx context.Context, marshaler runtime.Marshaler, client ScrapeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TargetsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ScrapeService_Targets_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Targets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ScrapeService_Targets_0(ctx context.Context, marshaler runtime.Marshaler, server ScrapeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TargetsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ScrapeService_Targets_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Targets(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterScrapeServiceHandlerServer registers the http handlers for service ScrapeService to "mux". -// UnaryRPC :call ScrapeServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterScrapeServiceHandlerFromEndpoint instead. -func RegisterScrapeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScrapeServiceServer) error { - - mux.Handle("GET", pattern_ScrapeService_Targets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.scrape.v1alpha1.ScrapeService/Targets", runtime.WithHTTPPathPattern("/targets")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ScrapeService_Targets_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ScrapeService_Targets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterScrapeServiceHandlerFromEndpoint is same as RegisterScrapeServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterScrapeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterScrapeServiceHandler(ctx, mux, conn) -} - -// RegisterScrapeServiceHandler registers the http handlers for service ScrapeService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterScrapeServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterScrapeServiceHandlerClient(ctx, mux, NewScrapeServiceClient(conn)) -} - -// RegisterScrapeServiceHandlerClient registers the http handlers for service ScrapeService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ScrapeServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ScrapeServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ScrapeServiceClient" to call the correct interceptors. -func RegisterScrapeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ScrapeServiceClient) error { - - mux.Handle("GET", pattern_ScrapeService_Targets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.scrape.v1alpha1.ScrapeService/Targets", runtime.WithHTTPPathPattern("/targets")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ScrapeService_Targets_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ScrapeService_Targets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_ScrapeService_Targets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"targets"}, "")) -) - -var ( - forward_ScrapeService_Targets_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/scrape/v1alpha1/scrapev1alpha1connect/scrape.connect.go b/gen/proto/go/parca/scrape/v1alpha1/scrapev1alpha1connect/scrape.connect.go new file mode 100644 index 00000000000..872d8eff262 --- /dev/null +++ b/gen/proto/go/parca/scrape/v1alpha1/scrapev1alpha1connect/scrape.connect.go @@ -0,0 +1,88 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/scrape/v1alpha1/scrape.proto + +package scrapev1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/scrape/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // ScrapeServiceName is the fully-qualified name of the ScrapeService service. + ScrapeServiceName = "parca.scrape.v1alpha1.ScrapeService" +) + +// ScrapeServiceClient is a client for the parca.scrape.v1alpha1.ScrapeService service. +type ScrapeServiceClient interface { + // Targets returns the set of scrape targets that are configured + Targets(context.Context, *connect_go.Request[v1alpha1.TargetsRequest]) (*connect_go.Response[v1alpha1.TargetsResponse], error) +} + +// NewScrapeServiceClient constructs a client for the parca.scrape.v1alpha1.ScrapeService service. +// By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped +// responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewScrapeServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ScrapeServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &scrapeServiceClient{ + targets: connect_go.NewClient[v1alpha1.TargetsRequest, v1alpha1.TargetsResponse]( + httpClient, + baseURL+"/parca.scrape.v1alpha1.ScrapeService/Targets", + opts..., + ), + } +} + +// scrapeServiceClient implements ScrapeServiceClient. +type scrapeServiceClient struct { + targets *connect_go.Client[v1alpha1.TargetsRequest, v1alpha1.TargetsResponse] +} + +// Targets calls parca.scrape.v1alpha1.ScrapeService.Targets. +func (c *scrapeServiceClient) Targets(ctx context.Context, req *connect_go.Request[v1alpha1.TargetsRequest]) (*connect_go.Response[v1alpha1.TargetsResponse], error) { + return c.targets.CallUnary(ctx, req) +} + +// ScrapeServiceHandler is an implementation of the parca.scrape.v1alpha1.ScrapeService service. +type ScrapeServiceHandler interface { + // Targets returns the set of scrape targets that are configured + Targets(context.Context, *connect_go.Request[v1alpha1.TargetsRequest]) (*connect_go.Response[v1alpha1.TargetsResponse], error) +} + +// NewScrapeServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewScrapeServiceHandler(svc ScrapeServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.scrape.v1alpha1.ScrapeService/Targets", connect_go.NewUnaryHandler( + "/parca.scrape.v1alpha1.ScrapeService/Targets", + svc.Targets, + opts..., + )) + return "/parca.scrape.v1alpha1.ScrapeService/", mux +} + +// UnimplementedScrapeServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedScrapeServiceHandler struct{} + +func (UnimplementedScrapeServiceHandler) Targets(context.Context, *connect_go.Request[v1alpha1.TargetsRequest]) (*connect_go.Response[v1alpha1.TargetsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.scrape.v1alpha1.ScrapeService.Targets is not implemented")) +} diff --git a/gen/proto/go/parca/share/v1alpha1/share.pb.gw.go b/gen/proto/go/parca/share/v1alpha1/share.pb.gw.go deleted file mode 100644 index 00d98e094bf..00000000000 --- a/gen/proto/go/parca/share/v1alpha1/share.pb.gw.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: parca/share/v1alpha1/share.proto - -/* -Package sharev1alpha1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package sharev1alpha1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_ShareService_Upload_0(ctx context.Context, marshaler runtime.Marshaler, client ShareServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Upload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ShareService_Upload_0(ctx context.Context, marshaler runtime.Marshaler, server ShareServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UploadRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Upload(ctx, &protoReq) - return msg, metadata, err - -} - -func request_ShareService_Query_0(ctx context.Context, marshaler runtime.Marshaler, client ShareServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Query(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ShareService_Query_0(ctx context.Context, marshaler runtime.Marshaler, server ShareServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Query(ctx, &protoReq) - return msg, metadata, err - -} - -func request_ShareService_ProfileTypes_0(ctx context.Context, marshaler runtime.Marshaler, client ShareServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ProfileTypesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ProfileTypes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ShareService_ProfileTypes_0(ctx context.Context, marshaler runtime.Marshaler, server ShareServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ProfileTypesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ProfileTypes(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterShareServiceHandlerServer registers the http handlers for service ShareService to "mux". -// UnaryRPC :call ShareServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterShareServiceHandlerFromEndpoint instead. -func RegisterShareServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShareServiceServer) error { - - mux.Handle("POST", pattern_ShareService_Upload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/Upload", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/Upload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ShareService_Upload_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_Upload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_ShareService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/Query", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/Query")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ShareService_Query_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_Query_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_ShareService_ProfileTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/ProfileTypes", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/ProfileTypes")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ShareService_ProfileTypes_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_ProfileTypes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterShareServiceHandlerFromEndpoint is same as RegisterShareServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterShareServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterShareServiceHandler(ctx, mux, conn) -} - -// RegisterShareServiceHandler registers the http handlers for service ShareService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterShareServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterShareServiceHandlerClient(ctx, mux, NewShareServiceClient(conn)) -} - -// RegisterShareServiceHandlerClient registers the http handlers for service ShareService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ShareServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ShareServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ShareServiceClient" to call the correct interceptors. -func RegisterShareServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShareServiceClient) error { - - mux.Handle("POST", pattern_ShareService_Upload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/Upload", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/Upload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ShareService_Upload_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_Upload_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_ShareService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/Query", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/Query")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ShareService_Query_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_Query_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_ShareService_ProfileTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/parca.share.v1alpha1.ShareService/ProfileTypes", runtime.WithHTTPPathPattern("/parca.share.v1alpha1.ShareService/ProfileTypes")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ShareService_ProfileTypes_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_ShareService_ProfileTypes_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_ShareService_Upload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.share.v1alpha1.ShareService", "Upload"}, "")) - - pattern_ShareService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.share.v1alpha1.ShareService", "Query"}, "")) - - pattern_ShareService_ProfileTypes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"parca.share.v1alpha1.ShareService", "ProfileTypes"}, "")) -) - -var ( - forward_ShareService_Upload_0 = runtime.ForwardResponseMessage - - forward_ShareService_Query_0 = runtime.ForwardResponseMessage - - forward_ShareService_ProfileTypes_0 = runtime.ForwardResponseMessage -) diff --git a/gen/proto/go/parca/share/v1alpha1/sharev1alpha1connect/share.connect.go b/gen/proto/go/parca/share/v1alpha1/sharev1alpha1connect/share.connect.go new file mode 100644 index 00000000000..e052caa012c --- /dev/null +++ b/gen/proto/go/parca/share/v1alpha1/sharev1alpha1connect/share.connect.go @@ -0,0 +1,136 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: parca/share/v1alpha1/share.proto + +package sharev1alpha1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/share/v1alpha1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // ShareServiceName is the fully-qualified name of the ShareService service. + ShareServiceName = "parca.share.v1alpha1.ShareService" +) + +// ShareServiceClient is a client for the parca.share.v1alpha1.ShareService service. +type ShareServiceClient interface { + // Uploads the profile and returns the link that can be used to access it. + Upload(context.Context, *connect_go.Request[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) + // Query performs a profile query + Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) + // ProfileTypes returns the list of available profile types. + ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) +} + +// NewShareServiceClient constructs a client for the parca.share.v1alpha1.ShareService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewShareServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ShareServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &shareServiceClient{ + upload: connect_go.NewClient[v1alpha1.UploadRequest, v1alpha1.UploadResponse]( + httpClient, + baseURL+"/parca.share.v1alpha1.ShareService/Upload", + opts..., + ), + query: connect_go.NewClient[v1alpha1.QueryRequest, v1alpha1.QueryResponse]( + httpClient, + baseURL+"/parca.share.v1alpha1.ShareService/Query", + opts..., + ), + profileTypes: connect_go.NewClient[v1alpha1.ProfileTypesRequest, v1alpha1.ProfileTypesResponse]( + httpClient, + baseURL+"/parca.share.v1alpha1.ShareService/ProfileTypes", + opts..., + ), + } +} + +// shareServiceClient implements ShareServiceClient. +type shareServiceClient struct { + upload *connect_go.Client[v1alpha1.UploadRequest, v1alpha1.UploadResponse] + query *connect_go.Client[v1alpha1.QueryRequest, v1alpha1.QueryResponse] + profileTypes *connect_go.Client[v1alpha1.ProfileTypesRequest, v1alpha1.ProfileTypesResponse] +} + +// Upload calls parca.share.v1alpha1.ShareService.Upload. +func (c *shareServiceClient) Upload(ctx context.Context, req *connect_go.Request[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) { + return c.upload.CallUnary(ctx, req) +} + +// Query calls parca.share.v1alpha1.ShareService.Query. +func (c *shareServiceClient) Query(ctx context.Context, req *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) { + return c.query.CallUnary(ctx, req) +} + +// ProfileTypes calls parca.share.v1alpha1.ShareService.ProfileTypes. +func (c *shareServiceClient) ProfileTypes(ctx context.Context, req *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) { + return c.profileTypes.CallUnary(ctx, req) +} + +// ShareServiceHandler is an implementation of the parca.share.v1alpha1.ShareService service. +type ShareServiceHandler interface { + // Uploads the profile and returns the link that can be used to access it. + Upload(context.Context, *connect_go.Request[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) + // Query performs a profile query + Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) + // ProfileTypes returns the list of available profile types. + ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) +} + +// NewShareServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewShareServiceHandler(svc ShareServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + mux := http.NewServeMux() + mux.Handle("/parca.share.v1alpha1.ShareService/Upload", connect_go.NewUnaryHandler( + "/parca.share.v1alpha1.ShareService/Upload", + svc.Upload, + opts..., + )) + mux.Handle("/parca.share.v1alpha1.ShareService/Query", connect_go.NewUnaryHandler( + "/parca.share.v1alpha1.ShareService/Query", + svc.Query, + opts..., + )) + mux.Handle("/parca.share.v1alpha1.ShareService/ProfileTypes", connect_go.NewUnaryHandler( + "/parca.share.v1alpha1.ShareService/ProfileTypes", + svc.ProfileTypes, + opts..., + )) + return "/parca.share.v1alpha1.ShareService/", mux +} + +// UnimplementedShareServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedShareServiceHandler struct{} + +func (UnimplementedShareServiceHandler) Upload(context.Context, *connect_go.Request[v1alpha1.UploadRequest]) (*connect_go.Response[v1alpha1.UploadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.share.v1alpha1.ShareService.Upload is not implemented")) +} + +func (UnimplementedShareServiceHandler) Query(context.Context, *connect_go.Request[v1alpha1.QueryRequest]) (*connect_go.Response[v1alpha1.QueryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.share.v1alpha1.ShareService.Query is not implemented")) +} + +func (UnimplementedShareServiceHandler) ProfileTypes(context.Context, *connect_go.Request[v1alpha1.ProfileTypesRequest]) (*connect_go.Response[v1alpha1.ProfileTypesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("parca.share.v1alpha1.ShareService.ProfileTypes is not implemented")) +} diff --git a/gen/proto/swagger/google/api/annotations.swagger.json b/gen/proto/swagger/google/api/annotations.swagger.json deleted file mode 100644 index ff4c7daf0b4..00000000000 --- a/gen/proto/swagger/google/api/annotations.swagger.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "google/api/annotations.proto", - "version": "version not set" - }, - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - } - } -} diff --git a/gen/proto/swagger/google/api/http.swagger.json b/gen/proto/swagger/google/api/http.swagger.json deleted file mode 100644 index 8022c679139..00000000000 --- a/gen/proto/swagger/google/api/http.swagger.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "google/api/http.proto", - "version": "version not set" - }, - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - } - } -} diff --git a/gen/proto/swagger/grpc/health/v1/health.swagger.json b/gen/proto/swagger/grpc/health/v1/health.swagger.json deleted file mode 100644 index e66fb189ac8..00000000000 --- a/gen/proto/swagger/grpc/health/v1/health.swagger.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "grpc/health/v1/health.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "Health" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "HealthCheckResponseServingStatus": { - "type": "string", - "enum": [ - "UNKNOWN", - "SERVING", - "NOT_SERVING", - "SERVICE_UNKNOWN" - ], - "default": "UNKNOWN", - "description": " - SERVICE_UNKNOWN: Used only by the Watch method." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1HealthCheckResponse": { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/HealthCheckResponseServingStatus" - } - } - } - } -} diff --git a/gen/proto/swagger/parca/debuginfo/v1alpha1/debuginfo.swagger.json b/gen/proto/swagger/parca/debuginfo/v1alpha1/debuginfo.swagger.json deleted file mode 100644 index 05827d1cadf..00000000000 --- a/gen/proto/swagger/parca/debuginfo/v1alpha1/debuginfo.swagger.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/debuginfo/v1alpha1/debuginfo.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "DebuginfoService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "UploadInstructionsUploadStrategy": { - "type": "string", - "enum": [ - "UPLOAD_STRATEGY_UNSPECIFIED", - "UPLOAD_STRATEGY_GRPC", - "UPLOAD_STRATEGY_SIGNED_URL" - ], - "default": "UPLOAD_STRATEGY_UNSPECIFIED", - "description": "The strategy to use for uploading.\n\n - UPLOAD_STRATEGY_UNSPECIFIED: The upload is not allowed.\n - UPLOAD_STRATEGY_GRPC: The upload is allowed and should be done via the Upload RPC.\n - UPLOAD_STRATEGY_SIGNED_URL: The upload is allowed and should be done via a returned signed URL." - }, - "parcadebuginfov1alpha1UploadResponse": { - "type": "object", - "properties": { - "buildId": { - "type": "string", - "title": "build_id is a unique identifier for the debug data" - }, - "size": { - "type": "string", - "format": "uint64", - "title": "size is the number of bytes of the debug info" - } - }, - "title": "UploadResponse returns the build_id and the size of the uploaded debug info" - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1InitiateUploadResponse": { - "type": "object", - "properties": { - "uploadInstructions": { - "$ref": "#/definitions/v1alpha1UploadInstructions", - "description": "UploadInstructions contains the instructions for the client to upload the debuginfo." - } - }, - "description": "InitiateUploadResponse is the response to an InitiateUploadRequest." - }, - "v1alpha1MarkUploadFinishedResponse": { - "type": "object", - "description": "MarkUploadFinishedResponse is the response to a MarkUploadFinishedRequest." - }, - "v1alpha1ShouldInitiateUploadResponse": { - "type": "object", - "properties": { - "shouldInitiateUpload": { - "type": "boolean", - "description": "Whether an upload should be initiated or not." - }, - "reason": { - "type": "string", - "description": "Reason for why an upload should be initiated or not." - } - }, - "description": "ShouldInitiateUploadResponse is the response for ShouldInitiateUpload." - }, - "v1alpha1UploadInfo": { - "type": "object", - "properties": { - "buildId": { - "type": "string", - "title": "build_id is a unique identifier for the debug data" - }, - "uploadId": { - "type": "string", - "title": "upload_id is a unique identifier for the upload" - } - }, - "title": "UploadInfo contains the build_id and other metadata for the debug data" - }, - "v1alpha1UploadInstructions": { - "type": "object", - "properties": { - "buildId": { - "type": "string", - "description": "The build ID of the debuginfo to upload." - }, - "uploadId": { - "type": "string", - "description": "The upload_id to use for uploading." - }, - "uploadStrategy": { - "$ref": "#/definitions/UploadInstructionsUploadStrategy", - "description": "The strategy to use for uploading." - }, - "signedUrl": { - "type": "string", - "description": "The signed url to use for uploading using a PUT request when the upload\nstrategy is SIGNED_STRATEGY_URL." - } - }, - "description": "UploadInstructions contains the instructions for the client to upload debuginfo." - } - } -} diff --git a/gen/proto/swagger/parca/metastore/v1alpha1/metastore.swagger.json b/gen/proto/swagger/parca/metastore/v1alpha1/metastore.swagger.json deleted file mode 100644 index 85e4bc33f43..00000000000 --- a/gen/proto/swagger/parca/metastore/v1alpha1/metastore.swagger.json +++ /dev/null @@ -1,357 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/metastore/v1alpha1/metastore.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "MetastoreService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "metastorev1alpha1Function": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the function." - }, - "startLine": { - "type": "string", - "format": "int64", - "description": "start_line is the line number in the source file of the first line of the function." - }, - "name": { - "type": "string", - "description": "name is the name of the function." - }, - "systemName": { - "type": "string", - "description": "system_name describes the name of the function, as identified by the\nsystem. For instance, it can be a C++ mangled name." - }, - "filename": { - "type": "string", - "description": "filename is the name of the source file of the function." - }, - "nameStringIndex": { - "type": "integer", - "format": "int64", - "description": "name_string_index is the index in the string table to the name associated with the function." - }, - "systemNameStringIndex": { - "type": "integer", - "format": "int64", - "description": "system_name_string_index is the index in the string table to the system_name associated with the function." - }, - "filenameStringIndex": { - "type": "integer", - "format": "int64", - "description": "filename_string_index is the index in the string table to the filename associated with the function." - } - }, - "description": "Function describes metadata of a source code function." - }, - "metastorev1alpha1Line": { - "type": "object", - "properties": { - "functionId": { - "type": "string", - "description": "function_id is the ID of the function." - }, - "line": { - "type": "string", - "format": "int64", - "description": "line is the line number in the source file of the referenced function." - }, - "functionIndex": { - "type": "integer", - "format": "int64", - "description": "function_index is the index in the functions table." - } - }, - "description": "Line describes a source code function and its line number." - }, - "metastorev1alpha1Location": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the location." - }, - "address": { - "type": "string", - "format": "uint64", - "description": "address is the memory address of the location if present." - }, - "mappingId": { - "type": "string", - "description": "mapping_id is the unique identifier for the mapping associated with the location." - }, - "isFolded": { - "type": "boolean", - "description": "is_folded indicates whether the location is folded into the previous location." - }, - "lines": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Line" - }, - "description": "lines are the call frames represented by this location. Multiple lines\nindicate they have been inlined." - }, - "mappingIndex": { - "type": "integer", - "format": "int64", - "description": "mapping_index has the index into the mapping table where mappings are sent deduplicated." - } - }, - "description": "Location describes a single location of a stack traces." - }, - "metastorev1alpha1Mapping": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the mapping." - }, - "start": { - "type": "string", - "format": "uint64", - "description": "start is the start address of the mapping." - }, - "limit": { - "type": "string", - "format": "uint64", - "description": "limit is the length of the address space of the mapping." - }, - "offset": { - "type": "string", - "format": "uint64", - "description": "offset in the binary that corresponds to the first mapped address." - }, - "file": { - "type": "string", - "description": "file is the name of the file associated with the mapping." - }, - "buildId": { - "type": "string", - "description": "build_id is the build ID of the mapping." - }, - "hasFunctions": { - "type": "boolean", - "description": "has_functions indicates whether the mapping has associated functions." - }, - "hasFilenames": { - "type": "boolean", - "description": "has_filenames indicates whether the mapping has associated filenames." - }, - "hasLineNumbers": { - "type": "boolean", - "description": "has_line_numbers indicates whether the mapping has associated line numbers." - }, - "hasInlineFrames": { - "type": "boolean", - "description": "has_inline_frames indicates whether the mapping has associated inline frames." - }, - "fileStringIndex": { - "type": "integer", - "format": "int64", - "description": "fileStringIndex is the index in the string table to the file name associated with the mapping." - }, - "buildIdStringIndex": { - "type": "integer", - "format": "int64", - "description": "build_id_string_index is the index in the string table to the build ID of the mapping." - } - }, - "description": "Mapping describes a memory mapping." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1CreateLocationLinesResponse": { - "type": "object", - "description": "CreateLocationLinesResponse details about the location lines creation." - }, - "v1alpha1FunctionsResponse": { - "type": "object", - "properties": { - "functions": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Function" - }, - "description": "Functions that are known to the backing metastore." - } - }, - "description": "FunctionsResponse contains the requested functions." - }, - "v1alpha1GetOrCreateFunctionsResponse": { - "type": "object", - "properties": { - "functions": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Function" - }, - "description": "Functions that are known to the backing metastore. If any functions didn't\nexist before the request they have now been persisted and are uniquely\nidentifyable through their key." - } - }, - "description": "GetOrCreateFunctionsResponse contains information about functions requested." - }, - "v1alpha1GetOrCreateLocationsResponse": { - "type": "object", - "properties": { - "locations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Location" - }, - "description": "Locations that are known to the backing metastore. If any locations didn't\nexist before the request they have now been persisted and are uniquely\nidentifyable through their key." - } - }, - "description": "GetOrCreateLocationsResponse contains information about locations requested." - }, - "v1alpha1GetOrCreateMappingsResponse": { - "type": "object", - "properties": { - "mappings": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Mapping" - }, - "description": "Mappings that are known to the backing metastore. If any mappings didn't\nexist before the request they have now been persisted and are uniquely\nidentifyable through their key." - } - }, - "description": "GetOrCreateMappingsResponse contains information about mappings requested." - }, - "v1alpha1GetOrCreateStacktracesResponse": { - "type": "object", - "properties": { - "stacktraces": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1Stacktrace" - }, - "description": "Stacktraces that are known to the backing metastore. If any stacktraces\ndidn't exist before the request they have now been persisted and are\nuniquely identifyable through their key." - } - }, - "description": "GetOrCreateStacktracesResponse contains information about locations requested." - }, - "v1alpha1LocationsResponse": { - "type": "object", - "properties": { - "locations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Location" - }, - "description": "Locations that are known to the backing metastore." - } - }, - "description": "LocationsResponse contains the requested locations." - }, - "v1alpha1MappingsResponse": { - "type": "object", - "properties": { - "mappings": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Mapping" - }, - "description": "Mappings that are known to the backing metastore." - } - }, - "description": "MappingsResponse contains the requested mappings." - }, - "v1alpha1Stacktrace": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "stacktrace_id references stack trace of the stacktrace." - }, - "locationIds": { - "type": "array", - "items": { - "type": "string" - }, - "description": "locations are the locations in the stack trace." - } - }, - "description": "Stacktrace is a collection of locations." - }, - "v1alpha1StacktracesResponse": { - "type": "object", - "properties": { - "stacktraces": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1Stacktrace" - }, - "description": "Stacktraces that are known to the backing metastore." - } - }, - "description": "StacktracesRequest contains the requested stacktraces." - }, - "v1alpha1UnsymbolizedLocationsResponse": { - "type": "object", - "properties": { - "locations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Location" - }, - "description": "Locations that have a mapping and address that should be symbolizable." - }, - "maxKey": { - "type": "string", - "description": "Key of the last location returned. This can be used in a subsequent call\nto UnsymbolizedLocations to continue from the last returned location." - } - }, - "description": "UnsymbolizedLocationsResponse contains information about the requested\nlocations that should be symbolizable but potentially haven't been\nsymbolized yet." - } - } -} diff --git a/gen/proto/swagger/parca/profilestore/v1alpha1/profilestore.swagger.json b/gen/proto/swagger/parca/profilestore/v1alpha1/profilestore.swagger.json deleted file mode 100644 index 8f3fb8ff4d4..00000000000 --- a/gen/proto/swagger/parca/profilestore/v1alpha1/profilestore.swagger.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/profilestore/v1alpha1/profilestore.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "ProfileStoreService" - }, - { - "name": "AgentsService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/agents": { - "get": { - "summary": "Agents return the agents that pushed data to the server", - "operationId": "AgentsService_Agents", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1AgentsResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "tags": [ - "AgentsService" - ] - } - }, - "/profiles/writeraw": { - "post": { - "summary": "WriteRaw accepts a raw set of bytes of a pprof file", - "operationId": "ProfileStoreService_WriteRaw", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1WriteRawResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1alpha1WriteRawRequest" - } - } - ], - "tags": [ - "ProfileStoreService" - ] - } - } - }, - "definitions": { - "profilestorev1alpha1Label": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "name is the label name" - }, - "value": { - "type": "string", - "title": "value is the value for the label name" - } - }, - "title": "Label is a key value pair of identifiers" - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1Agent": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the agent identity that either represent by the node name or the IP address.\nWhen node name is not found, this will fallback to IP address." - }, - "lastError": { - "type": "string", - "title": "last_error is the error message most recently received from a push attempt" - }, - "lastPush": { - "type": "string", - "format": "date-time", - "title": "last_push is the time stamp the last push request was performed" - }, - "lastPushDuration": { - "type": "string", - "title": "last_push_duration is the duration of the last push request" - } - }, - "title": "Agent is the agent representation" - }, - "v1alpha1AgentsResponse": { - "type": "object", - "properties": { - "agents": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1Agent" - }, - "title": "agents is a list of agents" - } - }, - "title": "AgentsResponse is the request to retrieve a list of agents" - }, - "v1alpha1LabelSet": { - "type": "object", - "properties": { - "labels": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/profilestorev1alpha1Label" - }, - "title": "labels are the grouping of labels" - } - }, - "title": "LabelSet is a group of labels" - }, - "v1alpha1RawProfileSeries": { - "type": "object", - "properties": { - "labels": { - "$ref": "#/definitions/v1alpha1LabelSet", - "title": "LabelSet is the key value pairs to identify the corresponding profile" - }, - "samples": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1RawSample" - }, - "title": "samples are the set of profile bytes" - } - }, - "title": "RawProfileSeries represents the pprof profile and its associated labels" - }, - "v1alpha1RawSample": { - "type": "object", - "properties": { - "rawProfile": { - "type": "string", - "format": "byte", - "title": "raw_profile is the set of bytes of the pprof profile" - } - }, - "title": "RawSample is the set of bytes that correspond to a pprof profile" - }, - "v1alpha1WriteRawRequest": { - "type": "object", - "properties": { - "tenant": { - "type": "string", - "title": "tenant is the given tenant to store the pprof profile under" - }, - "series": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1RawProfileSeries" - }, - "title": "series is a set raw pprof profiles and accompanying labels" - }, - "normalized": { - "type": "boolean", - "title": "normalized is a flag indicating if the addresses in the profile is normalized for position independent code" - } - }, - "title": "WriteRawRequest writes a pprof profile for a given tenant" - }, - "v1alpha1WriteRawResponse": { - "type": "object", - "title": "WriteRawResponse is the empty response" - } - } -} diff --git a/gen/proto/swagger/parca/query/v1alpha1/query.swagger.json b/gen/proto/swagger/parca/query/v1alpha1/query.swagger.json deleted file mode 100644 index 0885190fa24..00000000000 --- a/gen/proto/swagger/parca/query/v1alpha1/query.swagger.json +++ /dev/null @@ -1,1408 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/query/v1alpha1/query.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "QueryService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/profiles/labels": { - "get": { - "summary": "Labels returns the set of label names against a given matching string and time frame", - "operationId": "QueryService_Labels", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1LabelsResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "match", - "description": "match are the set of matching strings", - "in": "query", - "required": false, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi" - }, - { - "name": "start", - "description": "start is the start of the time window to perform the query", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "end", - "description": "end is the end of the time window to perform the query", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/labels/{labelName}/values": { - "get": { - "summary": "Values returns the set of values that match a given label and time frame", - "operationId": "QueryService_Values", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1ValuesResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "labelName", - "description": "label_name is the label name to match values against", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "match", - "description": "match are the set of matching strings to match values against", - "in": "query", - "required": false, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi" - }, - { - "name": "start", - "description": "start is the start of the time window to perform the query", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "end", - "description": "end is the end of the time window to perform the query", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/query": { - "get": { - "summary": "Query performs a profile query", - "operationId": "QueryService_Query", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/parcaqueryv1alpha1QueryResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "mode", - "description": "mode indicates the type of query performed\n\n - MODE_SINGLE_UNSPECIFIED: MODE_SINGLE_UNSPECIFIED query unspecified\n - MODE_DIFF: MODE_DIFF is a diff query\n - MODE_MERGE: MODE_MERGE is a merge query", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "MODE_SINGLE_UNSPECIFIED", - "MODE_DIFF", - "MODE_MERGE" - ], - "default": "MODE_SINGLE_UNSPECIFIED" - }, - { - "name": "diff.a.mode", - "description": "mode is the selection of the diff mode\n\n - MODE_SINGLE_UNSPECIFIED: MODE_SINGLE_UNSPECIFIED default unspecified\n - MODE_MERGE: MODE_MERGE merge profile", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "MODE_SINGLE_UNSPECIFIED", - "MODE_MERGE" - ], - "default": "MODE_SINGLE_UNSPECIFIED" - }, - { - "name": "diff.a.merge.query", - "description": "query is the query string to match profiles for merge", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "diff.a.merge.start", - "description": "start is the beginning of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.a.merge.end", - "description": "end is the end of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.a.single.time", - "description": "time is the point in time to perform the profile request", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.a.single.query", - "description": "query is the query string to retrieve the profile", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "diff.b.mode", - "description": "mode is the selection of the diff mode\n\n - MODE_SINGLE_UNSPECIFIED: MODE_SINGLE_UNSPECIFIED default unspecified\n - MODE_MERGE: MODE_MERGE merge profile", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "MODE_SINGLE_UNSPECIFIED", - "MODE_MERGE" - ], - "default": "MODE_SINGLE_UNSPECIFIED" - }, - { - "name": "diff.b.merge.query", - "description": "query is the query string to match profiles for merge", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "diff.b.merge.start", - "description": "start is the beginning of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.b.merge.end", - "description": "end is the end of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.b.single.time", - "description": "time is the point in time to perform the profile request", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "diff.b.single.query", - "description": "query is the query string to retrieve the profile", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "merge.query", - "description": "query is the query string to match profiles for merge", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "merge.start", - "description": "start is the beginning of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "merge.end", - "description": "end is the end of the evaluation time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "single.time", - "description": "time is the point in time to perform the profile request", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "single.query", - "description": "query is the query string to retrieve the profile", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "reportType", - "description": "report_type is the type of report to return\n\n - REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED: REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED unspecified\n - REPORT_TYPE_PPROF: REPORT_TYPE_PPROF unspecified\n - REPORT_TYPE_TOP: REPORT_TYPE_TOP unspecified\n - REPORT_TYPE_CALLGRAPH: REPORT_TYPE_CALLGRAPH unspecified\n - REPORT_TYPE_FLAMEGRAPH_TABLE: REPORT_TYPE_FLAMEGRAPH_TABLE unspecified", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "REPORT_TYPE_PPROF", - "REPORT_TYPE_TOP", - "REPORT_TYPE_CALLGRAPH", - "REPORT_TYPE_FLAMEGRAPH_TABLE" - ], - "default": "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED" - }, - { - "name": "filterQuery", - "description": "filter_query is the query string to filter the profile samples", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "nodeTrimThreshold", - "description": "node_trim_threshold is the threshold % where the nodes with Value less than this will be removed from the report", - "in": "query", - "required": false, - "type": "number", - "format": "float" - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/query_range": { - "get": { - "summary": "QueryRange performs a profile query over a time range", - "operationId": "QueryService_QueryRange", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1QueryRangeResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "query", - "description": "query is the query string to match profiles against", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "start", - "description": "start is the start of the query time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "end", - "description": "end is the end of the query time window", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "limit", - "description": "limit is the max number of profiles to include in the response", - "in": "query", - "required": false, - "type": "integer", - "format": "int64" - }, - { - "name": "step", - "description": "step is the duration of each sample returned.", - "in": "query", - "required": false, - "type": "string" - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/series": { - "get": { - "summary": "Series is unimplemented", - "operationId": "QueryService_Series", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1SeriesResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "match", - "description": "match ...", - "in": "query", - "required": false, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi" - }, - { - "name": "start", - "description": "start ...", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - }, - { - "name": "end", - "description": "end ...", - "in": "query", - "required": false, - "type": "string", - "format": "date-time" - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/share": { - "post": { - "summary": "ShareProfile uploads the given profile to pprof.me and returns a link to the profile.", - "operationId": "QueryService_ShareProfile", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1ShareProfileResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1alpha1ShareProfileRequest" - } - } - ], - "tags": [ - "QueryService" - ] - } - }, - "/profiles/types": { - "get": { - "summary": "ProfileTypes returns the list of available profile types.", - "operationId": "QueryService_ProfileTypes", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/parcaqueryv1alpha1ProfileTypesResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "tags": [ - "QueryService" - ] - } - } - }, - "definitions": { - "QueryRequestReportType": { - "type": "string", - "enum": [ - "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "REPORT_TYPE_PPROF", - "REPORT_TYPE_TOP", - "REPORT_TYPE_CALLGRAPH", - "REPORT_TYPE_FLAMEGRAPH_TABLE" - ], - "default": "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "description": "- REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED: REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED unspecified\n - REPORT_TYPE_PPROF: REPORT_TYPE_PPROF unspecified\n - REPORT_TYPE_TOP: REPORT_TYPE_TOP unspecified\n - REPORT_TYPE_CALLGRAPH: REPORT_TYPE_CALLGRAPH unspecified\n - REPORT_TYPE_FLAMEGRAPH_TABLE: REPORT_TYPE_FLAMEGRAPH_TABLE unspecified", - "title": "ReportType is the type of report to return" - }, - "metastorev1alpha1Function": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the function." - }, - "startLine": { - "type": "string", - "format": "int64", - "description": "start_line is the line number in the source file of the first line of the function." - }, - "name": { - "type": "string", - "description": "name is the name of the function." - }, - "systemName": { - "type": "string", - "description": "system_name describes the name of the function, as identified by the\nsystem. For instance, it can be a C++ mangled name." - }, - "filename": { - "type": "string", - "description": "filename is the name of the source file of the function." - }, - "nameStringIndex": { - "type": "integer", - "format": "int64", - "description": "name_string_index is the index in the string table to the name associated with the function." - }, - "systemNameStringIndex": { - "type": "integer", - "format": "int64", - "description": "system_name_string_index is the index in the string table to the system_name associated with the function." - }, - "filenameStringIndex": { - "type": "integer", - "format": "int64", - "description": "filename_string_index is the index in the string table to the filename associated with the function." - } - }, - "description": "Function describes metadata of a source code function." - }, - "metastorev1alpha1Line": { - "type": "object", - "properties": { - "functionId": { - "type": "string", - "description": "function_id is the ID of the function." - }, - "line": { - "type": "string", - "format": "int64", - "description": "line is the line number in the source file of the referenced function." - }, - "functionIndex": { - "type": "integer", - "format": "int64", - "description": "function_index is the index in the functions table." - } - }, - "description": "Line describes a source code function and its line number." - }, - "metastorev1alpha1Location": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the location." - }, - "address": { - "type": "string", - "format": "uint64", - "description": "address is the memory address of the location if present." - }, - "mappingId": { - "type": "string", - "description": "mapping_id is the unique identifier for the mapping associated with the location." - }, - "isFolded": { - "type": "boolean", - "description": "is_folded indicates whether the location is folded into the previous location." - }, - "lines": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Line" - }, - "description": "lines are the call frames represented by this location. Multiple lines\nindicate they have been inlined." - }, - "mappingIndex": { - "type": "integer", - "format": "int64", - "description": "mapping_index has the index into the mapping table where mappings are sent deduplicated." - } - }, - "description": "Location describes a single location of a stack traces." - }, - "metastorev1alpha1Mapping": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the mapping." - }, - "start": { - "type": "string", - "format": "uint64", - "description": "start is the start address of the mapping." - }, - "limit": { - "type": "string", - "format": "uint64", - "description": "limit is the length of the address space of the mapping." - }, - "offset": { - "type": "string", - "format": "uint64", - "description": "offset in the binary that corresponds to the first mapped address." - }, - "file": { - "type": "string", - "description": "file is the name of the file associated with the mapping." - }, - "buildId": { - "type": "string", - "description": "build_id is the build ID of the mapping." - }, - "hasFunctions": { - "type": "boolean", - "description": "has_functions indicates whether the mapping has associated functions." - }, - "hasFilenames": { - "type": "boolean", - "description": "has_filenames indicates whether the mapping has associated filenames." - }, - "hasLineNumbers": { - "type": "boolean", - "description": "has_line_numbers indicates whether the mapping has associated line numbers." - }, - "hasInlineFrames": { - "type": "boolean", - "description": "has_inline_frames indicates whether the mapping has associated inline frames." - }, - "fileStringIndex": { - "type": "integer", - "format": "int64", - "description": "fileStringIndex is the index in the string table to the file name associated with the mapping." - }, - "buildIdStringIndex": { - "type": "integer", - "format": "int64", - "description": "build_id_string_index is the index in the string table to the build ID of the mapping." - } - }, - "description": "Mapping describes a memory mapping." - }, - "parcaqueryv1alpha1ProfileTypesResponse": { - "type": "object", - "properties": { - "types": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1ProfileType" - }, - "description": "types is the list of available profile types." - } - }, - "description": "ProfileTypesResponse is the response to retrieve the list of available profile types." - }, - "parcaqueryv1alpha1QueryRequest": { - "type": "object", - "properties": { - "mode": { - "$ref": "#/definitions/v1alpha1QueryRequestMode", - "title": "mode indicates the type of query performed" - }, - "diff": { - "$ref": "#/definitions/v1alpha1DiffProfile", - "title": "diff contains the diff query options" - }, - "merge": { - "$ref": "#/definitions/v1alpha1MergeProfile", - "title": "merge contains the merge query options" - }, - "single": { - "$ref": "#/definitions/v1alpha1SingleProfile", - "title": "single contains the single query options" - }, - "reportType": { - "$ref": "#/definitions/QueryRequestReportType", - "title": "report_type is the type of report to return" - }, - "filterQuery": { - "type": "string", - "title": "filter_query is the query string to filter the profile samples" - }, - "nodeTrimThreshold": { - "type": "number", - "format": "float", - "title": "node_trim_threshold is the threshold % where the nodes with Value less than this will be removed from the report" - } - }, - "title": "QueryRequest is a request for a profile query" - }, - "parcaqueryv1alpha1QueryResponse": { - "type": "object", - "properties": { - "flamegraph": { - "$ref": "#/definitions/v1alpha1Flamegraph", - "title": "flamegraph is a flamegraph representation of the report" - }, - "pprof": { - "type": "string", - "format": "byte", - "title": "pprof is a pprof profile as compressed bytes" - }, - "top": { - "$ref": "#/definitions/v1alpha1Top", - "title": "top is a top list representation of the report" - }, - "callgraph": { - "$ref": "#/definitions/v1alpha1Callgraph", - "title": "callgraph is a callgraph nodes and edges representation of the report" - }, - "total": { - "type": "string", - "format": "int64", - "description": "total is the total number of samples shown in the report." - }, - "filtered": { - "type": "string", - "format": "int64", - "description": "filtered is the number of samples filtered out of the report." - } - }, - "title": "QueryResponse is the returned report for the given query" - }, - "profilestorev1alpha1Label": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "name is the label name" - }, - "value": { - "type": "string", - "title": "value is the value for the label name" - } - }, - "title": "Label is a key value pair of identifiers" - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "queryv1alpha1ValueType": { - "type": "object", - "properties": { - "type": { - "type": "string", - "title": "type is the type of the value" - }, - "unit": { - "type": "string", - "title": "unit is the unit of the value" - } - }, - "title": "ValueType represents a value, including its type and unit" - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1Callgraph": { - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1CallgraphNode" - }, - "title": "nodes are the nodes in the callgraph" - }, - "edges": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1CallgraphEdge" - }, - "title": "edges are the edges connecting nodes in the callgraph" - }, - "cumulative": { - "type": "string", - "format": "int64", - "description": "cumulative is the total cumulative value of the callgraph\nUse total from the top level query response instead." - } - }, - "title": "Callgraph is the callgraph report type" - }, - "v1alpha1CallgraphEdge": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the edge" - }, - "source": { - "type": "string", - "title": "source represents the id of the source node" - }, - "target": { - "type": "string", - "title": "target represents the id of the target node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the edge" - }, - "isCollapsed": { - "type": "boolean", - "title": "is_collapsed indicates if the edge is collapsed" - } - }, - "title": "CallgraphEdge represents an edge in the graph" - }, - "v1alpha1CallgraphNode": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the node" - }, - "meta": { - "$ref": "#/definitions/v1alpha1CallgraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - } - }, - "title": "CallgraphNode represents a node in the graph" - }, - "v1alpha1CallgraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - }, - "v1alpha1DiffProfile": { - "type": "object", - "properties": { - "a": { - "$ref": "#/definitions/v1alpha1ProfileDiffSelection", - "title": "a is the first profile to diff" - }, - "b": { - "$ref": "#/definitions/v1alpha1ProfileDiffSelection", - "title": "b is the second profile to diff" - } - }, - "title": "DiffProfile contains parameters for a profile diff request" - }, - "v1alpha1Flamegraph": { - "type": "object", - "properties": { - "root": { - "$ref": "#/definitions/v1alpha1FlamegraphRootNode", - "title": "root is the root of the flame graph" - }, - "total": { - "type": "string", - "format": "int64", - "description": "total is the total weight of the flame graph\nUse total from the top level query response instead." - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by the flame graph" - }, - "height": { - "type": "integer", - "format": "int32", - "title": "height is the max height of the graph" - }, - "stringTable": { - "type": "array", - "items": { - "type": "string" - }, - "description": "string_table holds all deduplicated strings used in the meta data." - }, - "locations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Location" - }, - "description": "locations deduplicated by their ID to be referenced by nodes." - }, - "mapping": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Mapping" - }, - "description": "mapping deduplicated by their ID to be referenced by nodes." - }, - "function": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Function" - }, - "description": "function deduplicated by their ID to be referenced by nodes." - }, - "untrimmedTotal": { - "type": "string", - "format": "int64", - "description": "untrimmed_total is the total weight of the flame graph before trimming.\nUse trimmed instead." - }, - "trimmed": { - "type": "string", - "format": "int64", - "description": "trimmed is the amount of cumulative value trimmed from the flame graph." - } - }, - "title": "Flamegraph is the flame graph report type" - }, - "v1alpha1FlamegraphNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1FlamegraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the child nodes" - } - }, - "title": "FlamegraphNode represents a node in the graph" - }, - "v1alpha1FlamegraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - }, - "locationIndex": { - "type": "integer", - "format": "int64", - "description": "location_index has the index to the deduplicated location in the location table." - }, - "lineIndex": { - "type": "integer", - "format": "int64", - "description": "line_index is the line index within the referenced location." - } - }, - "title": "FlamegraphNodeMeta is the metadata for a given node" - }, - "v1alpha1FlamegraphRootNode": { - "type": "object", - "properties": { - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the graph" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the list of the children of the root node" - } - }, - "title": "FlamegraphRootNode is a root node of a flame graph" - }, - "v1alpha1LabelSet": { - "type": "object", - "properties": { - "labels": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/profilestorev1alpha1Label" - }, - "title": "labels are the grouping of labels" - } - }, - "title": "LabelSet is a group of labels" - }, - "v1alpha1LabelsResponse": { - "type": "object", - "properties": { - "labelNames": { - "type": "array", - "items": { - "type": "string" - }, - "title": "/ label_names are the set of matching label names" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - }, - "title": "warnings is unimplemented" - } - }, - "title": "LabelsResponse is the set of matching label names" - }, - "v1alpha1MergeProfile": { - "type": "object", - "properties": { - "query": { - "type": "string", - "title": "query is the query string to match profiles for merge" - }, - "start": { - "type": "string", - "format": "date-time", - "title": "start is the beginning of the evaluation time window" - }, - "end": { - "type": "string", - "format": "date-time", - "title": "end is the end of the evaluation time window" - } - }, - "title": "MergeProfile contains parameters for a merge request" - }, - "v1alpha1MetricsSample": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "date-time", - "title": "timestamp is the time the profile was ingested" - }, - "value": { - "type": "string", - "format": "int64", - "title": "value is the cumulative value for the profile" - }, - "valuePerSecond": { - "type": "number", - "format": "double", - "title": "value_per_second is the calculated per second average in the steps duration" - }, - "duration": { - "type": "string", - "format": "int64", - "description": "duration is the normalized aggregated duration the metric samples has been observed over." - } - }, - "title": "MetricsSample is a cumulative value and timestamp of a profile" - }, - "v1alpha1MetricsSeries": { - "type": "object", - "properties": { - "labelset": { - "$ref": "#/definitions/v1alpha1LabelSet", - "title": "labelset is the set of key value pairs" - }, - "samples": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1MetricsSample" - }, - "title": "samples is the set of top-level cumulative values of the corresponding profiles" - }, - "periodType": { - "$ref": "#/definitions/queryv1alpha1ValueType", - "title": "period_type is the value type of profile period" - }, - "sampleType": { - "$ref": "#/definitions/queryv1alpha1ValueType", - "title": "sample_type is the value type of profile sample" - } - }, - "title": "MetricsSeries is a set of labels and corresponding sample values" - }, - "v1alpha1ProfileDiffSelection": { - "type": "object", - "properties": { - "mode": { - "$ref": "#/definitions/v1alpha1ProfileDiffSelectionMode", - "title": "mode is the selection of the diff mode" - }, - "merge": { - "$ref": "#/definitions/v1alpha1MergeProfile", - "title": "merge contains options for a merge request" - }, - "single": { - "$ref": "#/definitions/v1alpha1SingleProfile", - "title": "single contains options for a single profile request" - } - }, - "title": "ProfileDiffSelection contains the parameters of a diff selection" - }, - "v1alpha1ProfileDiffSelectionMode": { - "type": "string", - "enum": [ - "MODE_SINGLE_UNSPECIFIED", - "MODE_MERGE" - ], - "default": "MODE_SINGLE_UNSPECIFIED", - "description": "- MODE_SINGLE_UNSPECIFIED: MODE_SINGLE_UNSPECIFIED default unspecified\n - MODE_MERGE: MODE_MERGE merge profile", - "title": "Mode specifies the type of diff" - }, - "v1alpha1ProfileType": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "name is the name of the profile type." - }, - "sampleType": { - "type": "string", - "description": "sample_type is the type of the samples in the profile." - }, - "sampleUnit": { - "type": "string", - "description": "sample_unit is the unit of the samples in the profile." - }, - "periodType": { - "type": "string", - "description": "period_type is the type of the periods in the profile." - }, - "periodUnit": { - "type": "string", - "description": "period_unit is the unit of the periods in the profile." - }, - "delta": { - "type": "boolean", - "description": "delta describes whether the profile is a delta profile." - } - }, - "description": "ProfileType is the type of a profile as well as the units the profile type is available in." - }, - "v1alpha1QueryRangeResponse": { - "type": "object", - "properties": { - "series": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1MetricsSeries" - }, - "title": "series is the set of metrics series that satisfy the query range request" - } - }, - "title": "QueryRangeResponse is the set of matching profile values" - }, - "v1alpha1QueryRequestMode": { - "type": "string", - "enum": [ - "MODE_SINGLE_UNSPECIFIED", - "MODE_DIFF", - "MODE_MERGE" - ], - "default": "MODE_SINGLE_UNSPECIFIED", - "description": "- MODE_SINGLE_UNSPECIFIED: MODE_SINGLE_UNSPECIFIED query unspecified\n - MODE_DIFF: MODE_DIFF is a diff query\n - MODE_MERGE: MODE_MERGE is a merge query", - "title": "Mode is the type of query request" - }, - "v1alpha1SeriesResponse": { - "type": "object", - "title": "SeriesResponse is unimplemented" - }, - "v1alpha1ShareProfileRequest": { - "type": "object", - "properties": { - "queryRequest": { - "$ref": "#/definitions/parcaqueryv1alpha1QueryRequest", - "title": "QueryRequest that refers to the profile to be shared" - }, - "description": { - "type": "string", - "title": "description about the profile" - } - }, - "title": "ShareProfileRequest represents the query denoting the profile and a description about the profile" - }, - "v1alpha1ShareProfileResponse": { - "type": "object", - "properties": { - "link": { - "type": "string", - "title": "link to access the profile" - } - }, - "title": "ShareProfileResponse represents the shared link of a profile" - }, - "v1alpha1SingleProfile": { - "type": "object", - "properties": { - "time": { - "type": "string", - "format": "date-time", - "title": "time is the point in time to perform the profile request" - }, - "query": { - "type": "string", - "title": "query is the query string to retrieve the profile" - } - }, - "title": "SingleProfile contains parameters for a single profile query request" - }, - "v1alpha1Top": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1TopNode" - }, - "title": "list are the list of ordered elements of the table" - }, - "reported": { - "type": "integer", - "format": "int32", - "title": "reported is the number of lines reported" - }, - "total": { - "type": "integer", - "format": "int32", - "description": "total is the number of lines that exist in the report\nUse total from the top level query response instead." - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by top table" - } - }, - "title": "Top is the top report type" - }, - "v1alpha1TopNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1TopNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff value between two profiles" - } - }, - "title": "TopNode is a node entry in a top list" - }, - "v1alpha1TopNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - }, - "v1alpha1ValuesResponse": { - "type": "object", - "properties": { - "labelValues": { - "type": "array", - "items": { - "type": "string" - }, - "title": "label_values are the set of matching label values" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - }, - "title": "warnings is unimplemented" - } - }, - "title": "ValuesResponse are the set of matching values" - } - } -} diff --git a/gen/proto/swagger/parca/scrape/v1alpha1/scrape.swagger.json b/gen/proto/swagger/parca/scrape/v1alpha1/scrape.swagger.json deleted file mode 100644 index eaba949ed94..00000000000 --- a/gen/proto/swagger/parca/scrape/v1alpha1/scrape.swagger.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/scrape/v1alpha1/scrape.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "ScrapeService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/targets": { - "get": { - "summary": "Targets returns the set of scrape targets that are configured", - "operationId": "ScrapeService_Targets", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1alpha1TargetsResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "state", - "description": "state is the state of targets to returns\n\n - STATE_ANY_UNSPECIFIED: STATE_ANY_UNSPECIFIED unspecified\n - STATE_ACTIVE: STATE_ACTIVE target active state\n - STATE_DROPPED: STATE_DROPPED target dropped state", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "STATE_ANY_UNSPECIFIED", - "STATE_ACTIVE", - "STATE_DROPPED" - ], - "default": "STATE_ANY_UNSPECIFIED" - } - ], - "tags": [ - "ScrapeService" - ] - } - } - }, - "definitions": { - "TargetHealth": { - "type": "string", - "enum": [ - "HEALTH_UNKNOWN_UNSPECIFIED", - "HEALTH_GOOD", - "HEALTH_BAD" - ], - "default": "HEALTH_UNKNOWN_UNSPECIFIED", - "description": "- HEALTH_UNKNOWN_UNSPECIFIED: HEALTH_UNKNOWN_UNSPECIFIED unspecified\n - HEALTH_GOOD: HEALTH_GOOD healthy target\n - HEALTH_BAD: HEALTH_BAD unhealthy target", - "title": "Health are the possible health values of a target" - }, - "profilestorev1alpha1Label": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "name is the label name" - }, - "value": { - "type": "string", - "title": "value is the value for the label name" - } - }, - "title": "Label is a key value pair of identifiers" - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1LabelSet": { - "type": "object", - "properties": { - "labels": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/profilestorev1alpha1Label" - }, - "title": "labels are the grouping of labels" - } - }, - "title": "LabelSet is a group of labels" - }, - "v1alpha1Target": { - "type": "object", - "properties": { - "discoveredLabels": { - "$ref": "#/definitions/v1alpha1LabelSet", - "title": "discovered_labels are the set of labels for the target that have been discovered" - }, - "labels": { - "$ref": "#/definitions/v1alpha1LabelSet", - "title": "labels are the set of labels given for the target" - }, - "lastError": { - "type": "string", - "title": "last_error is the error message most recently received from a scrape attempt" - }, - "lastScrape": { - "type": "string", - "format": "date-time", - "title": "last_scrape is the time stamp the last scrape request was performed" - }, - "lastScrapeDuration": { - "type": "string", - "title": "last_scrape_duration is the duration of the last scrape request" - }, - "url": { - "type": "string", - "title": "url is the url of the target" - }, - "health": { - "$ref": "#/definitions/TargetHealth", - "title": "health indicates the current health of the target" - } - }, - "title": "Target is the scrape target representation" - }, - "v1alpha1Targets": { - "type": "object", - "properties": { - "targets": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1Target" - }, - "title": "targets is a list of targets" - } - }, - "title": "Targets is a list of targets" - }, - "v1alpha1TargetsRequestState": { - "type": "string", - "enum": [ - "STATE_ANY_UNSPECIFIED", - "STATE_ACTIVE", - "STATE_DROPPED" - ], - "default": "STATE_ANY_UNSPECIFIED", - "description": "- STATE_ANY_UNSPECIFIED: STATE_ANY_UNSPECIFIED unspecified\n - STATE_ACTIVE: STATE_ACTIVE target active state\n - STATE_DROPPED: STATE_DROPPED target dropped state", - "title": "State represents the current state of a target" - }, - "v1alpha1TargetsResponse": { - "type": "object", - "properties": { - "targets": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/v1alpha1Targets" - }, - "title": "targets is the mapping of targets" - } - }, - "title": "TargetsResponse is the set of targets for the given requested state" - } - } -} diff --git a/gen/proto/swagger/parca/share/share.swagger.json b/gen/proto/swagger/parca/share/share.swagger.json deleted file mode 100644 index b01c9df7b97..00000000000 --- a/gen/proto/swagger/parca/share/share.swagger.json +++ /dev/null @@ -1,469 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/share/share.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "Share" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "metastorev1alpha1Function": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the function." - }, - "startLine": { - "type": "string", - "format": "int64", - "description": "start_line is the line number in the source file of the first line of the function." - }, - "name": { - "type": "string", - "description": "name is the name of the function." - }, - "systemName": { - "type": "string", - "description": "system_name describes the name of the function, as identified by the\nsystem. For instance, it can be a C++ mangled name." - }, - "filename": { - "type": "string", - "description": "filename is the name of the source file of the function." - } - }, - "description": "Function describes metadata of a source code function." - }, - "metastorev1alpha1Line": { - "type": "object", - "properties": { - "functionId": { - "type": "string", - "description": "function_id is the ID of the function." - }, - "line": { - "type": "string", - "format": "int64", - "description": "line is the line number in the source file of the referenced function." - } - }, - "description": "Line describes a source code function and its line number." - }, - "metastorev1alpha1Location": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the location." - }, - "address": { - "type": "string", - "format": "uint64", - "description": "address is the memory address of the location if present." - }, - "mappingId": { - "type": "string", - "description": "mapping_id is the unique identifier for the mapping associated with the location." - }, - "isFolded": { - "type": "boolean", - "description": "is_folded indicates whether the location is folded into the previous location." - }, - "lines": { - "type": "array", - "items": { - "$ref": "#/definitions/metastorev1alpha1Line" - }, - "description": "lines are the call frames represented by this location. Multiple lines\nindicate they have been inlined." - } - }, - "description": "Location describes a single location of a stack traces." - }, - "metastorev1alpha1Mapping": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the mapping." - }, - "start": { - "type": "string", - "format": "uint64", - "description": "start is the start address of the mapping." - }, - "limit": { - "type": "string", - "format": "uint64", - "description": "limit is the length of the address space of the mapping." - }, - "offset": { - "type": "string", - "format": "uint64", - "description": "offset in the binary that corresponds to the first mapped address." - }, - "file": { - "type": "string", - "description": "file is the name of the file associated with the mapping." - }, - "buildId": { - "type": "string", - "description": "build_id is the build ID of the mapping." - }, - "hasFunctions": { - "type": "boolean", - "description": "has_functions indicates whether the mapping has associated functions." - }, - "hasFilenames": { - "type": "boolean", - "description": "has_filenames indicates whether the mapping has associated filenames." - }, - "hasLineNumbers": { - "type": "boolean", - "description": "has_line_numbers indicates whether the mapping has associated line numbers." - }, - "hasInlineFrames": { - "type": "boolean", - "description": "has_inline_frames indicates whether the mapping has associated inline frames." - } - }, - "description": "Mapping describes a memory mapping." - }, - "polarsignalsshareUploadResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id of the uploaded profile." - }, - "link": { - "type": "string", - "description": "link that can be used to access the profile." - } - }, - "description": "UploadResponse represents the response with the link that can be used to access the profile." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1Callgraph": { - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1CallgraphNode" - }, - "title": "nodes are the nodes in the callgraph" - }, - "edges": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1CallgraphEdge" - }, - "title": "edges are the edges connecting nodes in the callgraph" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the total cumulative value of the callgraph" - } - }, - "title": "Callgraph is the callgraph report type" - }, - "v1alpha1CallgraphEdge": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the edge" - }, - "source": { - "type": "string", - "title": "source represents the id of the source node" - }, - "target": { - "type": "string", - "title": "target represents the id of the target node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the edge" - }, - "isCollapsed": { - "type": "boolean", - "title": "is_collapsed indicates if the edge is collapsed" - } - }, - "title": "CallgraphEdge represents an edge in the graph" - }, - "v1alpha1CallgraphNode": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the node" - }, - "meta": { - "$ref": "#/definitions/v1alpha1CallgraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - } - }, - "title": "CallgraphNode represents a node in the graph" - }, - "v1alpha1CallgraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - }, - "v1alpha1Flamegraph": { - "type": "object", - "properties": { - "root": { - "$ref": "#/definitions/v1alpha1FlamegraphRootNode", - "title": "root is the root of the flame graph" - }, - "total": { - "type": "string", - "format": "int64", - "title": "total is the total weight of the flame graph" - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by the flame graph" - }, - "height": { - "type": "integer", - "format": "int32", - "title": "height is the max height of the graph" - } - }, - "title": "Flamegraph is the flame graph report type" - }, - "v1alpha1FlamegraphNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1FlamegraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the child nodes" - } - }, - "title": "FlamegraphNode represents a node in the graph" - }, - "v1alpha1FlamegraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "FlamegraphNodeMeta is the metadata for a given node" - }, - "v1alpha1FlamegraphRootNode": { - "type": "object", - "properties": { - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the graph" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the list of the children of the root node" - } - }, - "title": "FlamegraphRootNode is a root node of a flame graph" - }, - "v1alpha1QueryResponse": { - "type": "object", - "properties": { - "flamegraph": { - "$ref": "#/definitions/v1alpha1Flamegraph", - "title": "flamegraph is a flamegraph representation of the report" - }, - "pprof": { - "type": "string", - "format": "byte", - "title": "pprof is a pprof profile as compressed bytes" - }, - "top": { - "$ref": "#/definitions/v1alpha1Top", - "title": "top is a top list representation of the report" - }, - "callgraph": { - "$ref": "#/definitions/v1alpha1Callgraph", - "title": "callgraph is a callgraph nodes and edges representation of the report" - } - }, - "title": "QueryResponse is the returned report for the given query" - }, - "v1alpha1Top": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1TopNode" - }, - "title": "list are the list of ordered elements of the table" - }, - "reported": { - "type": "integer", - "format": "int32", - "title": "reported is the number of lines reported" - }, - "total": { - "type": "integer", - "format": "int32", - "title": "total is the number of lines that exist in the report" - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by top table" - } - }, - "title": "Top is the top report type" - }, - "v1alpha1TopNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1TopNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff value between two profiles" - } - }, - "title": "TopNode is a node entry in a top list" - }, - "v1alpha1TopNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - } - } -} diff --git a/gen/proto/swagger/parca/share/v1alpha1/share.swagger.json b/gen/proto/swagger/parca/share/v1alpha1/share.swagger.json deleted file mode 100644 index 4e6cd3880d4..00000000000 --- a/gen/proto/swagger/parca/share/v1alpha1/share.swagger.json +++ /dev/null @@ -1,638 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "parca/share/v1alpha1/share.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "ShareService" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "QueryRequestReportType": { - "type": "string", - "enum": [ - "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "REPORT_TYPE_PPROF", - "REPORT_TYPE_TOP", - "REPORT_TYPE_CALLGRAPH", - "REPORT_TYPE_FLAMEGRAPH_TABLE" - ], - "default": "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "description": "- REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED: REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED unspecified\n - REPORT_TYPE_PPROF: REPORT_TYPE_PPROF unspecified\n - REPORT_TYPE_TOP: REPORT_TYPE_TOP unspecified\n - REPORT_TYPE_CALLGRAPH: REPORT_TYPE_CALLGRAPH unspecified\n - REPORT_TYPE_FLAMEGRAPH_TABLE: REPORT_TYPE_FLAMEGRAPH_TABLE unspecified", - "title": "ReportType is the type of report to return" - }, - "metastorev1alpha1Function": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the function." - }, - "startLine": { - "type": "string", - "format": "int64", - "description": "start_line is the line number in the source file of the first line of the function." - }, - "name": { - "type": "string", - "description": "name is the name of the function." - }, - "systemName": { - "type": "string", - "description": "system_name describes the name of the function, as identified by the\nsystem. For instance, it can be a C++ mangled name." - }, - "filename": { - "type": "string", - "description": "filename is the name of the source file of the function." - }, - "nameStringIndex": { - "type": "integer", - "format": "int64", - "description": "name_string_index is the index in the string table to the name associated with the function." - }, - "systemNameStringIndex": { - "type": "integer", - "format": "int64", - "description": "system_name_string_index is the index in the string table to the system_name associated with the function." - }, - "filenameStringIndex": { - "type": "integer", - "format": "int64", - "description": "filename_string_index is the index in the string table to the filename associated with the function." - } - }, - "description": "Function describes metadata of a source code function." - }, - "metastorev1alpha1Line": { - "type": "object", - "properties": { - "functionId": { - "type": "string", - "description": "function_id is the ID of the function." - }, - "line": { - "type": "string", - "format": "int64", - "description": "line is the line number in the source file of the referenced function." - }, - "functionIndex": { - "type": "integer", - "format": "int64", - "description": "function_index is the index in the functions table." - } - }, - "description": "Line describes a source code function and its line number." - }, - "metastorev1alpha1Location": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the location." - }, - "address": { - "type": "string", - "format": "uint64", - "description": "address is the memory address of the location if present." - }, - "mappingId": { - "type": "string", - "description": "mapping_id is the unique identifier for the mapping associated with the location." - }, - "isFolded": { - "type": "boolean", - "description": "is_folded indicates whether the location is folded into the previous location." - }, - "lines": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Line" - }, - "description": "lines are the call frames represented by this location. Multiple lines\nindicate they have been inlined." - }, - "mappingIndex": { - "type": "integer", - "format": "int64", - "description": "mapping_index has the index into the mapping table where mappings are sent deduplicated." - } - }, - "description": "Location describes a single location of a stack traces." - }, - "metastorev1alpha1Mapping": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the mapping." - }, - "start": { - "type": "string", - "format": "uint64", - "description": "start is the start address of the mapping." - }, - "limit": { - "type": "string", - "format": "uint64", - "description": "limit is the length of the address space of the mapping." - }, - "offset": { - "type": "string", - "format": "uint64", - "description": "offset in the binary that corresponds to the first mapped address." - }, - "file": { - "type": "string", - "description": "file is the name of the file associated with the mapping." - }, - "buildId": { - "type": "string", - "description": "build_id is the build ID of the mapping." - }, - "hasFunctions": { - "type": "boolean", - "description": "has_functions indicates whether the mapping has associated functions." - }, - "hasFilenames": { - "type": "boolean", - "description": "has_filenames indicates whether the mapping has associated filenames." - }, - "hasLineNumbers": { - "type": "boolean", - "description": "has_line_numbers indicates whether the mapping has associated line numbers." - }, - "hasInlineFrames": { - "type": "boolean", - "description": "has_inline_frames indicates whether the mapping has associated inline frames." - }, - "fileStringIndex": { - "type": "integer", - "format": "int64", - "description": "fileStringIndex is the index in the string table to the file name associated with the mapping." - }, - "buildIdStringIndex": { - "type": "integer", - "format": "int64", - "description": "build_id_string_index is the index in the string table to the build ID of the mapping." - } - }, - "description": "Mapping describes a memory mapping." - }, - "parcasharev1alpha1ProfileTypesResponse": { - "type": "object", - "properties": { - "types": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1ProfileType" - }, - "description": "list of available profile types." - }, - "description": { - "type": "string", - "description": "description of the profile uploaded." - } - }, - "description": "ProfileTypesResponse represents the response with the list of available profile types." - }, - "parcasharev1alpha1QueryResponse": { - "type": "object", - "properties": { - "flamegraph": { - "$ref": "#/definitions/v1alpha1Flamegraph", - "title": "flamegraph is a flamegraph representation of the report" - }, - "pprof": { - "type": "string", - "format": "byte", - "title": "pprof is a pprof profile as compressed bytes" - }, - "top": { - "$ref": "#/definitions/v1alpha1Top", - "title": "top is a top list representation of the report" - }, - "callgraph": { - "$ref": "#/definitions/v1alpha1Callgraph", - "title": "callgraph is a callgraph nodes and edges representation of the report" - }, - "total": { - "type": "string", - "format": "int64", - "description": "total is the total number of samples shown in the report." - }, - "filtered": { - "type": "string", - "format": "int64", - "description": "filtered is the number of samples filtered out of the report." - } - }, - "description": "QueryResponse is the returned report for the given query." - }, - "parcasharev1alpha1UploadResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id of the uploaded profile." - }, - "link": { - "type": "string", - "description": "link that can be used to access the profile." - } - }, - "description": "UploadResponse represents the response with the link that can be used to access the profile." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v1alpha1Callgraph": { - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1CallgraphNode" - }, - "title": "nodes are the nodes in the callgraph" - }, - "edges": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1CallgraphEdge" - }, - "title": "edges are the edges connecting nodes in the callgraph" - }, - "cumulative": { - "type": "string", - "format": "int64", - "description": "cumulative is the total cumulative value of the callgraph\nUse total from the top level query response instead." - } - }, - "title": "Callgraph is the callgraph report type" - }, - "v1alpha1CallgraphEdge": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the edge" - }, - "source": { - "type": "string", - "title": "source represents the id of the source node" - }, - "target": { - "type": "string", - "title": "target represents the id of the target node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the edge" - }, - "isCollapsed": { - "type": "boolean", - "title": "is_collapsed indicates if the edge is collapsed" - } - }, - "title": "CallgraphEdge represents an edge in the graph" - }, - "v1alpha1CallgraphNode": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the node" - }, - "meta": { - "$ref": "#/definitions/v1alpha1CallgraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - } - }, - "title": "CallgraphNode represents a node in the graph" - }, - "v1alpha1CallgraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - }, - "v1alpha1Flamegraph": { - "type": "object", - "properties": { - "root": { - "$ref": "#/definitions/v1alpha1FlamegraphRootNode", - "title": "root is the root of the flame graph" - }, - "total": { - "type": "string", - "format": "int64", - "description": "total is the total weight of the flame graph\nUse total from the top level query response instead." - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by the flame graph" - }, - "height": { - "type": "integer", - "format": "int32", - "title": "height is the max height of the graph" - }, - "stringTable": { - "type": "array", - "items": { - "type": "string" - }, - "description": "string_table holds all deduplicated strings used in the meta data." - }, - "locations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Location" - }, - "description": "locations deduplicated by their ID to be referenced by nodes." - }, - "mapping": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Mapping" - }, - "description": "mapping deduplicated by their ID to be referenced by nodes." - }, - "function": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/metastorev1alpha1Function" - }, - "description": "function deduplicated by their ID to be referenced by nodes." - }, - "untrimmedTotal": { - "type": "string", - "format": "int64", - "description": "untrimmed_total is the total weight of the flame graph before trimming.\nUse trimmed instead." - }, - "trimmed": { - "type": "string", - "format": "int64", - "description": "trimmed is the amount of cumulative value trimmed from the flame graph." - } - }, - "title": "Flamegraph is the flame graph report type" - }, - "v1alpha1FlamegraphNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1FlamegraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the child nodes" - } - }, - "title": "FlamegraphNode represents a node in the graph" - }, - "v1alpha1FlamegraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - }, - "locationIndex": { - "type": "integer", - "format": "int64", - "description": "location_index has the index to the deduplicated location in the location table." - }, - "lineIndex": { - "type": "integer", - "format": "int64", - "description": "line_index is the line index within the referenced location." - } - }, - "title": "FlamegraphNodeMeta is the metadata for a given node" - }, - "v1alpha1FlamegraphRootNode": { - "type": "object", - "properties": { - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the graph" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the list of the children of the root node" - } - }, - "title": "FlamegraphRootNode is a root node of a flame graph" - }, - "v1alpha1ProfileType": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "name is the name of the profile type." - }, - "sampleType": { - "type": "string", - "description": "sample_type is the type of the samples in the profile." - }, - "sampleUnit": { - "type": "string", - "description": "sample_unit is the unit of the samples in the profile." - }, - "periodType": { - "type": "string", - "description": "period_type is the type of the periods in the profile." - }, - "periodUnit": { - "type": "string", - "description": "period_unit is the unit of the periods in the profile." - }, - "delta": { - "type": "boolean", - "description": "delta describes whether the profile is a delta profile." - } - }, - "description": "ProfileType is the type of a profile as well as the units the profile type is available in." - }, - "v1alpha1Top": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1alpha1TopNode" - }, - "title": "list are the list of ordered elements of the table" - }, - "reported": { - "type": "integer", - "format": "int32", - "title": "reported is the number of lines reported" - }, - "total": { - "type": "integer", - "format": "int32", - "description": "total is the number of lines that exist in the report\nUse total from the top level query response instead." - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by top table" - } - }, - "title": "Top is the top report type" - }, - "v1alpha1TopNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1TopNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff value between two profiles" - } - }, - "title": "TopNode is a node entry in a top list" - }, - "v1alpha1TopNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/metastorev1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/metastorev1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/metastorev1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - } - } -} diff --git a/gen/proto/swagger/share/share.swagger.json b/gen/proto/swagger/share/share.swagger.json deleted file mode 100644 index ef545a01fb5..00000000000 --- a/gen/proto/swagger/share/share.swagger.json +++ /dev/null @@ -1,524 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "share/share.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "Share" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": {}, - "definitions": { - "QueryRequestReportType": { - "type": "string", - "enum": [ - "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "REPORT_TYPE_PPROF", - "REPORT_TYPE_TOP", - "REPORT_TYPE_CALLGRAPH" - ], - "default": "REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED", - "description": "- REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED: REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED unspecified\n - REPORT_TYPE_PPROF: REPORT_TYPE_PPROF unspecified\n - REPORT_TYPE_TOP: REPORT_TYPE_TOP unspecified\n - REPORT_TYPE_CALLGRAPH: REPORT_TYPE_CALLGRAPH unspecified", - "title": "ReportType is the type of report to return" - }, - "metastorev1alpha1Location": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the location." - }, - "address": { - "type": "string", - "format": "uint64", - "description": "address is the memory address of the location if present." - }, - "mappingId": { - "type": "string", - "description": "mapping_id is the unique identifier for the mapping associated with the location." - }, - "isFolded": { - "type": "boolean", - "description": "is_folded indicates whether the location is folded into the previous location." - }, - "lines": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1Line" - }, - "description": "lines are the call frames represented by this location. Multiple lines\nindicate they have been inlined." - } - }, - "description": "Location describes a single location of a stack traces." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "shareUploadResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id of the uploaded profile." - }, - "link": { - "type": "string", - "description": "link that can be used to access the profile." - } - }, - "description": "UploadResponse represents the response with the link that can be used to access the profile." - }, - "v1alpha1Callgraph": { - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1CallgraphNode" - }, - "title": "nodes are the nodes in the callgraph" - }, - "edges": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1CallgraphEdge" - }, - "title": "edges are the edges connecting nodes in the callgraph" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the total cumulative value of the callgraph" - } - }, - "title": "Callgraph is the callgraph report type" - }, - "v1alpha1CallgraphEdge": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the edge" - }, - "source": { - "type": "string", - "title": "source represents the id of the source node" - }, - "target": { - "type": "string", - "title": "target represents the id of the target node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the edge" - }, - "isCollapsed": { - "type": "boolean", - "title": "is_collapsed indicates if the edge is collapsed" - } - }, - "title": "CallgraphEdge represents an edge in the graph" - }, - "v1alpha1CallgraphNode": { - "type": "object", - "properties": { - "id": { - "type": "string", - "title": "id is the unique id of the node" - }, - "meta": { - "$ref": "#/definitions/v1alpha1CallgraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - } - }, - "title": "CallgraphNode represents a node in the graph" - }, - "v1alpha1CallgraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/v1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/v1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/v1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - }, - "v1alpha1Flamegraph": { - "type": "object", - "properties": { - "root": { - "$ref": "#/definitions/v1alpha1FlamegraphRootNode", - "title": "root is the root of the flame graph" - }, - "total": { - "type": "string", - "format": "int64", - "title": "total is the total weight of the flame graph" - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by the flame graph" - }, - "height": { - "type": "integer", - "format": "int32", - "title": "height is the max height of the graph" - } - }, - "title": "Flamegraph is the flame graph report type" - }, - "v1alpha1FlamegraphNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1FlamegraphNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the child nodes" - } - }, - "title": "FlamegraphNode represents a node in the graph" - }, - "v1alpha1FlamegraphNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/v1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/v1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/v1alpha1Line", - "title": "line is the line location" - } - }, - "title": "FlamegraphNodeMeta is the metadata for a given node" - }, - "v1alpha1FlamegraphRootNode": { - "type": "object", - "properties": { - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the graph" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1FlamegraphNode" - }, - "title": "children are the list of the children of the root node" - } - }, - "title": "FlamegraphRootNode is a root node of a flame graph" - }, - "v1alpha1Function": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the function." - }, - "startLine": { - "type": "string", - "format": "int64", - "description": "start_line is the line number in the source file of the first line of the function." - }, - "name": { - "type": "string", - "description": "name is the name of the function." - }, - "systemName": { - "type": "string", - "description": "system_name describes the name of the function, as identified by the\nsystem. For instance, it can be a C++ mangled name." - }, - "filename": { - "type": "string", - "description": "filename is the name of the source file of the function." - } - }, - "description": "Function describes metadata of a source code function." - }, - "v1alpha1Line": { - "type": "object", - "properties": { - "functionId": { - "type": "string", - "description": "function_id is the ID of the function." - }, - "line": { - "type": "string", - "format": "int64", - "description": "line is the line number in the source file of the referenced function." - } - }, - "description": "Line describes a source code function and its line number." - }, - "v1alpha1Mapping": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "id is the unique identifier for the mapping." - }, - "start": { - "type": "string", - "format": "uint64", - "description": "start is the start address of the mapping." - }, - "limit": { - "type": "string", - "format": "uint64", - "description": "limit is the length of the address space of the mapping." - }, - "offset": { - "type": "string", - "format": "uint64", - "description": "offset in the binary that corresponds to the first mapped address." - }, - "file": { - "type": "string", - "description": "file is the name of the file associated with the mapping." - }, - "buildId": { - "type": "string", - "description": "build_id is the build ID of the mapping." - }, - "hasFunctions": { - "type": "boolean", - "description": "has_functions indicates whether the mapping has associated functions." - }, - "hasFilenames": { - "type": "boolean", - "description": "has_filenames indicates whether the mapping has associated filenames." - }, - "hasLineNumbers": { - "type": "boolean", - "description": "has_line_numbers indicates whether the mapping has associated line numbers." - }, - "hasInlineFrames": { - "type": "boolean", - "description": "has_inline_frames indicates whether the mapping has associated inline frames." - } - }, - "description": "Mapping describes a memory mapping." - }, - "v1alpha1ProfileType": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "name is the name of the profile type." - }, - "sampleType": { - "type": "string", - "description": "sample_type is the type of the samples in the profile." - }, - "sampleUnit": { - "type": "string", - "description": "sample_unit is the unit of the samples in the profile." - }, - "periodType": { - "type": "string", - "description": "period_type is the type of the periods in the profile." - }, - "periodUnit": { - "type": "string", - "description": "period_unit is the unit of the periods in the profile." - }, - "delta": { - "type": "boolean", - "description": "delta describes whether the profile is a delta profile." - } - }, - "description": "ProfileType is the type of a profile as well as the units the profile type is available in." - }, - "v1alpha1ProfileTypesResponse": { - "type": "object", - "properties": { - "types": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1ProfileType" - }, - "description": "types is the list of available profile types." - } - }, - "description": "ProfileTypesResponse is the response to retrieve the list of available profile types." - }, - "v1alpha1QueryResponse": { - "type": "object", - "properties": { - "flamegraph": { - "$ref": "#/definitions/v1alpha1Flamegraph", - "title": "flamegraph is a flamegraph representation of the report" - }, - "pprof": { - "type": "string", - "format": "byte", - "title": "pprof is a pprof profile as compressed bytes" - }, - "top": { - "$ref": "#/definitions/v1alpha1Top", - "title": "top is a top list representation of the report" - }, - "callgraph": { - "$ref": "#/definitions/v1alpha1Callgraph", - "title": "callgraph is a callgraph nodes and edges representation of the report" - } - }, - "title": "QueryResponse is the returned report for the given query" - }, - "v1alpha1Top": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1TopNode" - }, - "title": "list are the list of ordered elements of the table" - }, - "reported": { - "type": "integer", - "format": "int32", - "title": "reported is the number of lines reported" - }, - "total": { - "type": "integer", - "format": "int32", - "title": "total is the number of lines that exist in the report" - }, - "unit": { - "type": "string", - "title": "unit is the unit represented by top table" - } - }, - "title": "Top is the top report type" - }, - "v1alpha1TopNode": { - "type": "object", - "properties": { - "meta": { - "$ref": "#/definitions/v1alpha1TopNodeMeta", - "title": "meta is the metadata about the node" - }, - "cumulative": { - "type": "string", - "format": "int64", - "title": "cumulative is the cumulative value of the node" - }, - "flat": { - "type": "string", - "format": "int64", - "title": "flat is the flat value of the node" - }, - "diff": { - "type": "string", - "format": "int64", - "title": "diff is the diff value between two profiles" - } - }, - "title": "TopNode is a node entry in a top list" - }, - "v1alpha1TopNodeMeta": { - "type": "object", - "properties": { - "location": { - "$ref": "#/definitions/metastorev1alpha1Location", - "title": "location is the location for the code" - }, - "mapping": { - "$ref": "#/definitions/v1alpha1Mapping", - "title": "mapping is the mapping into code" - }, - "function": { - "$ref": "#/definitions/v1alpha1Function", - "title": "function is the function information" - }, - "line": { - "$ref": "#/definitions/v1alpha1Line", - "title": "line is the line location" - } - }, - "title": "TopNodeMeta is the metadata for a given node" - } - } -} diff --git a/go.mod b/go.mod index 001b0939110..d7152aa5a0c 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( cloud.google.com/go/storage v1.30.1 github.com/alecthomas/kong v0.7.1 github.com/apache/arrow/go/v10 v10.0.1 + github.com/bufbuild/connect-go v1.5.2 github.com/cenkalti/backoff/v4 v4.2.0 github.com/cespare/xxhash/v2 v2.2.0 github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be diff --git a/go.sum b/go.sum index 04b93a4ecac..f8ce80b0872 100644 --- a/go.sum +++ b/go.sum @@ -164,6 +164,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bufbuild/connect-go v1.5.2 h1:G4EZd5gF1U1ZhhbVJXplbuUnfKpBZ5j5izqIwu2g2W8= +github.com/bufbuild/connect-go v1.5.2/go.mod h1:GmMJYR6orFqD0Y6ZgX8pwQ8j9baizDrIQMm1/a6LnHk= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= diff --git a/package.json b/package.json index 0a83d7d3139..3e123a54c4a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,14 @@ { "devDependencies": { + "@bufbuild/buf": "^1.15.0-1", + "@bufbuild/connect": "^0.8.4", + "@bufbuild/connect-web": "^0.8.4", + "@bufbuild/protobuf": "^1.2.0", + "@bufbuild/protoc-gen-connect-es": "^0.8.4", + "@bufbuild/protoc-gen-connect-web": "^0.8.4", + "@bufbuild/protoc-gen-es": "^1.2.0", "@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/parser": "^5.48.2", - "all-contributors-cli": "6.24.0", - "ts-protoc-gen": "0.15.0" + "all-contributors-cli": "6.24.0" } } diff --git a/pkg/debuginfo/reader.go b/pkg/debuginfo/reader.go index d72bb6ed788..1c17eafc969 100644 --- a/pkg/debuginfo/reader.go +++ b/pkg/debuginfo/reader.go @@ -19,6 +19,7 @@ import ( "fmt" "io" + "github.com/bufbuild/connect-go" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -26,7 +27,7 @@ import ( ) type UploadReader struct { - stream debuginfopb.DebuginfoService_UploadServer + stream *connect.ClientStream[debuginfopb.UploadRequest] cur io.Reader size uint64 } @@ -65,20 +66,14 @@ func (r *UploadReader) Read(p []byte) (int, error) { } func (r *UploadReader) next() (io.Reader, error) { - err := contextError(r.stream.Context()) - if err != nil { - return nil, err + if r.stream.Receive() { + return bytes.NewBuffer(r.stream.Msg().GetChunkData()), nil } - - req, err := r.stream.Recv() + err := r.stream.Err() if err == io.EOF { return nil, io.EOF } - if err != nil { - return nil, fmt.Errorf("receive from stream: %w", err) - } - - return bytes.NewBuffer(req.GetChunkData()), nil + return nil, fmt.Errorf("receive from stream: %w", err) } func contextError(ctx context.Context) error { diff --git a/pkg/debuginfo/store.go b/pkg/debuginfo/store.go index dc8a7cdf2c3..e820abd0082 100644 --- a/pkg/debuginfo/store.go +++ b/pkg/debuginfo/store.go @@ -19,20 +19,21 @@ import ( "errors" "fmt" "io" + "math" "path" "time" + "github.com/bufbuild/connect-go" "github.com/go-kit/log" "github.com/google/uuid" "github.com/thanos-io/objstore" "github.com/thanos-io/objstore/client" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" debuginfopb "github.com/parca-dev/parca/gen/proto/go/parca/debuginfo/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/debuginfo/v1alpha1/debuginfov1alpha1connect" "github.com/parca-dev/parca/pkg/signedupload" ) @@ -66,7 +67,7 @@ type MetadataManager interface { } type Store struct { - debuginfopb.UnimplementedDebuginfoServiceServer + debuginfov1alpha1connect.UnimplementedDebuginfoServiceHandler tracer trace.Tracer logger log.Logger @@ -129,141 +130,141 @@ const ( // ShouldInitiateUpload returns whether an upload should be initiated for the // given build ID. Checking if an upload should even be initiated allows the // parca-agent to avoid extracting debuginfos unnecessarily from a binary. -func (s *Store) ShouldInitiateUpload(ctx context.Context, req *debuginfopb.ShouldInitiateUploadRequest) (*debuginfopb.ShouldInitiateUploadResponse, error) { +func (s *Store) ShouldInitiateUpload(ctx context.Context, req *connect.Request[debuginfopb.ShouldInitiateUploadRequest]) (*connect.Response[debuginfopb.ShouldInitiateUploadResponse], error) { span := trace.SpanFromContext(ctx) - span.SetAttributes(attribute.String("build_id", req.BuildId)) + span.SetAttributes(attribute.String("build_id", req.Msg.BuildId)) - buildID := req.BuildId + buildID := req.Msg.BuildId if err := validateInput(buildID); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } dbginfo, err := s.metadata.Fetch(ctx, buildID) if err != nil && !errors.Is(err, ErrMetadataNotFound) { - return nil, status.Error(codes.Internal, err.Error()) + return nil, connect.NewError(connect.CodeInternal, err) } else if errors.Is(err, ErrMetadataNotFound) { // First time we see this Build ID. existsInDebuginfod, err := s.debuginfodClient.Exists(ctx, buildID) if err != nil { - return nil, status.Error(codes.Internal, err.Error()) + return nil, connect.NewError(connect.CodeInternal, err) } if existsInDebuginfod { if err := s.metadata.MarkAsDebuginfodSource(ctx, buildID); err != nil { - return nil, status.Error(codes.Internal, fmt.Errorf("mark Build ID to be available from debuginfod: %w", err).Error()) + return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("mark Build ID to be available from debuginfod: %w", err)) } - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: false, Reason: ReasonDebuginfoInDebuginfod, - }, nil + }), nil } - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: true, Reason: ReasonFirstTimeSeen, - }, nil + }), nil } else { // We have seen this Build ID before and there is metadata for it. switch dbginfo.Source { case debuginfopb.Debuginfo_SOURCE_UPLOAD: if dbginfo.Upload == nil { - return nil, status.Error(codes.Internal, "metadata inconsistency: upload is nil") + return nil, connect.NewError(connect.CodeInternal, errors.New("metadata inconsistency: upload is nil")) } switch dbginfo.Upload.State { case debuginfopb.DebuginfoUpload_STATE_UPLOADING: if s.uploadIsStale(dbginfo.Upload) { - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: true, Reason: ReasonUploadStale, - }, nil + }), nil } - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: false, Reason: ReasonUploadInProgress, - }, nil + }), nil case debuginfopb.DebuginfoUpload_STATE_UPLOADED: if dbginfo.Quality == nil || !dbginfo.Quality.NotValidElf { - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: false, Reason: ReasonDebuginfoAlreadyExists, - }, nil + }), nil } - if req.Hash == "" { - return &debuginfopb.ShouldInitiateUploadResponse{ + if req.Msg.Hash == "" { + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: true, Reason: ReasonDebuginfoInvalid, - }, nil + }), nil } - if dbginfo.Upload.Hash == req.Hash { - return &debuginfopb.ShouldInitiateUploadResponse{ + if dbginfo.Upload.Hash == req.Msg.Hash { + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: false, Reason: ReasonDebuginfoEqual, - }, nil + }), nil } - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: true, Reason: ReasonDebuginfoNotEqual, - }, nil + }), nil default: - return nil, status.Error(codes.Internal, "metadata inconsistency: unknown upload state") + return nil, connect.NewError(connect.CodeInternal, errors.New("metadata inconsistency: unknown upload state")) } case debuginfopb.Debuginfo_SOURCE_DEBUGINFOD: if dbginfo.Quality == nil || !dbginfo.Quality.NotValidElf { // We already have debuginfo that's also not marked to be // invalid, so we don't need to upload it again. - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: false, Reason: ReasonDebuginfodSource, - }, nil + }), nil } - return &debuginfopb.ShouldInitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.ShouldInitiateUploadResponse{ ShouldInitiateUpload: true, Reason: ReasonDebuginfodInvalid, - }, nil + }), nil default: - return nil, status.Errorf(codes.Internal, "unknown debuginfo source %q", dbginfo.Source) + return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("unknown debuginfo source %q", dbginfo.Source)) } } } -func (s *Store) InitiateUpload(ctx context.Context, req *debuginfopb.InitiateUploadRequest) (*debuginfopb.InitiateUploadResponse, error) { +func (s *Store) InitiateUpload(ctx context.Context, req *connect.Request[debuginfopb.InitiateUploadRequest]) (*connect.Response[debuginfopb.InitiateUploadResponse], error) { span := trace.SpanFromContext(ctx) - span.SetAttributes(attribute.String("build_id", req.BuildId)) + span.SetAttributes(attribute.String("build_id", req.Msg.BuildId)) - if req.Hash == "" { - return nil, status.Error(codes.InvalidArgument, "hash must be set") + if req.Msg.Hash == "" { + return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("hash must be set")) } - if req.Size == 0 { - return nil, status.Error(codes.InvalidArgument, "size must be set") + if req.Msg.Size == 0 { + return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("size must be set")) } // We don't want to blindly accept upload initiation requests that // shouldn't have happened. - shouldInitiateResp, err := s.ShouldInitiateUpload(ctx, &debuginfopb.ShouldInitiateUploadRequest{ - BuildId: req.BuildId, - Hash: req.Hash, - }) + shouldInitiateResp, err := s.ShouldInitiateUpload(ctx, connect.NewRequest(&debuginfopb.ShouldInitiateUploadRequest{ + BuildId: req.Msg.BuildId, + Hash: req.Msg.Hash, + })) if err != nil { return nil, err } - if !shouldInitiateResp.ShouldInitiateUpload { - if shouldInitiateResp.Reason == ReasonDebuginfoEqual { - return nil, status.Error(codes.AlreadyExists, ReasonDebuginfoEqual) + if !shouldInitiateResp.Msg.ShouldInitiateUpload { + if shouldInitiateResp.Msg.Reason == ReasonDebuginfoEqual { + return nil, connect.NewError(connect.CodeAlreadyExists, errors.New(ReasonDebuginfoEqual)) } - return nil, status.Errorf(codes.FailedPrecondition, "upload should not have been attempted to be initiated, a previous check should have failed with: %s", shouldInitiateResp.Reason) + return nil, connect.NewError(connect.CodeFailedPrecondition, fmt.Errorf("upload should not have been attempted to be initiated, a previous check should have failed with: %s", shouldInitiateResp.Msg.Reason)) } - if req.Size > s.maxUploadSize { - return nil, status.Errorf(codes.InvalidArgument, "upload size %d exceeds maximum allowed size %d", req.Size, s.maxUploadSize) + if req.Msg.Size > s.maxUploadSize { + return nil, connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("upload size %d exceeds maximum allowed size %d", req.Msg.Size, s.maxUploadSize)) } uploadID := uuid.New().String() @@ -271,119 +272,117 @@ func (s *Store) InitiateUpload(ctx context.Context, req *debuginfopb.InitiateUpl uploadExpiry := uploadStarted.Add(s.maxUploadDuration) if !s.signedUpload.Enabled { - if err := s.metadata.MarkAsUploading(ctx, req.BuildId, uploadID, req.Hash, timestamppb.New(uploadStarted)); err != nil { + if err := s.metadata.MarkAsUploading(ctx, req.Msg.BuildId, uploadID, req.Msg.Hash, timestamppb.New(uploadStarted)); err != nil { return nil, fmt.Errorf("mark debuginfo upload as uploading via gRPC: %w", err) } - return &debuginfopb.InitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.InitiateUploadResponse{ UploadInstructions: &debuginfopb.UploadInstructions{ - BuildId: req.BuildId, + BuildId: req.Msg.BuildId, UploadId: uploadID, UploadStrategy: debuginfopb.UploadInstructions_UPLOAD_STRATEGY_GRPC, }, - }, nil + }), nil } - signedURL, err := s.signedUpload.Client.SignedPUT(ctx, objectPath(req.BuildId), req.Size, uploadExpiry) + signedURL, err := s.signedUpload.Client.SignedPUT(ctx, objectPath(req.Msg.BuildId), req.Msg.Size, uploadExpiry) if err != nil { - return nil, status.Error(codes.Internal, err.Error()) + return nil, connect.NewError(connect.CodeInternal, err) } - if err := s.metadata.MarkAsUploading(ctx, req.BuildId, uploadID, req.Hash, timestamppb.New(uploadStarted)); err != nil { + if err := s.metadata.MarkAsUploading(ctx, req.Msg.BuildId, uploadID, req.Msg.Hash, timestamppb.New(uploadStarted)); err != nil { return nil, fmt.Errorf("mark debuginfo upload as uploading via signed URL: %w", err) } - return &debuginfopb.InitiateUploadResponse{ + return connect.NewResponse(&debuginfopb.InitiateUploadResponse{ UploadInstructions: &debuginfopb.UploadInstructions{ - BuildId: req.BuildId, + BuildId: req.Msg.BuildId, UploadId: uploadID, UploadStrategy: debuginfopb.UploadInstructions_UPLOAD_STRATEGY_SIGNED_URL, SignedUrl: signedURL, }, - }, nil + }), nil } -func (s *Store) MarkUploadFinished(ctx context.Context, req *debuginfopb.MarkUploadFinishedRequest) (*debuginfopb.MarkUploadFinishedResponse, error) { +func (s *Store) MarkUploadFinished(ctx context.Context, req *connect.Request[debuginfopb.MarkUploadFinishedRequest]) (*connect.Response[debuginfopb.MarkUploadFinishedResponse], error) { span := trace.SpanFromContext(ctx) - span.SetAttributes(attribute.String("build_id", req.BuildId)) - span.SetAttributes(attribute.String("upload_id", req.UploadId)) + span.SetAttributes(attribute.String("build_id", req.Msg.BuildId)) + span.SetAttributes(attribute.String("upload_id", req.Msg.UploadId)) - buildID := req.BuildId + buildID := req.Msg.BuildId if err := validateInput(buildID); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } - err := s.metadata.MarkAsUploaded(ctx, buildID, req.UploadId, timestamppb.New(s.timeNow())) + err := s.metadata.MarkAsUploaded(ctx, buildID, req.Msg.UploadId, timestamppb.New(s.timeNow())) if errors.Is(err, ErrDebuginfoNotFound) { - return nil, status.Error(codes.NotFound, "no debuginfo metadata found for build id") + return nil, connect.NewError(connect.CodeNotFound, errors.New("no debuginfo metadata found for build id")) } if errors.Is(err, ErrUploadMetadataNotFound) { - return nil, status.Error(codes.NotFound, "no debuginfo upload metadata found for build id") + return nil, connect.NewError(connect.CodeNotFound, errors.New("no debuginfo upload metadata found for build id")) } if errors.Is(err, ErrUploadIDMismatch) { - return nil, status.Error(codes.InvalidArgument, "upload id mismatch") + return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("upload id mismatch")) } if err != nil { - return nil, status.Error(codes.Internal, err.Error()) + return nil, connect.NewError(connect.CodeInternal, err) } - return &debuginfopb.MarkUploadFinishedResponse{}, nil + return connect.NewResponse(&debuginfopb.MarkUploadFinishedResponse{}), nil } -func (s *Store) Upload(stream debuginfopb.DebuginfoService_UploadServer) error { +func (s *Store) Upload(ctx context.Context, stream *connect.ClientStream[debuginfopb.UploadRequest]) (*connect.Response[debuginfopb.UploadResponse], error) { if s.signedUpload.Enabled { - return status.Error(codes.Unimplemented, "signed URL uploads are the only supported upload strategy for this service") + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signed URL uploads are the only supported upload strategy for this service")) } - req, err := stream.Recv() - if err != nil { - return status.Errorf(codes.Unknown, "failed to receive upload info: %q", err) + stream.Receive() + if err := stream.Err(); err != nil { + return nil, connect.NewError(connect.CodeUnknown, err) } var ( - buildID = req.GetInfo().BuildId - uploadID = req.GetInfo().UploadId + buildID = stream.Msg().GetInfo().GetBuildId() + uploadID = stream.Msg().GetInfo().UploadId r = &UploadReader{stream: stream} ) - - ctx := stream.Context() span := trace.SpanFromContext(ctx) span.SetAttributes(attribute.String("build_id", buildID)) span.SetAttributes(attribute.String("upload_id", uploadID)) if err := s.upload(ctx, buildID, uploadID, r); err != nil { - return err + return nil, connect.NewError(connect.CodeUnknown, err) } - return stream.SendAndClose(&debuginfopb.UploadResponse{ + return connect.NewResponse(&debuginfopb.UploadResponse{ BuildId: buildID, - Size: r.size, - }) + Size: math.MaxUint64, // TODO: return the size of the uploaded file + }), nil } func (s *Store) upload(ctx context.Context, buildID, uploadID string, r io.Reader) error { if err := validateInput(buildID); err != nil { - return status.Errorf(codes.InvalidArgument, "invalid build ID: %q", err) + return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("invalid build ID: %q", err)) } dbginfo, err := s.metadata.Fetch(ctx, buildID) if err != nil { if errors.Is(err, ErrMetadataNotFound) { - return status.Error(codes.FailedPrecondition, "metadata not found, this indicates that the upload was not previously initiated") + return connect.NewError(connect.CodeFailedPrecondition, errors.New("metadata not found, this indicates that the upload was not previously initiated")) } - return status.Error(codes.Internal, err.Error()) + return connect.NewError(connect.CodeInternal, err) } if dbginfo.Upload == nil { - return status.Error(codes.FailedPrecondition, "metadata not found, this indicates that the upload was not previously initiated") + return connect.NewError(connect.CodeFailedPrecondition, errors.New("metadata not found, this indicates that the upload was not previously initiated")) } if dbginfo.Upload.Id != uploadID { - return status.Error(codes.InvalidArgument, "the upload ID does not match the one returned by the InitiateUpload call") + return connect.NewError(connect.CodeInvalidArgument, errors.New("the upload ID does not match the one returned by the InitiateUpload call")) } if err := s.bucket.Upload(ctx, objectPath(buildID), r); err != nil { - return status.Error(codes.Internal, fmt.Errorf("upload debuginfo: %w", err).Error()) + return connect.NewError(connect.CodeInternal, fmt.Errorf("upload debuginfo: %w", err)) } return nil diff --git a/pkg/parca/parca.go b/pkg/parca/parca.go index b81c06b4701..c087a4e173f 100644 --- a/pkg/parca/parca.go +++ b/pkg/parca/parca.go @@ -18,6 +18,7 @@ import ( "crypto/tls" "errors" "fmt" + "net/http" "os" "path/filepath" goruntime "runtime" @@ -27,10 +28,10 @@ import ( "github.com/apache/arrow/go/v10/arrow/memory" "github.com/dgraph-io/badger/v3" + "github.com/go-chi/chi/v5" "github.com/go-kit/log" "github.com/go-kit/log/level" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/oklog/run" "github.com/polarsignals/frostdb" "github.com/polarsignals/frostdb/dynparquet" @@ -52,11 +53,11 @@ import ( "google.golang.org/grpc/credentials/insecure" "gopkg.in/yaml.v3" - debuginfopb "github.com/parca-dev/parca/gen/proto/go/parca/debuginfo/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/debuginfo/v1alpha1/debuginfov1alpha1connect" metastorepb "github.com/parca-dev/parca/gen/proto/go/parca/metastore/v1alpha1" - profilestorepb "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1" - querypb "github.com/parca-dev/parca/gen/proto/go/parca/query/v1alpha1" - scrapepb "github.com/parca-dev/parca/gen/proto/go/parca/scrape/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect" + "github.com/parca-dev/parca/gen/proto/go/parca/query/v1alpha1/queryv1alpha1connect" + "github.com/parca-dev/parca/gen/proto/go/parca/scrape/v1alpha1/scrapev1alpha1connect" sharepb "github.com/parca-dev/parca/gen/proto/go/parca/share/v1alpha1" "github.com/parca-dev/parca/pkg/config" "github.com/parca-dev/parca/pkg/debuginfo" @@ -460,35 +461,34 @@ func Run(ctx context.Context, logger log.Logger, reg *prometheus.Registry, flags flags.HTTPAddress, flags.CORSAllowedOrigins, flags.PathPrefix, - server.RegisterableFunc(func(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error { - debuginfopb.RegisterDebuginfoServiceServer(srv, dbginfo) - profilestorepb.RegisterProfileStoreServiceServer(srv, s) - profilestorepb.RegisterAgentsServiceServer(srv, s) - querypb.RegisterQueryServiceServer(srv, q) - scrapepb.RegisterScrapeServiceServer(srv, m) - - if err := debuginfopb.RegisterDebuginfoServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } + func(r chi.Router) { + patterns := []string{} + handlers := []http.Handler{} - if err := profilestorepb.RegisterProfileStoreServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } + debuginfoPattern, debuginfoHandler := debuginfov1alpha1connect.NewDebuginfoServiceHandler(dbginfo) + patterns = append(patterns, debuginfoPattern) + handlers = append(handlers, debuginfoHandler) - if err := profilestorepb.RegisterAgentsServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } + profilestorePattern, profilestoreHandler := profilestorev1alpha1connect.NewProfileStoreServiceHandler(s) + patterns = append(patterns, profilestorePattern) + handlers = append(handlers, profilestoreHandler) - if err := querypb.RegisterQueryServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } + agentsPattern, agentsHandler := profilestorev1alpha1connect.NewAgentsServiceHandler(s) + patterns = append(patterns, agentsPattern) + handlers = append(handlers, agentsHandler) - if err := scrapepb.RegisterScrapeServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } + queryPattern, queryHandler := queryv1alpha1connect.NewQueryServiceHandler(q) + patterns = append(patterns, queryPattern) + handlers = append(handlers, queryHandler) + + scrapePattern, scrapeHandler := scrapev1alpha1connect.NewScrapeServiceHandler(m) + patterns = append(patterns, scrapePattern) + handlers = append(handlers, scrapeHandler) - return nil - }), + for i, pattern := range patterns { + r.Mount("/api"+pattern, http.StripPrefix("/api", handlers[i])) + } + }, ) }, func(_ error) { @@ -651,13 +651,16 @@ func runScraper( flags.HTTPAddress, flags.CORSAllowedOrigins, flags.PathPrefix, - server.RegisterableFunc(func(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error { - scrapepb.RegisterScrapeServiceServer(srv, m) - if err := scrapepb.RegisterScrapeServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { - return err - } - return nil - }), + func(r chi.Router) { + r.Mount(scrapev1alpha1connect.NewScrapeServiceHandler(m)) + }, + //server.RegisterableFunc(func(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error { + // scrapepb.RegisterScrapeServiceServer(srv, m) + // if err := scrapepb.RegisterScrapeServiceHandlerFromEndpoint(ctx, mux, endpoint, opts); err != nil { + // return err + // } + // return nil + //}), ) }, func(_ error) { diff --git a/pkg/profilestore/grpc.go b/pkg/profilestore/grpc.go index 21e39b1a107..1fe48c2ed2c 100644 --- a/pkg/profilestore/grpc.go +++ b/pkg/profilestore/grpc.go @@ -16,6 +16,7 @@ package profilestore import ( "context" + "github.com/bufbuild/connect-go" "github.com/go-kit/log" "github.com/go-kit/log/level" "google.golang.org/grpc" @@ -39,12 +40,12 @@ func NewGRPCForwarder(conn grpc.ClientConnInterface, logger log.Logger) *GRPCFor } } -func (s *GRPCForwarder) WriteRaw(ctx context.Context, req *profilestorepb.WriteRawRequest) (*profilestorepb.WriteRawResponse, error) { +func (s *GRPCForwarder) WriteRaw(ctx context.Context, req *connect.Request[profilestorepb.WriteRawRequest]) (*connect.Response[profilestorepb.WriteRawResponse], error) { // TODO: Batch writes to only send a request every now and then. // See https://github.com/parca-dev/parca-agent/blob/main/pkg/agent/write_client.go#L28 - resp, err := s.client.WriteRaw(ctx, req) + resp, err := s.client.WriteRaw(ctx, req.Msg) if err != nil { level.Warn(s.logger).Log("msg", "failed to forward profiles", "err", err) } - return resp, err + return connect.NewResponse(resp), err } diff --git a/pkg/profilestore/profilecolumnstore.go b/pkg/profilestore/profilecolumnstore.go index 39ed380543e..b6827421cc5 100644 --- a/pkg/profilestore/profilecolumnstore.go +++ b/pkg/profilestore/profilecolumnstore.go @@ -20,6 +20,7 @@ import ( "sync" "time" + "github.com/bufbuild/connect-go" "github.com/go-kit/log" "github.com/polarsignals/frostdb" "github.com/polarsignals/frostdb/dynparquet" @@ -30,6 +31,7 @@ import ( metastorepb "github.com/parca-dev/parca/gen/proto/go/parca/metastore/v1alpha1" profilestorepb "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect" "github.com/parca-dev/parca/pkg/parcacol" ) @@ -41,8 +43,8 @@ type agent struct { } type ProfileColumnStore struct { - profilestorepb.UnimplementedProfileStoreServiceServer - profilestorepb.UnimplementedAgentsServiceServer + profilestorev1alpha1connect.UnimplementedProfileStoreServiceHandler + profilestorev1alpha1connect.UnimplementedAgentsServiceHandler logger log.Logger tracer trace.Tracer @@ -58,8 +60,6 @@ type ProfileColumnStore struct { bufferPool *sync.Pool } -var _ profilestorepb.ProfileStoreServiceServer = &ProfileColumnStore{} - func NewProfileColumnStore( logger log.Logger, tracer trace.Tracer, @@ -125,16 +125,16 @@ found: return nodeName, true } -func (s *ProfileColumnStore) WriteRaw(ctx context.Context, req *profilestorepb.WriteRawRequest) (*profilestorepb.WriteRawResponse, error) { +func (s *ProfileColumnStore) WriteRaw(ctx context.Context, req *connect.Request[profilestorepb.WriteRawRequest]) (*connect.Response[profilestorepb.WriteRawResponse], error) { ctx, span := s.tracer.Start(ctx, "write-raw") defer span.End() start := time.Now() - writeErr := s.writeSeries(ctx, req) + writeErr := s.writeSeries(ctx, req.Msg) // update agent info only when the request is come from agent - if p, ok := peer.FromContext(ctx); ok && len(req.Series) != 0 { - nodeName, _ := nodeNameFromLabels(req.Series) + if p, ok := peer.FromContext(ctx); ok && len(req.Msg.Series) != 0 { + nodeName, _ := nodeNameFromLabels(req.Msg.Series) ag := agent{ nodeName: nodeName, lastPush: start, @@ -151,10 +151,10 @@ func (s *ProfileColumnStore) WriteRaw(ctx context.Context, req *profilestorepb.W return nil, writeErr } - return &profilestorepb.WriteRawResponse{}, nil + return connect.NewResponse(&profilestorepb.WriteRawResponse{}), nil } -func (s *ProfileColumnStore) Agents(ctx context.Context, req *profilestorepb.AgentsRequest) (*profilestorepb.AgentsResponse, error) { +func (s *ProfileColumnStore) Agents(ctx context.Context, req *connect.Request[profilestorepb.AgentsRequest]) (*connect.Response[profilestorepb.AgentsResponse], error) { s.mtx.Lock() defer s.mtx.Unlock() @@ -179,9 +179,7 @@ func (s *ProfileColumnStore) Agents(ctx context.Context, req *profilestorepb.Age }) } - resp := &profilestorepb.AgentsResponse{ + return connect.NewResponse(&profilestorepb.AgentsResponse{ Agents: agents, - } - - return resp, nil + }), nil } diff --git a/pkg/query/columnquery.go b/pkg/query/columnquery.go index 85f7ef75823..11cdedc58c4 100644 --- a/pkg/query/columnquery.go +++ b/pkg/query/columnquery.go @@ -21,6 +21,7 @@ import ( "sync" "time" + "github.com/bufbuild/connect-go" "github.com/go-kit/log" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" @@ -30,6 +31,7 @@ import ( metastorev1alpha1 "github.com/parca-dev/parca/gen/proto/go/parca/metastore/v1alpha1" pb "github.com/parca-dev/parca/gen/proto/go/parca/query/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/query/v1alpha1/queryv1alpha1connect" sharepb "github.com/parca-dev/parca/gen/proto/go/parca/share/v1alpha1" "github.com/parca-dev/parca/pkg/profile" ) @@ -46,7 +48,7 @@ type Querier interface { // ColumnQueryAPI is the read api interface for parca // It implements the proto/query/query.proto APIServer interface. type ColumnQueryAPI struct { - pb.UnimplementedQueryServiceServer + queryv1alpha1connect.UnimplementedQueryServiceHandler logger log.Logger tracer trace.Tracer @@ -89,60 +91,60 @@ func newTableConverterPool() *sync.Pool { } // Labels issues a labels request against the storage. -func (q *ColumnQueryAPI) Labels(ctx context.Context, req *pb.LabelsRequest) (*pb.LabelsResponse, error) { - vals, err := q.querier.Labels(ctx, req.Match, req.Start.AsTime(), req.End.AsTime()) +func (q *ColumnQueryAPI) Labels(ctx context.Context, req *connect.Request[pb.LabelsRequest]) (*connect.Response[pb.LabelsResponse], error) { + vals, err := q.querier.Labels(ctx, req.Msg.Match, req.Msg.Start.AsTime(), req.Msg.End.AsTime()) if err != nil { return nil, err } - return &pb.LabelsResponse{ + return connect.NewResponse(&pb.LabelsResponse{ LabelNames: vals, - }, nil + }), nil } // Values issues a values request against the storage. -func (q *ColumnQueryAPI) Values(ctx context.Context, req *pb.ValuesRequest) (*pb.ValuesResponse, error) { - vals, err := q.querier.Values(ctx, req.LabelName, req.Match, req.Start.AsTime(), req.End.AsTime()) +func (q *ColumnQueryAPI) Values(ctx context.Context, req *connect.Request[pb.ValuesRequest]) (*connect.Response[pb.ValuesResponse], error) { + vals, err := q.querier.Values(ctx, req.Msg.LabelName, req.Msg.Match, req.Msg.Start.AsTime(), req.Msg.End.AsTime()) if err != nil { return nil, err } - return &pb.ValuesResponse{ + return connect.NewResponse(&pb.ValuesResponse{ LabelValues: vals, - }, nil + }), nil } // QueryRange issues a range query against the storage. -func (q *ColumnQueryAPI) QueryRange(ctx context.Context, req *pb.QueryRangeRequest) (*pb.QueryRangeResponse, error) { - if err := req.Validate(); err != nil { +func (q *ColumnQueryAPI) QueryRange(ctx context.Context, req *connect.Request[pb.QueryRangeRequest]) (*connect.Response[pb.QueryRangeResponse], error) { + if err := req.Msg.Validate(); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - res, err := q.querier.QueryRange(ctx, req.Query, req.Start.AsTime(), req.End.AsTime(), req.Step.AsDuration(), req.Limit) + res, err := q.querier.QueryRange(ctx, req.Msg.Query, req.Msg.Start.AsTime(), req.Msg.End.AsTime(), req.Msg.Step.AsDuration(), req.Msg.Limit) if err != nil { return nil, err } - return &pb.QueryRangeResponse{ + return connect.NewResponse(&pb.QueryRangeResponse{ Series: res, - }, nil + }), nil } // Types returns the available types of profiles. -func (q *ColumnQueryAPI) ProfileTypes(ctx context.Context, req *pb.ProfileTypesRequest) (*pb.ProfileTypesResponse, error) { +func (q *ColumnQueryAPI) ProfileTypes(ctx context.Context, req *connect.Request[pb.ProfileTypesRequest]) (*connect.Response[pb.ProfileTypesResponse], error) { types, err := q.querier.ProfileTypes(ctx) if err != nil { return nil, err } - return &pb.ProfileTypesResponse{ + return connect.NewResponse(&pb.ProfileTypesResponse{ Types: types, - }, nil + }), nil } // Query issues an instant query against the storage. -func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.QueryResponse, error) { - if err := req.Validate(); err != nil { +func (q *ColumnQueryAPI) Query(ctx context.Context, req *connect.Request[pb.QueryRequest]) (*connect.Response[pb.QueryResponse], error) { + if err := req.Msg.Validate(); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -152,13 +154,13 @@ func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.Q err error ) - switch req.Mode { + switch req.Msg.Mode { case pb.QueryRequest_MODE_SINGLE_UNSPECIFIED: - p, err = q.selectSingle(ctx, req.GetSingle()) + p, err = q.selectSingle(ctx, req.Msg.GetSingle()) case pb.QueryRequest_MODE_MERGE: - p, err = q.selectMerge(ctx, req.GetMerge()) + p, err = q.selectMerge(ctx, req.Msg.GetMerge()) case pb.QueryRequest_MODE_DIFF: - p, err = q.selectDiff(ctx, req.GetDiff()) + p, err = q.selectDiff(ctx, req.Msg.GetDiff()) default: return nil, status.Error(codes.InvalidArgument, "unknown query mode") } @@ -166,15 +168,15 @@ func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.Q return nil, err } - if req.FilterQuery != nil { - p, filtered = FilterProfileData(ctx, q.tracer, p, req.GetFilterQuery()) + if req.Msg.FilterQuery != nil { + p, filtered = FilterProfileData(ctx, q.tracer, p, req.Msg.GetFilterQuery()) } return q.renderReport( ctx, p, - req.GetReportType(), - req.GetNodeTrimThreshold(), + req.Msg.GetReportType(), + req.Msg.GetNodeTrimThreshold(), filtered, ) } @@ -236,7 +238,7 @@ func (q *ColumnQueryAPI) renderReport( typ pb.QueryRequest_ReportType, nodeTrimThreshold float32, filtered int64, -) (*pb.QueryResponse, error) { +) (*connect.Response[pb.QueryResponse], error) { return RenderReport(ctx, q.tracer, p, typ, nodeTrimThreshold, filtered, q.tableConverterPool) } @@ -248,7 +250,7 @@ func RenderReport( nodeTrimThreshold float32, filtered int64, pool *sync.Pool, -) (*pb.QueryResponse, error) { +) (*connect.Response[pb.QueryResponse], error) { ctx, span := tracer.Start(ctx, "renderReport") span.SetAttributes(attribute.String("reportType", typ.String())) defer span.End() @@ -265,26 +267,26 @@ func RenderReport( if err != nil { return nil, status.Errorf(codes.Internal, "failed to generate flamegraph: %v", err.Error()) } - return &pb.QueryResponse{ + return connect.NewResponse(&pb.QueryResponse{ Total: fg.Total, Filtered: filtered, Report: &pb.QueryResponse_Flamegraph{ Flamegraph: fg, }, - }, nil + }), nil case pb.QueryRequest_REPORT_TYPE_FLAMEGRAPH_TABLE: fg, err := GenerateFlamegraphTable(ctx, tracer, p, nodeTrimFraction, pool) if err != nil { return nil, status.Errorf(codes.Internal, "failed to generate flamegraph: %v", err.Error()) } - return &pb.QueryResponse{ + return connect.NewResponse(&pb.QueryResponse{ //nolint:staticcheck // SA1019: TODO: The cumulative should be passed differently in the future. Total: fg.Total, Filtered: filtered, Report: &pb.QueryResponse_Flamegraph{ Flamegraph: fg, }, - }, nil + }), nil case pb.QueryRequest_REPORT_TYPE_PPROF: pp, err := GenerateFlatPprof(ctx, p) if err != nil { @@ -296,34 +298,34 @@ func RenderReport( return nil, status.Errorf(codes.Internal, "failed to generate pprof: %v", err.Error()) } - return &pb.QueryResponse{ + return connect.NewResponse(&pb.QueryResponse{ Total: 0, // TODO: Figure out how to get total for pprof Filtered: filtered, Report: &pb.QueryResponse_Pprof{Pprof: buf.Bytes()}, - }, nil + }), nil case pb.QueryRequest_REPORT_TYPE_TOP: top, err := GenerateTopTable(ctx, p) if err != nil { return nil, status.Errorf(codes.Internal, "failed to generate pprof: %v", err.Error()) } - return &pb.QueryResponse{ + return connect.NewResponse(&pb.QueryResponse{ //nolint:staticcheck // SA1019: TODO: The cumulative should be passed differently in the future. Total: int64(top.Total), Filtered: filtered, Report: &pb.QueryResponse_Top{Top: top}, - }, nil + }), nil case pb.QueryRequest_REPORT_TYPE_CALLGRAPH: callgraph, err := GenerateCallgraph(ctx, p) if err != nil { return nil, status.Errorf(codes.Internal, "failed to generate callgraph: %v", err.Error()) } - return &pb.QueryResponse{ + return connect.NewResponse(&pb.QueryResponse{ //nolint:staticcheck // SA1019: TODO: The cumulative should be passed differently in the future. Total: callgraph.Cumulative, Filtered: filtered, Report: &pb.QueryResponse_Callgraph{Callgraph: callgraph}, - }, nil + }), nil default: return nil, status.Error(codes.InvalidArgument, "requested report type does not exist") } @@ -426,20 +428,21 @@ func (q *ColumnQueryAPI) selectProfileForDiff(ctx context.Context, s *pb.Profile } } -func (q *ColumnQueryAPI) ShareProfile(ctx context.Context, req *pb.ShareProfileRequest) (*pb.ShareProfileResponse, error) { - req.QueryRequest.ReportType = pb.QueryRequest_REPORT_TYPE_PPROF - resp, err := q.Query(ctx, req.QueryRequest) +func (q *ColumnQueryAPI) ShareProfile(ctx context.Context, req *connect.Request[pb.ShareProfileRequest]) (*connect.Response[pb.ShareProfileResponse], error) { + req.Msg.QueryRequest.ReportType = pb.QueryRequest_REPORT_TYPE_PPROF + resp, err := q.Query(ctx, connect.NewRequest(req.Msg.QueryRequest)) if err != nil { return nil, err } uploadResp, err := q.shareClient.Upload(ctx, &sharepb.UploadRequest{ - Profile: resp.GetPprof(), - Description: *req.Description, + Profile: resp.Msg.GetPprof(), + Description: *req.Msg.Description, }) if err != nil { return nil, status.Errorf(codes.Internal, "failed to upload profile: %s", err.Error()) } - return &pb.ShareProfileResponse{ + + return connect.NewResponse(&pb.ShareProfileResponse{ Link: uploadResp.Link, - }, nil + }), nil } diff --git a/pkg/scrape/manager.go b/pkg/scrape/manager.go index 2129c77ea56..18b26b935c6 100644 --- a/pkg/scrape/manager.go +++ b/pkg/scrape/manager.go @@ -24,8 +24,8 @@ import ( "github.com/prometheus/prometheus/discovery/targetgroup" "github.com/prometheus/prometheus/model/labels" - profilepb "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1" - scrapepb "github.com/parca-dev/parca/gen/proto/go/parca/scrape/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect" + "github.com/parca-dev/parca/gen/proto/go/parca/scrape/v1alpha1/scrapev1alpha1connect" "github.com/parca-dev/parca/pkg/config" ) @@ -33,7 +33,7 @@ import ( func NewManager( logger log.Logger, reg prometheus.Registerer, - store profilepb.ProfileStoreServiceServer, + store profilestorev1alpha1connect.ProfileStoreServiceHandler, scrapeConfigs []*config.ScrapeConfig, externalLabels labels.Labels, ) *Manager { @@ -119,10 +119,10 @@ func NewManager( // Manager maintains a set of scrape pools and manages start/stop cycles // when receiving new target groups form the discovery manager. type Manager struct { - scrapepb.UnimplementedScrapeServiceServer + scrapev1alpha1connect.UnimplementedScrapeServiceHandler logger log.Logger - store profilepb.ProfileStoreServiceServer + store profilestorev1alpha1connect.ProfileStoreServiceHandler graceShut chan struct{} externalLabels labels.Labels diff --git a/pkg/scrape/scrape.go b/pkg/scrape/scrape.go index a78b5964dba..3125847e97d 100644 --- a/pkg/scrape/scrape.go +++ b/pkg/scrape/scrape.go @@ -22,6 +22,7 @@ import ( "sync" "time" + "github.com/bufbuild/connect-go" "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" @@ -33,12 +34,13 @@ import ( "golang.org/x/net/context/ctxhttp" profilepb "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1" + "github.com/parca-dev/parca/gen/proto/go/parca/profilestore/v1alpha1/profilestorev1alpha1connect" "github.com/parca-dev/parca/pkg/config" ) // scrapePool manages scrapes for sets of targets. type scrapePool struct { - store profilepb.ProfileStoreServiceServer + store profilestorev1alpha1connect.ProfileStoreServiceHandler logger log.Logger metrics *scrapePoolMetrics @@ -69,7 +71,7 @@ type scrapePoolMetrics struct { func newScrapePool( cfg *config.ScrapeConfig, - store profilepb.ProfileStoreServiceServer, + store profilestorev1alpha1connect.ProfileStoreServiceHandler, logger log.Logger, externalLabels labels.Labels, metrics *scrapePoolMetrics, @@ -368,7 +370,7 @@ type scrapeLoop struct { buffers *pool.Pool - store profilepb.ProfileStoreServiceServer + store profilestorev1alpha1connect.ProfileStoreServiceHandler ctx context.Context scrapeCtx context.Context cancel func() @@ -382,7 +384,7 @@ func newScrapeLoop(ctx context.Context, externalLabels labels.Labels, targetIntervalLength *prometheus.SummaryVec, buffers *pool.Pool, - store profilepb.ProfileStoreServiceServer, + store profilestorev1alpha1connect.ProfileStoreServiceHandler, normalizedAddresses bool, ) *scrapeLoop { if l == nil { @@ -486,7 +488,7 @@ mainLoop: }) } - _, err := sl.store.WriteRaw(sl.ctx, &profilepb.WriteRawRequest{ + _, err := sl.store.WriteRaw(sl.ctx, connect.NewRequest(&profilepb.WriteRawRequest{ Normalized: sl.normalizedAddresses, Series: []*profilepb.RawProfileSeries{ { @@ -498,7 +500,7 @@ mainLoop: }, }, }, - }) + })) if err != nil { switch errc { case nil: diff --git a/pkg/scrape/service.go b/pkg/scrape/service.go index a3613933ed9..36e7a7b43f7 100644 --- a/pkg/scrape/service.go +++ b/pkg/scrape/service.go @@ -16,6 +16,7 @@ package scrape import ( "context" + "github.com/bufbuild/connect-go" "github.com/prometheus/prometheus/model/labels" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" @@ -25,9 +26,9 @@ import ( ) // Targets implements the Targets RCP. -func (m *Manager) Targets(ctx context.Context, req *pb.TargetsRequest) (*pb.TargetsResponse, error) { +func (m *Manager) Targets(ctx context.Context, req *connect.Request[pb.TargetsRequest]) (*connect.Response[pb.TargetsResponse], error) { var targets map[string][]*Target - switch req.State { + switch req.Msg.State { case pb.TargetsRequest_STATE_ACTIVE: targets = m.TargetsActive() case pb.TargetsRequest_STATE_DROPPED: @@ -67,7 +68,7 @@ func (m *Manager) Targets(ctx context.Context, req *pb.TargetsRequest) (*pb.Targ } } - return resp, nil + return connect.NewResponse(resp), nil } // ProtoLabelsFromLabels converts labels.Labels into a proto label set. diff --git a/pkg/server/server.go b/pkg/server/server.go index 5fd2959678c..b7531f0c73a 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -27,42 +27,19 @@ import ( "github.com/felixge/fgprof" "github.com/go-chi/chi/v5" "github.com/go-chi/cors" + chicors "github.com/go-chi/cors" "github.com/go-kit/log" "github.com/go-kit/log/level" - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" - "github.com/grpc-ecosystem/go-grpc-middleware/providers/kit/v2" grpc_logging "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" - grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/improbable-eng/grpc-web/go/grpcweb" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" - "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials/insecure" - grpc_health "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/reflection" - "google.golang.org/grpc/status" - "github.com/parca-dev/parca/pkg/debuginfo" "github.com/parca-dev/parca/pkg/prober" "github.com/parca-dev/parca/ui" ) -type Registerable interface { - Register(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error -} - -type RegisterableFunc func(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error - -func (f RegisterableFunc) Register(ctx context.Context, srv *grpc.Server, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error { - return f(ctx, srv, mux, endpoint, opts) -} - // MapAllowedLevels allows to map a given level to a list of allowed level. // Convention taken from go-kit/level v0.10.0 https://godoc.org/github.com/go-kit/kit/log/level#AllowAll. var MapAllowedLevels = map[string][]string{ @@ -89,70 +66,90 @@ func NewServer(reg *prometheus.Registry, version string) *Server { } // ListenAndServe starts the http grpc gateway server. -func (s *Server) ListenAndServe(ctx context.Context, logger log.Logger, addr string, allowedCORSOrigins []string, pathPrefix string, registerables ...Registerable) error { +func (s *Server) ListenAndServe(ctx context.Context, logger log.Logger, addr string, allowedCORSOrigins []string, pathPrefix string, registerables func(chi.Router)) error { level.Info(logger).Log("msg", "starting server", "addr", addr) - logLevel := "ERROR" - - logOpts := []grpc_logging.Option{ - grpc_logging.WithDecider(func(_ string, err error) grpc_logging.Decision { - runtimeLevel := grpc_logging.DefaultServerCodeToLevel(status.Code(err)) - for _, lvl := range MapAllowedLevels[logLevel] { - if string(runtimeLevel) == strings.ToLower(lvl) { - return grpc_logging.LogFinishCall - } - } - return grpc_logging.NoLogCall - }), - grpc_logging.WithLevels(DefaultCodeToLevelGRPC), - } - - met := grpc_prometheus.NewServerMetrics() - met.EnableHandlingTimeHistogram( - grpc_prometheus.WithHistogramBuckets([]float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}), - ) + // logLevel := "ERROR" - // Start grpc server with API server registered - srv := grpc.NewServer( - // It is increased to 32MB to account for large protobuf messages (debug information uploads and downloads). - grpc.MaxSendMsgSize(debuginfo.MaxMsgSize), - grpc.MaxRecvMsgSize(debuginfo.MaxMsgSize), - grpc.StreamInterceptor( - grpc_middleware.ChainStreamServer( - otelgrpc.StreamServerInterceptor(), - met.StreamServerInterceptor(), - grpc_logging.StreamServerInterceptor(kit.InterceptorLogger(logger), logOpts...), - )), - grpc.UnaryInterceptor( - grpc_middleware.ChainUnaryServer( - otelgrpc.UnaryServerInterceptor(), - met.UnaryServerInterceptor(), - grpc_logging.UnaryServerInterceptor(kit.InterceptorLogger(logger), logOpts...), - ), - ), - ) - - opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} - - grpcWebMux := runtime.NewServeMux() - for _, r := range registerables { - if err := r.Register(ctx, srv, grpcWebMux, addr, opts); err != nil { - return err - } + allowAll := false + if len(allowedCORSOrigins) == 1 && allowedCORSOrigins[0] == "*" { + allowAll = true + } + origins := map[string]struct{}{} + for _, o := range allowedCORSOrigins { + origins[o] = struct{}{} } - reflection.Register(srv) - grpc_health.RegisterHealthServer(srv, s.grpcProbe.HealthServer()) - internalMux := chi.NewRouter() - if pathPrefix != "" { - internalMux.Mount(pathPrefix+"/api", grpcWebMux) + corsOptions := cors.Options{ + AllowOriginFunc: func(r *http.Request, origin string) bool { + _, found := origins[origin] + return found || allowAll + }, + AllowedHeaders: []string{"*"}, + AllowedMethods: []string{ + http.MethodHead, + http.MethodGet, + http.MethodPost, + http.MethodPut, + http.MethodPatch, + http.MethodDelete, + }, + AllowCredentials: true, } - internalMux.Mount("/api", grpcWebMux) - internalMux.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) { + handler := chi.NewRouter() + handler.Use(chicors.Handler(corsOptions)) + + //logOpts := []grpc_logging.Option{ + // grpc_logging.WithDecider(func(_ string, err error) grpc_logging.Decision { + // runtimeLevel := grpc_logging.DefaultServerCodeToLevel(status.Code(err)) + // for _, lvl := range MapAllowedLevels[logLevel] { + // if string(runtimeLevel) == strings.ToLower(lvl) { + // return grpc_logging.LogFinishCall + // } + // } + // return grpc_logging.NoLogCall + // }), + // grpc_logging.WithLevels(DefaultCodeToLevelGRPC), + //} + + //met := grpc_prometheus.NewServerMetrics() + //met.EnableHandlingTimeHistogram( + // grpc_prometheus.WithHistogramBuckets([]float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}), + //) + + //// Start grpc server with API server registered + //srv := grpc.NewServer( + // // It is increased to 32MB to account for large protobuf messages (debug information uploads and downloads). + // grpc.MaxSendMsgSize(debuginfo.MaxMsgSize), + // grpc.MaxRecvMsgSize(debuginfo.MaxMsgSize), + // grpc.StreamInterceptor( + // grpc_middleware.ChainStreamServer( + // otelgrpc.StreamServerInterceptor(), + // met.StreamServerInterceptor(), + // grpc_logging.StreamServerInterceptor(kit.InterceptorLogger(logger), logOpts...), + // )), + // grpc.UnaryInterceptor( + // grpc_middleware.ChainUnaryServer( + // otelgrpc.UnaryServerInterceptor(), + // met.UnaryServerInterceptor(), + // grpc_logging.UnaryServerInterceptor(kit.InterceptorLogger(logger), logOpts...), + // ), + // ), + //) + + // opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} + + // Register the grpc handlers with the /api prefix. + registerables(handler) + + // reflection.Register(srv) + // grpc_health.RegisterHealthServer(srv, s.grpcProbe.HealthServer()) + + handler.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) { promhttp.HandlerFor(s.reg, promhttp.HandlerOpts{}).ServeHTTP(w, r) }) // Add the pprof handler to profile Parca - internalMux.HandleFunc("/debug/pprof/*", func(w http.ResponseWriter, r *http.Request) { + handler.HandleFunc("/debug/pprof/*", func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/debug/pprof/profile" { pprof.Profile(w, r) return @@ -174,20 +171,17 @@ func (s *Server) ListenAndServe(ctx context.Context, logger log.Logger, addr str if err != nil { return fmt.Errorf("failed to walk ui filesystem: %w", err) } + handler.Mount("/", uiHandler) s.Server = http.Server{ - Addr: addr, - Handler: grpcHandlerFunc( - srv, - fallbackNotFound(internalMux, uiHandler), - allowedCORSOrigins, - ), + Addr: addr, + Handler: handler, ReadTimeout: 5 * time.Second, // TODO make config option WriteTimeout: time.Minute, // TODO make config option } - met.InitializeMetrics(srv) - s.reg.MustRegister(met) + // met.InitializeMetrics(srv) + // s.reg.MustRegister(met) s.reg.MustRegister( collectors.NewBuildInfoCollector(), @@ -281,53 +275,6 @@ func (s *Server) uiHandler(uiFS fs.FS, pathPrefix string) (*http.ServeMux, error return &uiHandler, nil } -func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler, allowedCORSOrigins []string) http.Handler { - allowAll := false - if len(allowedCORSOrigins) == 1 && allowedCORSOrigins[0] == "*" { - allowAll = true - } - origins := map[string]struct{}{} - for _, o := range allowedCORSOrigins { - origins[o] = struct{}{} - } - wrappedGrpc := grpcweb.WrapServer(grpcServer, - grpcweb.WithAllowNonRootResource(true), - grpcweb.WithOriginFunc(func(origin string) bool { - _, found := origins[origin] - return found || allowAll - })) - - corsMiddleware := cors.New(cors.Options{ - AllowOriginFunc: func(r *http.Request, origin string) bool { - _, found := origins[origin] - return found || allowAll - }, - AllowedHeaders: []string{"*"}, - AllowedMethods: []string{ - http.MethodHead, - http.MethodGet, - http.MethodPost, - http.MethodPut, - http.MethodPatch, - http.MethodDelete, - }, - AllowCredentials: true, - }) - - return corsMiddleware.Handler(h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") { - grpcServer.ServeHTTP(w, r) - } else { - if wrappedGrpc.IsGrpcWebRequest(r) { - wrappedGrpc.ServeHTTP(w, r) - return - } - - otherHandler.ServeHTTP(w, r) - } - }), &http2.Server{})) -} - // DefaultCodeToLevelGRPC is the helper mapper that maps gRPC Response codes to log levels. func DefaultCodeToLevelGRPC(c codes.Code) grpc_logging.Level { switch c { diff --git a/ui/packages/app/web/src/components/Targets/AgentsTable.tsx b/ui/packages/app/web/src/components/Targets/AgentsTable.tsx index 685384513fb..d7edcc21074 100644 --- a/ui/packages/app/web/src/components/Targets/AgentsTable.tsx +++ b/ui/packages/app/web/src/components/Targets/AgentsTable.tsx @@ -13,7 +13,7 @@ import React from 'react'; -import {Agent} from '@parca/client'; +import {Agent} from '@parca/client/src/connect'; import {TimeObject} from '@parca/utilities'; import LastScrapeCell from './LastScrapeCell'; diff --git a/ui/packages/app/web/src/pages/targets.tsx b/ui/packages/app/web/src/pages/targets.tsx index 180cc6da429..4a22511a8b9 100644 --- a/ui/packages/app/web/src/pages/targets.tsx +++ b/ui/packages/app/web/src/pages/targets.tsx @@ -13,19 +13,19 @@ import React, {useEffect, useState} from 'react'; -import {GrpcWebFetchTransport} from '@protobuf-ts/grpcweb-transport'; +import {PromiseClient, createPromiseClient} from '@bufbuild/connect'; +import {createConnectTransport} from '@bufbuild/connect-web'; import {RpcError} from '@protobuf-ts/runtime-rpc'; import { Agent, AgentsResponse, - AgentsServiceClient, - ScrapeServiceClient, + AgentsService, + ScrapeService, Target, Targets, - TargetsRequest_State, TargetsResponse, -} from '@parca/client'; +} from '@parca/client/src/connect'; import {EmptyState} from '@parca/components'; import AgentsTable from '../components/Targets/AgentsTable'; @@ -38,18 +38,15 @@ export interface ITargetsResult { error: RpcError | null; } -export const useTargets = (client: ScrapeServiceClient): ITargetsResult => { +export const useTargets = (client: PromiseClient): ITargetsResult => { const [result, setResult] = useState({ response: null, error: null, }); useEffect(() => { - const call = client.targets({ - state: TargetsRequest_State.ANY_UNSPECIFIED, - }); - - call.response + client + .targets({}) .then(response => setResult({response, error: null})) .catch(error => setResult({error, response: null})); }, [client]); @@ -57,8 +54,9 @@ export const useTargets = (client: ScrapeServiceClient): ITargetsResult => { return result; }; -const scrapeClient = new ScrapeServiceClient( - new GrpcWebFetchTransport({ +const scrapeClient = createPromiseClient( + ScrapeService, + createConnectTransport({ baseUrl: apiEndpoint === undefined ? `${window.PATH_PREFIX}/api` : `${apiEndpoint}/api`, }) ); @@ -73,16 +71,15 @@ export interface IAgentsResult { error: RpcError | null; } -export const useAgents = (client: AgentsServiceClient): IAgentsResult => { +export const useAgents = (client: PromiseClient): IAgentsResult => { const [result, setResult] = useState({ response: null, error: null, }); useEffect(() => { - const call = client.agents({}); - - call.response + client + .agents({}) .then(response => setResult({response, error: null})) .catch(error => setResult({error, response: null})); }, [client]); @@ -90,8 +87,9 @@ export const useAgents = (client: AgentsServiceClient): IAgentsResult => { return result; }; -const agentsClient = new AgentsServiceClient( - new GrpcWebFetchTransport({ +const agentsClient = createPromiseClient( + AgentsService, + createConnectTransport({ baseUrl: apiEndpoint === undefined ? `${window.PATH_PREFIX}/api` : `${apiEndpoint}/api`, }) ); diff --git a/ui/packages/shared/client/src/connect.ts b/ui/packages/shared/client/src/connect.ts new file mode 100644 index 00000000000..7b9019179f2 --- /dev/null +++ b/ui/packages/shared/client/src/connect.ts @@ -0,0 +1,6 @@ +export * from './parca/query/v1alpha1/query_connectweb'; +export * from './parca/query/v1alpha1/query_pb'; +export * from './parca/profilestore/v1alpha1/profilestore_connectweb'; +export * from './parca/profilestore/v1alpha1/profilestore_pb'; +export * from './parca/scrape/v1alpha1/scrape_connectweb'; +export * from './parca/scrape/v1alpha1/scrape_pb'; diff --git a/ui/packages/shared/client/src/google/api/http_pb.ts b/ui/packages/shared/client/src/google/api/http_pb.ts new file mode 100644 index 00000000000..26493126fd7 --- /dev/null +++ b/ui/packages/shared/client/src/google/api/http_pb.ts @@ -0,0 +1,547 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" +// @generated from file google/api/http.proto (package google.api, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + * + * @generated from message google.api.Http + */ +export class Http extends Message { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * @generated from field: repeated google.api.HttpRule rules = 1; + */ + rules: HttpRule[] = []; + + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * @generated from field: bool fully_decode_reserved_expansion = 2; + */ + fullyDecodeReservedExpansion = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.Http"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "rules", kind: "message", T: HttpRule, repeated: true }, + { no: 2, name: "fully_decode_reserved_expansion", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Http { + return new Http().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Http { + return new Http().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Http { + return new Http().fromJsonString(jsonString, options); + } + + static equals(a: Http | PlainMessage | undefined, b: Http | PlainMessage | undefined): boolean { + return proto3.util.equals(Http, a, b); + } +} + +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + * + * @generated from message google.api.HttpRule + */ +export class HttpRule extends Message { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + * + * @generated from field: string selector = 1; + */ + selector = ""; + + /** + * Determines the URL pattern is matched by this rules. This pattern can be + * used with any of the {get|put|post|delete|patch} methods. A custom method + * can be defined using the 'custom' field. + * + * @generated from oneof google.api.HttpRule.pattern + */ + pattern: { + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + * + * @generated from field: string get = 2; + */ + value: string; + case: "get"; + } | { + /** + * Maps to HTTP PUT. Used for replacing a resource. + * + * @generated from field: string put = 3; + */ + value: string; + case: "put"; + } | { + /** + * Maps to HTTP POST. Used for creating a resource or performing an action. + * + * @generated from field: string post = 4; + */ + value: string; + case: "post"; + } | { + /** + * Maps to HTTP DELETE. Used for deleting a resource. + * + * @generated from field: string delete = 5; + */ + value: string; + case: "delete"; + } | { + /** + * Maps to HTTP PATCH. Used for updating a resource. + * + * @generated from field: string patch = 6; + */ + value: string; + case: "patch"; + } | { + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * @generated from field: google.api.CustomHttpPattern custom = 8; + */ + value: CustomHttpPattern; + case: "custom"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + * + * @generated from field: string body = 7; + */ + body = ""; + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + * + * @generated from field: string response_body = 12; + */ + responseBody = ""; + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * @generated from field: repeated google.api.HttpRule additional_bindings = 11; + */ + additionalBindings: HttpRule[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.HttpRule"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "selector", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "get", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 3, name: "put", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 4, name: "post", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 5, name: "delete", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 6, name: "patch", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 8, name: "custom", kind: "message", T: CustomHttpPattern, oneof: "pattern" }, + { no: 7, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "response_body", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "additional_bindings", kind: "message", T: HttpRule, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): HttpRule { + return new HttpRule().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): HttpRule { + return new HttpRule().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): HttpRule { + return new HttpRule().fromJsonString(jsonString, options); + } + + static equals(a: HttpRule | PlainMessage | undefined, b: HttpRule | PlainMessage | undefined): boolean { + return proto3.util.equals(HttpRule, a, b); + } +} + +/** + * A custom pattern is used for defining custom HTTP verb. + * + * @generated from message google.api.CustomHttpPattern + */ +export class CustomHttpPattern extends Message { + /** + * The name of this custom HTTP verb. + * + * @generated from field: string kind = 1; + */ + kind = ""; + + /** + * The path matched by this custom verb. + * + * @generated from field: string path = 2; + */ + path = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.CustomHttpPattern"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "kind", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromJsonString(jsonString, options); + } + + static equals(a: CustomHttpPattern | PlainMessage | undefined, b: CustomHttpPattern | PlainMessage | undefined): boolean { + return proto3.util.equals(CustomHttpPattern, a, b); + } +} + diff --git a/ui/packages/shared/client/src/grpc/health/v1/health_connectweb.ts b/ui/packages/shared/client/src/grpc/health/v1/health_connectweb.ts new file mode 100644 index 00000000000..0d97a4d5a65 --- /dev/null +++ b/ui/packages/shared/client/src/grpc/health/v1/health_connectweb.ts @@ -0,0 +1,71 @@ +// Copyright 2015 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto + +// @generated by protoc-gen-connect-web v0.8.4 with parameter "target=ts" +// @generated from file grpc/health/v1/health.proto (package grpc.health.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { HealthCheckRequest, HealthCheckResponse } from "./health_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service grpc.health.v1.Health + */ +export const Health = { + typeName: "grpc.health.v1.Health", + methods: { + /** + * If the requested service is unknown, the call will fail with status + * NOT_FOUND. + * + * @generated from rpc grpc.health.v1.Health.Check + */ + check: { + name: "Check", + I: HealthCheckRequest, + O: HealthCheckResponse, + kind: MethodKind.Unary, + }, + /** + * Performs a watch for the serving status of the requested service. + * The server will immediately send back a message indicating the current + * serving status. It will then subsequently send a new message whenever + * the service's serving status changes. + * + * If the requested service is unknown when the call is received, the + * server will send a message setting the serving status to + * SERVICE_UNKNOWN but will *not* terminate the call. If at some + * future point, the serving status of the service becomes known, the + * server will send a new message with the service's serving status. + * + * If the call terminates with status UNIMPLEMENTED, then clients + * should assume this method is not supported and should not retry the + * call. If the call terminates with any other status (including OK), + * clients should retry the call with appropriate exponential backoff. + * + * @generated from rpc grpc.health.v1.Health.Watch + */ + watch: { + name: "Watch", + I: HealthCheckRequest, + O: HealthCheckResponse, + kind: MethodKind.ServerStreaming, + }, + } +} as const; + diff --git a/ui/packages/shared/client/src/grpc/health/v1/health_pb.ts b/ui/packages/shared/client/src/grpc/health/v1/health_pb.ts new file mode 100644 index 00000000000..afbb403998c --- /dev/null +++ b/ui/packages/shared/client/src/grpc/health/v1/health_pb.ts @@ -0,0 +1,133 @@ +// Copyright 2015 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto + +// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" +// @generated from file grpc/health/v1/health.proto (package grpc.health.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message grpc.health.v1.HealthCheckRequest + */ +export class HealthCheckRequest extends Message { + /** + * @generated from field: string service = 1; + */ + service = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "grpc.health.v1.HealthCheckRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "service", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): HealthCheckRequest { + return new HealthCheckRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): HealthCheckRequest { + return new HealthCheckRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): HealthCheckRequest { + return new HealthCheckRequest().fromJsonString(jsonString, options); + } + + static equals(a: HealthCheckRequest | PlainMessage | undefined, b: HealthCheckRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(HealthCheckRequest, a, b); + } +} + +/** + * @generated from message grpc.health.v1.HealthCheckResponse + */ +export class HealthCheckResponse extends Message { + /** + * @generated from field: grpc.health.v1.HealthCheckResponse.ServingStatus status = 1; + */ + status = HealthCheckResponse_ServingStatus.UNKNOWN; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "grpc.health.v1.HealthCheckResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "status", kind: "enum", T: proto3.getEnumType(HealthCheckResponse_ServingStatus) }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): HealthCheckResponse { + return new HealthCheckResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): HealthCheckResponse { + return new HealthCheckResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): HealthCheckResponse { + return new HealthCheckResponse().fromJsonString(jsonString, options); + } + + static equals(a: HealthCheckResponse | PlainMessage | undefined, b: HealthCheckResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(HealthCheckResponse, a, b); + } +} + +/** + * @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus + */ +export enum HealthCheckResponse_ServingStatus { + /** + * @generated from enum value: UNKNOWN = 0; + */ + UNKNOWN = 0, + + /** + * @generated from enum value: SERVING = 1; + */ + SERVING = 1, + + /** + * @generated from enum value: NOT_SERVING = 2; + */ + NOT_SERVING = 2, + + /** + * Used only by the Watch method. + * + * @generated from enum value: SERVICE_UNKNOWN = 3; + */ + SERVICE_UNKNOWN = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(HealthCheckResponse_ServingStatus) +proto3.util.setEnumType(HealthCheckResponse_ServingStatus, "grpc.health.v1.HealthCheckResponse.ServingStatus", [ + { no: 0, name: "UNKNOWN" }, + { no: 1, name: "SERVING" }, + { no: 2, name: "NOT_SERVING" }, + { no: 3, name: "SERVICE_UNKNOWN" }, +]); + diff --git a/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_connectweb.ts b/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_connectweb.ts new file mode 100644 index 00000000000..7b497d57e48 --- /dev/null +++ b/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_connectweb.ts @@ -0,0 +1,63 @@ +// @generated by protoc-gen-connect-web v0.8.4 with parameter "target=ts" +// @generated from file parca/debuginfo/v1alpha1/debuginfo.proto (package parca.debuginfo.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { InitiateUploadRequest, InitiateUploadResponse, MarkUploadFinishedRequest, MarkUploadFinishedResponse, ShouldInitiateUploadRequest, ShouldInitiateUploadResponse, UploadRequest, UploadResponse } from "./debuginfo_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * DebuginfoService is a service that allows storage of debug info + * + * @generated from service parca.debuginfo.v1alpha1.DebuginfoService + */ +export const DebuginfoService = { + typeName: "parca.debuginfo.v1alpha1.DebuginfoService", + methods: { + /** + * Upload ingests debug info for a given build_id + * + * @generated from rpc parca.debuginfo.v1alpha1.DebuginfoService.Upload + */ + upload: { + name: "Upload", + I: UploadRequest, + O: UploadResponse, + kind: MethodKind.ClientStreaming, + }, + /** + * ShouldInitiateUpload returns whether an upload for a given build_id should be initiated or not. + * + * @generated from rpc parca.debuginfo.v1alpha1.DebuginfoService.ShouldInitiateUpload + */ + shouldInitiateUpload: { + name: "ShouldInitiateUpload", + I: ShouldInitiateUploadRequest, + O: ShouldInitiateUploadResponse, + kind: MethodKind.Unary, + }, + /** + * InitiateUpload returns a strategy and information to upload debug info for a given build_id. + * + * @generated from rpc parca.debuginfo.v1alpha1.DebuginfoService.InitiateUpload + */ + initiateUpload: { + name: "InitiateUpload", + I: InitiateUploadRequest, + O: InitiateUploadResponse, + kind: MethodKind.Unary, + }, + /** + * MarkUploadFinished marks the upload as finished for a given build_id. + * + * @generated from rpc parca.debuginfo.v1alpha1.DebuginfoService.MarkUploadFinished + */ + markUploadFinished: { + name: "MarkUploadFinished", + I: MarkUploadFinishedRequest, + O: MarkUploadFinishedResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_pb.ts b/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_pb.ts new file mode 100644 index 00000000000..fd1dfa256a1 --- /dev/null +++ b/ui/packages/shared/client/src/parca/debuginfo/v1alpha1/debuginfo_pb.ts @@ -0,0 +1,822 @@ +// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" +// @generated from file parca/debuginfo/v1alpha1/debuginfo.proto (package parca.debuginfo.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64, Timestamp } from "@bufbuild/protobuf"; + +/** + * ShouldInitiateUploadRequest is the request for ShouldInitiateUpload. + * + * @generated from message parca.debuginfo.v1alpha1.ShouldInitiateUploadRequest + */ +export class ShouldInitiateUploadRequest extends Message { + /** + * The build_id of the debuginfo. + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * Hash of the debuginfo to upload. + * + * @generated from field: string hash = 2; + */ + hash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.ShouldInitiateUploadRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ShouldInitiateUploadRequest { + return new ShouldInitiateUploadRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ShouldInitiateUploadRequest { + return new ShouldInitiateUploadRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ShouldInitiateUploadRequest { + return new ShouldInitiateUploadRequest().fromJsonString(jsonString, options); + } + + static equals(a: ShouldInitiateUploadRequest | PlainMessage | undefined, b: ShouldInitiateUploadRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ShouldInitiateUploadRequest, a, b); + } +} + +/** + * ShouldInitiateUploadResponse is the response for ShouldInitiateUpload. + * + * @generated from message parca.debuginfo.v1alpha1.ShouldInitiateUploadResponse + */ +export class ShouldInitiateUploadResponse extends Message { + /** + * Whether an upload should be initiated or not. + * + * @generated from field: bool should_initiate_upload = 1; + */ + shouldInitiateUpload = false; + + /** + * Reason for why an upload should be initiated or not. + * + * @generated from field: string reason = 2; + */ + reason = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.ShouldInitiateUploadResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "should_initiate_upload", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 2, name: "reason", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ShouldInitiateUploadResponse { + return new ShouldInitiateUploadResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ShouldInitiateUploadResponse { + return new ShouldInitiateUploadResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ShouldInitiateUploadResponse { + return new ShouldInitiateUploadResponse().fromJsonString(jsonString, options); + } + + static equals(a: ShouldInitiateUploadResponse | PlainMessage | undefined, b: ShouldInitiateUploadResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ShouldInitiateUploadResponse, a, b); + } +} + +/** + * InitiateUploadRequest is the request to initiate an upload. + * + * @generated from message parca.debuginfo.v1alpha1.InitiateUploadRequest + */ +export class InitiateUploadRequest extends Message { + /** + * The build_id of the debug info to upload. + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * The size of the debug info to upload. + * + * @generated from field: int64 size = 2; + */ + size = protoInt64.zero; + + /** + * Hash of the debuginfo to upload. + * + * @generated from field: string hash = 3; + */ + hash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.InitiateUploadRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "size", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 3, name: "hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): InitiateUploadRequest { + return new InitiateUploadRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): InitiateUploadRequest { + return new InitiateUploadRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): InitiateUploadRequest { + return new InitiateUploadRequest().fromJsonString(jsonString, options); + } + + static equals(a: InitiateUploadRequest | PlainMessage | undefined, b: InitiateUploadRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(InitiateUploadRequest, a, b); + } +} + +/** + * InitiateUploadResponse is the response to an InitiateUploadRequest. + * + * @generated from message parca.debuginfo.v1alpha1.InitiateUploadResponse + */ +export class InitiateUploadResponse extends Message { + /** + * UploadInstructions contains the instructions for the client to upload the debuginfo. + * + * @generated from field: parca.debuginfo.v1alpha1.UploadInstructions upload_instructions = 1; + */ + uploadInstructions?: UploadInstructions; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.InitiateUploadResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "upload_instructions", kind: "message", T: UploadInstructions }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): InitiateUploadResponse { + return new InitiateUploadResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): InitiateUploadResponse { + return new InitiateUploadResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): InitiateUploadResponse { + return new InitiateUploadResponse().fromJsonString(jsonString, options); + } + + static equals(a: InitiateUploadResponse | PlainMessage | undefined, b: InitiateUploadResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(InitiateUploadResponse, a, b); + } +} + +/** + * UploadInstructions contains the instructions for the client to upload debuginfo. + * + * @generated from message parca.debuginfo.v1alpha1.UploadInstructions + */ +export class UploadInstructions extends Message { + /** + * The build ID of the debuginfo to upload. + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * The upload_id to use for uploading. + * + * @generated from field: string upload_id = 2; + */ + uploadId = ""; + + /** + * The strategy to use for uploading. + * + * @generated from field: parca.debuginfo.v1alpha1.UploadInstructions.UploadStrategy upload_strategy = 3; + */ + uploadStrategy = UploadInstructions_UploadStrategy.UNSPECIFIED; + + /** + * The signed url to use for uploading using a PUT request when the upload + * strategy is SIGNED_STRATEGY_URL. + * + * @generated from field: string signed_url = 4; + */ + signedUrl = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.UploadInstructions"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "upload_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "upload_strategy", kind: "enum", T: proto3.getEnumType(UploadInstructions_UploadStrategy) }, + { no: 4, name: "signed_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UploadInstructions { + return new UploadInstructions().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UploadInstructions { + return new UploadInstructions().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UploadInstructions { + return new UploadInstructions().fromJsonString(jsonString, options); + } + + static equals(a: UploadInstructions | PlainMessage | undefined, b: UploadInstructions | PlainMessage | undefined): boolean { + return proto3.util.equals(UploadInstructions, a, b); + } +} + +/** + * The strategy to use for uploading. + * + * @generated from enum parca.debuginfo.v1alpha1.UploadInstructions.UploadStrategy + */ +export enum UploadInstructions_UploadStrategy { + /** + * The upload is not allowed. + * + * @generated from enum value: UPLOAD_STRATEGY_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * The upload is allowed and should be done via the Upload RPC. + * + * @generated from enum value: UPLOAD_STRATEGY_GRPC = 1; + */ + GRPC = 1, + + /** + * The upload is allowed and should be done via a returned signed URL. + * + * @generated from enum value: UPLOAD_STRATEGY_SIGNED_URL = 2; + */ + SIGNED_URL = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(UploadInstructions_UploadStrategy) +proto3.util.setEnumType(UploadInstructions_UploadStrategy, "parca.debuginfo.v1alpha1.UploadInstructions.UploadStrategy", [ + { no: 0, name: "UPLOAD_STRATEGY_UNSPECIFIED" }, + { no: 1, name: "UPLOAD_STRATEGY_GRPC" }, + { no: 2, name: "UPLOAD_STRATEGY_SIGNED_URL" }, +]); + +/** + * MarkUploadFinishedRequest is the request to mark an upload as finished. + * + * @generated from message parca.debuginfo.v1alpha1.MarkUploadFinishedRequest + */ +export class MarkUploadFinishedRequest extends Message { + /** + * The build_id of the debug info to mark as finished. + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * The upload_id of the debug info to mark as finished. + * + * @generated from field: string upload_id = 2; + */ + uploadId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.MarkUploadFinishedRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "upload_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MarkUploadFinishedRequest { + return new MarkUploadFinishedRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MarkUploadFinishedRequest { + return new MarkUploadFinishedRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MarkUploadFinishedRequest { + return new MarkUploadFinishedRequest().fromJsonString(jsonString, options); + } + + static equals(a: MarkUploadFinishedRequest | PlainMessage | undefined, b: MarkUploadFinishedRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(MarkUploadFinishedRequest, a, b); + } +} + +/** + * MarkUploadFinishedResponse is the response to a MarkUploadFinishedRequest. + * + * @generated from message parca.debuginfo.v1alpha1.MarkUploadFinishedResponse + */ +export class MarkUploadFinishedResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.MarkUploadFinishedResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MarkUploadFinishedResponse { + return new MarkUploadFinishedResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MarkUploadFinishedResponse { + return new MarkUploadFinishedResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MarkUploadFinishedResponse { + return new MarkUploadFinishedResponse().fromJsonString(jsonString, options); + } + + static equals(a: MarkUploadFinishedResponse | PlainMessage | undefined, b: MarkUploadFinishedResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(MarkUploadFinishedResponse, a, b); + } +} + +/** + * UploadRequest upload debug info + * + * @generated from message parca.debuginfo.v1alpha1.UploadRequest + */ +export class UploadRequest extends Message { + /** + * data contains either the upload info metadata or the debug info + * + * @generated from oneof parca.debuginfo.v1alpha1.UploadRequest.data + */ + data: { + /** + * info is the metadata for the debug info + * + * @generated from field: parca.debuginfo.v1alpha1.UploadInfo info = 1; + */ + value: UploadInfo; + case: "info"; + } | { + /** + * chunk_data is the raw bytes of the debug info + * + * @generated from field: bytes chunk_data = 2; + */ + value: Uint8Array; + case: "chunkData"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.UploadRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "info", kind: "message", T: UploadInfo, oneof: "data" }, + { no: 2, name: "chunk_data", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "data" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UploadRequest { + return new UploadRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UploadRequest { + return new UploadRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UploadRequest { + return new UploadRequest().fromJsonString(jsonString, options); + } + + static equals(a: UploadRequest | PlainMessage | undefined, b: UploadRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(UploadRequest, a, b); + } +} + +/** + * UploadInfo contains the build_id and other metadata for the debug data + * + * @generated from message parca.debuginfo.v1alpha1.UploadInfo + */ +export class UploadInfo extends Message { + /** + * build_id is a unique identifier for the debug data + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * upload_id is a unique identifier for the upload + * + * @generated from field: string upload_id = 2; + */ + uploadId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.UploadInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "upload_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UploadInfo { + return new UploadInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UploadInfo { + return new UploadInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UploadInfo { + return new UploadInfo().fromJsonString(jsonString, options); + } + + static equals(a: UploadInfo | PlainMessage | undefined, b: UploadInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(UploadInfo, a, b); + } +} + +/** + * UploadResponse returns the build_id and the size of the uploaded debug info + * + * @generated from message parca.debuginfo.v1alpha1.UploadResponse + */ +export class UploadResponse extends Message { + /** + * build_id is a unique identifier for the debug data + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * size is the number of bytes of the debug info + * + * @generated from field: uint64 size = 2; + */ + size = protoInt64.zero; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.UploadResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "size", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UploadResponse { + return new UploadResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UploadResponse { + return new UploadResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UploadResponse { + return new UploadResponse().fromJsonString(jsonString, options); + } + + static equals(a: UploadResponse | PlainMessage | undefined, b: UploadResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(UploadResponse, a, b); + } +} + +/** + * Debuginfo contains metadata about a debuginfo file. + * + * @generated from message parca.debuginfo.v1alpha1.Debuginfo + */ +export class Debuginfo extends Message { + /** + * BuildID is the build ID of the debuginfo. + * + * @generated from field: string build_id = 1; + */ + buildId = ""; + + /** + * Source is the source of the debuginfo. + * + * @generated from field: parca.debuginfo.v1alpha1.Debuginfo.Source source = 2; + */ + source = Debuginfo_Source.UNKNOWN_UNSPECIFIED; + + /** + * DebuginfoUpload is the debuginfo upload metadata. + * + * @generated from field: parca.debuginfo.v1alpha1.DebuginfoUpload upload = 3; + */ + upload?: DebuginfoUpload; + + /** + * Quality is the quality of the debuginfo. This is set asynchonously by the + * symbolizer when the debuginfo is actually used. + * + * @generated from field: parca.debuginfo.v1alpha1.DebuginfoQuality quality = 4; + */ + quality?: DebuginfoQuality; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.Debuginfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "source", kind: "enum", T: proto3.getEnumType(Debuginfo_Source) }, + { no: 3, name: "upload", kind: "message", T: DebuginfoUpload }, + { no: 4, name: "quality", kind: "message", T: DebuginfoQuality }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Debuginfo { + return new Debuginfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Debuginfo { + return new Debuginfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Debuginfo { + return new Debuginfo().fromJsonString(jsonString, options); + } + + static equals(a: Debuginfo | PlainMessage | undefined, b: Debuginfo | PlainMessage | undefined): boolean { + return proto3.util.equals(Debuginfo, a, b); + } +} + +/** + * Source is the source of the debuginfo. + * + * @generated from enum parca.debuginfo.v1alpha1.Debuginfo.Source + */ +export enum Debuginfo_Source { + /** + * To understand when no source is set we have the unknown source. + * + * @generated from enum value: SOURCE_UNKNOWN_UNSPECIFIED = 0; + */ + UNKNOWN_UNSPECIFIED = 0, + + /** + * The debuginfo was uploaded by a user/agent. + * + * @generated from enum value: SOURCE_UPLOAD = 1; + */ + UPLOAD = 1, + + /** + * The debuginfo is available from the configured debuginfod server(s). + * + * @generated from enum value: SOURCE_DEBUGINFOD = 2; + */ + DEBUGINFOD = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(Debuginfo_Source) +proto3.util.setEnumType(Debuginfo_Source, "parca.debuginfo.v1alpha1.Debuginfo.Source", [ + { no: 0, name: "SOURCE_UNKNOWN_UNSPECIFIED" }, + { no: 1, name: "SOURCE_UPLOAD" }, + { no: 2, name: "SOURCE_DEBUGINFOD" }, +]); + +/** + * DebuginfoUpload contains metadata about a debuginfo upload. + * + * @generated from message parca.debuginfo.v1alpha1.DebuginfoUpload + */ +export class DebuginfoUpload extends Message { + /** + * UploadID is the ID of the debuginfo upload. + * + * @generated from field: string id = 1; + */ + id = ""; + + /** + * Hash is the hash of the debuginfo. + * + * @generated from field: string hash = 2; + */ + hash = ""; + + /** + * State is the current state of the debuginfo upload. + * + * @generated from field: parca.debuginfo.v1alpha1.DebuginfoUpload.State state = 3; + */ + state = DebuginfoUpload_State.UNKNOWN_UNSPECIFIED; + + /** + * StartedAt is the time the debuginfo upload was started. + * + * @generated from field: google.protobuf.Timestamp started_at = 4; + */ + startedAt?: Timestamp; + + /** + * FinishedAt is the time the debuginfo upload was finished. + * + * @generated from field: google.protobuf.Timestamp finished_at = 5; + */ + finishedAt?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.DebuginfoUpload"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "state", kind: "enum", T: proto3.getEnumType(DebuginfoUpload_State) }, + { no: 4, name: "started_at", kind: "message", T: Timestamp }, + { no: 5, name: "finished_at", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DebuginfoUpload { + return new DebuginfoUpload().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DebuginfoUpload { + return new DebuginfoUpload().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DebuginfoUpload { + return new DebuginfoUpload().fromJsonString(jsonString, options); + } + + static equals(a: DebuginfoUpload | PlainMessage | undefined, b: DebuginfoUpload | PlainMessage | undefined): boolean { + return proto3.util.equals(DebuginfoUpload, a, b); + } +} + +/** + * The state of the debuginfo upload. + * + * @generated from enum parca.debuginfo.v1alpha1.DebuginfoUpload.State + */ +export enum DebuginfoUpload_State { + /** + * To understand when no upload state is set we have the unknown state. + * + * @generated from enum value: STATE_UNKNOWN_UNSPECIFIED = 0; + */ + UNKNOWN_UNSPECIFIED = 0, + + /** + * The debuginfo is currently being uploaded. + * + * @generated from enum value: STATE_UPLOADING = 1; + */ + UPLOADING = 1, + + /** + * The debuginfo has been uploaded successfully. + * + * @generated from enum value: STATE_UPLOADED = 2; + */ + UPLOADED = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(DebuginfoUpload_State) +proto3.util.setEnumType(DebuginfoUpload_State, "parca.debuginfo.v1alpha1.DebuginfoUpload.State", [ + { no: 0, name: "STATE_UNKNOWN_UNSPECIFIED" }, + { no: 1, name: "STATE_UPLOADING" }, + { no: 2, name: "STATE_UPLOADED" }, +]); + +/** + * DebuginfoQuality is the quality of the debuginfo. + * + * @generated from message parca.debuginfo.v1alpha1.DebuginfoQuality + */ +export class DebuginfoQuality extends Message { + /** + * The debuginfo file is not a valid ELF file. + * + * @generated from field: bool not_valid_elf = 1; + */ + notValidElf = false; + + /** + * Whether the debuginfo contains dwarf information. + * + * @generated from field: bool has_dwarf = 2; + */ + hasDwarf = false; + + /** + * Whether the debuginfo contains Go's pclntab. + * + * @generated from field: bool has_go_pclntab = 3; + */ + hasGoPclntab = false; + + /** + * Whether the debuginfo contains symtab. + * + * @generated from field: bool has_symtab = 4; + */ + hasSymtab = false; + + /** + * Whether the debuginfo contains dynsym. + * + * @generated from field: bool has_dynsym = 5; + */ + hasDynsym = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.debuginfo.v1alpha1.DebuginfoQuality"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "not_valid_elf", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 2, name: "has_dwarf", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 3, name: "has_go_pclntab", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 4, name: "has_symtab", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 5, name: "has_dynsym", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DebuginfoQuality { + return new DebuginfoQuality().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DebuginfoQuality { + return new DebuginfoQuality().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DebuginfoQuality { + return new DebuginfoQuality().fromJsonString(jsonString, options); + } + + static equals(a: DebuginfoQuality | PlainMessage | undefined, b: DebuginfoQuality | PlainMessage | undefined): boolean { + return proto3.util.equals(DebuginfoQuality, a, b); + } +} + diff --git a/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_connectweb.ts b/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_connectweb.ts new file mode 100644 index 00000000000..ef36055362f --- /dev/null +++ b/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_connectweb.ts @@ -0,0 +1,140 @@ +// @generated by protoc-gen-connect-web v0.8.4 with parameter "target=ts" +// @generated from file parca/metastore/v1alpha1/metastore.proto (package parca.metastore.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { CreateLocationLinesRequest, CreateLocationLinesResponse, FunctionsRequest, FunctionsResponse, GetOrCreateFunctionsRequest, GetOrCreateFunctionsResponse, GetOrCreateLocationsRequest, GetOrCreateLocationsResponse, GetOrCreateMappingsRequest, GetOrCreateMappingsResponse, GetOrCreateStacktracesRequest, GetOrCreateStacktracesResponse, LocationsRequest, LocationsResponse, MappingsRequest, MappingsResponse, StacktracesRequest, StacktracesResponse, UnsymbolizedLocationsRequest, UnsymbolizedLocationsResponse } from "./metastore_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * MetastoreService + * + * @generated from service parca.metastore.v1alpha1.MetastoreService + */ +export const MetastoreService = { + typeName: "parca.metastore.v1alpha1.MetastoreService", + methods: { + /** + * GetOrCreateMappings checks if the mappings in the request are already + * known and returns the known mapping (including its ID) if so. If a mapping + * does not already exist, it is written to the backing metastore. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.GetOrCreateMappings + */ + getOrCreateMappings: { + name: "GetOrCreateMappings", + I: GetOrCreateMappingsRequest, + O: GetOrCreateMappingsResponse, + kind: MethodKind.Unary, + }, + /** + * GetOrCreateFunctions checks if the functions in the request are already + * known and returns the known function (including its ID) if so. If a + * function does not already exist, it is written to the backing metastore. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.GetOrCreateFunctions + */ + getOrCreateFunctions: { + name: "GetOrCreateFunctions", + I: GetOrCreateFunctionsRequest, + O: GetOrCreateFunctionsResponse, + kind: MethodKind.Unary, + }, + /** + * GetOrCreateLocations checks if the locations in the request are already + * known and returns the known location (including its ID) if so. If a + * location does not already exist, it is written to the backing metastore. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.GetOrCreateLocations + */ + getOrCreateLocations: { + name: "GetOrCreateLocations", + I: GetOrCreateLocationsRequest, + O: GetOrCreateLocationsResponse, + kind: MethodKind.Unary, + }, + /** + * GetOrCreateStacktraces checks if the stacktraces in the request are + * already known and returns the known stacktrace (including its ID) if so. + * If a stacktrace does not already exist, it is written to the backing + * metastore. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.GetOrCreateStacktraces + */ + getOrCreateStacktraces: { + name: "GetOrCreateStacktraces", + I: GetOrCreateStacktracesRequest, + O: GetOrCreateStacktracesResponse, + kind: MethodKind.Unary, + }, + /** + * UnsymbolizedLocations returns locations that can be symbolized but haven't + * been asynchronously symbolized yet. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.UnsymbolizedLocations + */ + unsymbolizedLocations: { + name: "UnsymbolizedLocations", + I: UnsymbolizedLocationsRequest, + O: UnsymbolizedLocationsResponse, + kind: MethodKind.Unary, + }, + /** + * CreateLocationLines creates the location lines contained in the provided + * locations. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.CreateLocationLines + */ + createLocationLines: { + name: "CreateLocationLines", + I: CreateLocationLinesRequest, + O: CreateLocationLinesResponse, + kind: MethodKind.Unary, + }, + /** + * Locations retrieves locations. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.Locations + */ + locations: { + name: "Locations", + I: LocationsRequest, + O: LocationsResponse, + kind: MethodKind.Unary, + }, + /** + * Functions retrieves functions. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.Functions + */ + functions: { + name: "Functions", + I: FunctionsRequest, + O: FunctionsResponse, + kind: MethodKind.Unary, + }, + /** + * Mappings retrieves mappings. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.Mappings + */ + mappings: { + name: "Mappings", + I: MappingsRequest, + O: MappingsResponse, + kind: MethodKind.Unary, + }, + /** + * Stacktraces retrieves mappings. + * + * @generated from rpc parca.metastore.v1alpha1.MetastoreService.Stacktraces + */ + stacktraces: { + name: "Stacktraces", + I: StacktracesRequest, + O: StacktracesResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_pb.ts b/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_pb.ts new file mode 100644 index 00000000000..103874e1947 --- /dev/null +++ b/ui/packages/shared/client/src/parca/metastore/v1alpha1/metastore_pb.ts @@ -0,0 +1,1498 @@ +// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" +// @generated from file parca/metastore/v1alpha1/metastore.proto (package parca.metastore.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; + +/** + * GetOrCreateMappingsRequest contains all information about mappings that are + * requested to be retrieved or created if they don't already exist. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateMappingsRequest + */ +export class GetOrCreateMappingsRequest extends Message { + /** + * Mappings to be created or retrieved. + * + * @generated from field: repeated parca.metastore.v1alpha1.Mapping mappings = 1; + */ + mappings: Mapping[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateMappingsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "mappings", kind: "message", T: Mapping, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateMappingsRequest { + return new GetOrCreateMappingsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateMappingsRequest { + return new GetOrCreateMappingsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateMappingsRequest { + return new GetOrCreateMappingsRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateMappingsRequest | PlainMessage | undefined, b: GetOrCreateMappingsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateMappingsRequest, a, b); + } +} + +/** + * GetOrCreateMappingsResponse contains information about mappings requested. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateMappingsResponse + */ +export class GetOrCreateMappingsResponse extends Message { + /** + * Mappings that are known to the backing metastore. If any mappings didn't + * exist before the request they have now been persisted and are uniquely + * identifyable through their key. + * + * @generated from field: repeated parca.metastore.v1alpha1.Mapping mappings = 1; + */ + mappings: Mapping[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateMappingsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "mappings", kind: "message", T: Mapping, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateMappingsResponse { + return new GetOrCreateMappingsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateMappingsResponse { + return new GetOrCreateMappingsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateMappingsResponse { + return new GetOrCreateMappingsResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateMappingsResponse | PlainMessage | undefined, b: GetOrCreateMappingsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateMappingsResponse, a, b); + } +} + +/** + * GetOrCreateFunctionsRequest contains all information about functions that are + * requested to be retrieved or created if they don't already exist. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateFunctionsRequest + */ +export class GetOrCreateFunctionsRequest extends Message { + /** + * Functions to be created or retrieved. + * + * @generated from field: repeated parca.metastore.v1alpha1.Function functions = 1; + */ + functions: Function[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateFunctionsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "functions", kind: "message", T: Function, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateFunctionsRequest { + return new GetOrCreateFunctionsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateFunctionsRequest { + return new GetOrCreateFunctionsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateFunctionsRequest { + return new GetOrCreateFunctionsRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateFunctionsRequest | PlainMessage | undefined, b: GetOrCreateFunctionsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateFunctionsRequest, a, b); + } +} + +/** + * GetOrCreateFunctionsResponse contains information about functions requested. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateFunctionsResponse + */ +export class GetOrCreateFunctionsResponse extends Message { + /** + * Functions that are known to the backing metastore. If any functions didn't + * exist before the request they have now been persisted and are uniquely + * identifyable through their key. + * + * @generated from field: repeated parca.metastore.v1alpha1.Function functions = 1; + */ + functions: Function[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateFunctionsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "functions", kind: "message", T: Function, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateFunctionsResponse { + return new GetOrCreateFunctionsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateFunctionsResponse { + return new GetOrCreateFunctionsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateFunctionsResponse { + return new GetOrCreateFunctionsResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateFunctionsResponse | PlainMessage | undefined, b: GetOrCreateFunctionsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateFunctionsResponse, a, b); + } +} + +/** + * GetOrCreateLocationsRequest contains all information about locations that are + * requested to be retrieved or created if they don't already exist. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateLocationsRequest + */ +export class GetOrCreateLocationsRequest extends Message { + /** + * Locations to be created or retrieved. + * + * @generated from field: repeated parca.metastore.v1alpha1.Location locations = 1; + */ + locations: Location[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateLocationsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "locations", kind: "message", T: Location, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateLocationsRequest { + return new GetOrCreateLocationsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateLocationsRequest { + return new GetOrCreateLocationsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateLocationsRequest { + return new GetOrCreateLocationsRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateLocationsRequest | PlainMessage | undefined, b: GetOrCreateLocationsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateLocationsRequest, a, b); + } +} + +/** + * GetOrCreateLocationsResponse contains information about locations requested. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateLocationsResponse + */ +export class GetOrCreateLocationsResponse extends Message { + /** + * Locations that are known to the backing metastore. If any locations didn't + * exist before the request they have now been persisted and are uniquely + * identifyable through their key. + * + * @generated from field: repeated parca.metastore.v1alpha1.Location locations = 1; + */ + locations: Location[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateLocationsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "locations", kind: "message", T: Location, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateLocationsResponse { + return new GetOrCreateLocationsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateLocationsResponse { + return new GetOrCreateLocationsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateLocationsResponse { + return new GetOrCreateLocationsResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateLocationsResponse | PlainMessage | undefined, b: GetOrCreateLocationsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateLocationsResponse, a, b); + } +} + +/** + * GetOrCreateStracktracesRequest contains all information about stacktraces + * that are requested to be retrieved or created if they don't already exist. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateStacktracesRequest + */ +export class GetOrCreateStacktracesRequest extends Message { + /** + * Stacktraces to be created or retrieved. + * + * @generated from field: repeated parca.metastore.v1alpha1.Stacktrace stacktraces = 1; + */ + stacktraces: Stacktrace[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateStacktracesRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stacktraces", kind: "message", T: Stacktrace, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateStacktracesRequest { + return new GetOrCreateStacktracesRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateStacktracesRequest { + return new GetOrCreateStacktracesRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateStacktracesRequest { + return new GetOrCreateStacktracesRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateStacktracesRequest | PlainMessage | undefined, b: GetOrCreateStacktracesRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateStacktracesRequest, a, b); + } +} + +/** + * GetOrCreateStacktracesResponse contains information about locations requested. + * + * @generated from message parca.metastore.v1alpha1.GetOrCreateStacktracesResponse + */ +export class GetOrCreateStacktracesResponse extends Message { + /** + * Stacktraces that are known to the backing metastore. If any stacktraces + * didn't exist before the request they have now been persisted and are + * uniquely identifyable through their key. + * + * @generated from field: repeated parca.metastore.v1alpha1.Stacktrace stacktraces = 1; + */ + stacktraces: Stacktrace[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.GetOrCreateStacktracesResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stacktraces", kind: "message", T: Stacktrace, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetOrCreateStacktracesResponse { + return new GetOrCreateStacktracesResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetOrCreateStacktracesResponse { + return new GetOrCreateStacktracesResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetOrCreateStacktracesResponse { + return new GetOrCreateStacktracesResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetOrCreateStacktracesResponse | PlainMessage | undefined, b: GetOrCreateStacktracesResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetOrCreateStacktracesResponse, a, b); + } +} + +/** + * UnsymbolizedLocationsRequest contains information about the unsymbolized + * locations requested. While currently empty, this could in the future contain + * a sharding configuration or limit the number of locations to return. + * + * @generated from message parca.metastore.v1alpha1.UnsymbolizedLocationsRequest + */ +export class UnsymbolizedLocationsRequest extends Message { + /** + * The maximum number of locations to return. + * + * @generated from field: uint32 limit = 1; + */ + limit = 0; + + /** + * The minimum key to start returning locations from. + * + * @generated from field: string min_key = 2; + */ + minKey = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.UnsymbolizedLocationsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "limit", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "min_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UnsymbolizedLocationsRequest { + return new UnsymbolizedLocationsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UnsymbolizedLocationsRequest { + return new UnsymbolizedLocationsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UnsymbolizedLocationsRequest { + return new UnsymbolizedLocationsRequest().fromJsonString(jsonString, options); + } + + static equals(a: UnsymbolizedLocationsRequest | PlainMessage | undefined, b: UnsymbolizedLocationsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(UnsymbolizedLocationsRequest, a, b); + } +} + +/** + * UnsymbolizedLocationsResponse contains information about the requested + * locations that should be symbolizable but potentially haven't been + * symbolized yet. + * + * @generated from message parca.metastore.v1alpha1.UnsymbolizedLocationsResponse + */ +export class UnsymbolizedLocationsResponse extends Message { + /** + * Locations that have a mapping and address that should be symbolizable. + * + * @generated from field: repeated parca.metastore.v1alpha1.Location locations = 1; + */ + locations: Location[] = []; + + /** + * Key of the last location returned. This can be used in a subsequent call + * to UnsymbolizedLocations to continue from the last returned location. + * + * @generated from field: string max_key = 2; + */ + maxKey = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.UnsymbolizedLocationsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "locations", kind: "message", T: Location, repeated: true }, + { no: 2, name: "max_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UnsymbolizedLocationsResponse { + return new UnsymbolizedLocationsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UnsymbolizedLocationsResponse { + return new UnsymbolizedLocationsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UnsymbolizedLocationsResponse { + return new UnsymbolizedLocationsResponse().fromJsonString(jsonString, options); + } + + static equals(a: UnsymbolizedLocationsResponse | PlainMessage | undefined, b: UnsymbolizedLocationsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(UnsymbolizedLocationsResponse, a, b); + } +} + +/** + * CreateLocationLinesRequest contains locations and their location lines to be + * saved. + * + * @generated from message parca.metastore.v1alpha1.CreateLocationLinesRequest + */ +export class CreateLocationLinesRequest extends Message { + /** + * Locations that have location lines to be saved. + * + * @generated from field: repeated parca.metastore.v1alpha1.Location locations = 1; + */ + locations: Location[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.CreateLocationLinesRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "locations", kind: "message", T: Location, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CreateLocationLinesRequest { + return new CreateLocationLinesRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CreateLocationLinesRequest { + return new CreateLocationLinesRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CreateLocationLinesRequest { + return new CreateLocationLinesRequest().fromJsonString(jsonString, options); + } + + static equals(a: CreateLocationLinesRequest | PlainMessage | undefined, b: CreateLocationLinesRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(CreateLocationLinesRequest, a, b); + } +} + +/** + * CreateLocationLinesResponse details about the location lines creation. + * + * @generated from message parca.metastore.v1alpha1.CreateLocationLinesResponse + */ +export class CreateLocationLinesResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.CreateLocationLinesResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CreateLocationLinesResponse { + return new CreateLocationLinesResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CreateLocationLinesResponse { + return new CreateLocationLinesResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CreateLocationLinesResponse { + return new CreateLocationLinesResponse().fromJsonString(jsonString, options); + } + + static equals(a: CreateLocationLinesResponse | PlainMessage | undefined, b: CreateLocationLinesResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(CreateLocationLinesResponse, a, b); + } +} + +/** + * StacktracesRequest contains information about the stacktraces requested. + * + * @generated from message parca.metastore.v1alpha1.StacktracesRequest + */ +export class StacktracesRequest extends Message { + /** + * IDs of stacktraces to retrieve. + * + * @generated from field: repeated string stacktrace_ids = 1; + */ + stacktraceIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.StacktracesRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stacktrace_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): StacktracesRequest { + return new StacktracesRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): StacktracesRequest { + return new StacktracesRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): StacktracesRequest { + return new StacktracesRequest().fromJsonString(jsonString, options); + } + + static equals(a: StacktracesRequest | PlainMessage | undefined, b: StacktracesRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(StacktracesRequest, a, b); + } +} + +/** + * StacktracesRequest contains the requested stacktraces. + * + * @generated from message parca.metastore.v1alpha1.StacktracesResponse + */ +export class StacktracesResponse extends Message { + /** + * Stacktraces that are known to the backing metastore. + * + * @generated from field: repeated parca.metastore.v1alpha1.Stacktrace stacktraces = 1; + */ + stacktraces: Stacktrace[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.StacktracesResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stacktraces", kind: "message", T: Stacktrace, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): StacktracesResponse { + return new StacktracesResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): StacktracesResponse { + return new StacktracesResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): StacktracesResponse { + return new StacktracesResponse().fromJsonString(jsonString, options); + } + + static equals(a: StacktracesResponse | PlainMessage | undefined, b: StacktracesResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(StacktracesResponse, a, b); + } +} + +/** + * LocationsRequest contains information about the locations requested. + * + * @generated from message parca.metastore.v1alpha1.LocationsRequest + */ +export class LocationsRequest extends Message { + /** + * IDs of locations to retrieve. + * + * @generated from field: repeated string location_ids = 1; + */ + locationIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.LocationsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "location_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LocationsRequest { + return new LocationsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LocationsRequest { + return new LocationsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LocationsRequest { + return new LocationsRequest().fromJsonString(jsonString, options); + } + + static equals(a: LocationsRequest | PlainMessage | undefined, b: LocationsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(LocationsRequest, a, b); + } +} + +/** + * LocationsResponse contains the requested locations. + * + * @generated from message parca.metastore.v1alpha1.LocationsResponse + */ +export class LocationsResponse extends Message { + /** + * Locations that are known to the backing metastore. + * + * @generated from field: repeated parca.metastore.v1alpha1.Location locations = 1; + */ + locations: Location[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.LocationsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "locations", kind: "message", T: Location, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LocationsResponse { + return new LocationsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LocationsResponse { + return new LocationsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LocationsResponse { + return new LocationsResponse().fromJsonString(jsonString, options); + } + + static equals(a: LocationsResponse | PlainMessage | undefined, b: LocationsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(LocationsResponse, a, b); + } +} + +/** + * LocationLinesRequest contains information about the location's lines requested. + * + * @generated from message parca.metastore.v1alpha1.LocationLinesRequest + */ +export class LocationLinesRequest extends Message { + /** + * IDs of locations to retrieve location lines for. + * + * @generated from field: repeated string location_ids = 1; + */ + locationIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.LocationLinesRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "location_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LocationLinesRequest { + return new LocationLinesRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LocationLinesRequest { + return new LocationLinesRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LocationLinesRequest { + return new LocationLinesRequest().fromJsonString(jsonString, options); + } + + static equals(a: LocationLinesRequest | PlainMessage | undefined, b: LocationLinesRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(LocationLinesRequest, a, b); + } +} + +/** + * FunctionsRequest contains information about the functions requested. + * + * @generated from message parca.metastore.v1alpha1.FunctionsRequest + */ +export class FunctionsRequest extends Message { + /** + * IDs of functions to retrieve. + * + * @generated from field: repeated string function_ids = 1; + */ + functionIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.FunctionsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "function_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FunctionsRequest { + return new FunctionsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FunctionsRequest { + return new FunctionsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FunctionsRequest { + return new FunctionsRequest().fromJsonString(jsonString, options); + } + + static equals(a: FunctionsRequest | PlainMessage | undefined, b: FunctionsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(FunctionsRequest, a, b); + } +} + +/** + * FunctionsResponse contains the requested functions. + * + * @generated from message parca.metastore.v1alpha1.FunctionsResponse + */ +export class FunctionsResponse extends Message { + /** + * Functions that are known to the backing metastore. + * + * @generated from field: repeated parca.metastore.v1alpha1.Function functions = 1; + */ + functions: Function[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.FunctionsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "functions", kind: "message", T: Function, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FunctionsResponse { + return new FunctionsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FunctionsResponse { + return new FunctionsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FunctionsResponse { + return new FunctionsResponse().fromJsonString(jsonString, options); + } + + static equals(a: FunctionsResponse | PlainMessage | undefined, b: FunctionsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(FunctionsResponse, a, b); + } +} + +/** + * MappingsRequest contains information about the mappings requested. + * + * @generated from message parca.metastore.v1alpha1.MappingsRequest + */ +export class MappingsRequest extends Message { + /** + * IDs of mappings to retrieve. + * + * @generated from field: repeated string mapping_ids = 1; + */ + mappingIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.MappingsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "mapping_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MappingsRequest { + return new MappingsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MappingsRequest { + return new MappingsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MappingsRequest { + return new MappingsRequest().fromJsonString(jsonString, options); + } + + static equals(a: MappingsRequest | PlainMessage | undefined, b: MappingsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(MappingsRequest, a, b); + } +} + +/** + * MappingsResponse contains the requested mappings. + * + * @generated from message parca.metastore.v1alpha1.MappingsResponse + */ +export class MappingsResponse extends Message { + /** + * Mappings that are known to the backing metastore. + * + * @generated from field: repeated parca.metastore.v1alpha1.Mapping mappings = 1; + */ + mappings: Mapping[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.MappingsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "mappings", kind: "message", T: Mapping, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MappingsResponse { + return new MappingsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MappingsResponse { + return new MappingsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MappingsResponse { + return new MappingsResponse().fromJsonString(jsonString, options); + } + + static equals(a: MappingsResponse | PlainMessage | undefined, b: MappingsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(MappingsResponse, a, b); + } +} + +/** + * Sample is a stack trace with optional labels. + * + * @generated from message parca.metastore.v1alpha1.Sample + */ +export class Sample extends Message { + /** + * stacktrace_id references stack trace of the sample. + * + * @generated from field: string stacktrace_id = 1; + */ + stacktraceId = ""; + + /** + * labels are extra labels for a stack trace. + * + * @generated from field: map labels = 2; + */ + labels: { [key: string]: SampleLabel } = {}; + + /** + * num_labels are the num of labels. + * + * @generated from field: map num_labels = 3; + */ + numLabels: { [key: string]: SampleNumLabel } = {}; + + /** + * num_units are the units for the labels. + * + * @generated from field: map num_units = 4; + */ + numUnits: { [key: string]: SampleNumUnit } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Sample"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stacktrace_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "labels", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: SampleLabel} }, + { no: 3, name: "num_labels", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: SampleNumLabel} }, + { no: 4, name: "num_units", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: SampleNumUnit} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Sample { + return new Sample().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Sample { + return new Sample().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Sample { + return new Sample().fromJsonString(jsonString, options); + } + + static equals(a: Sample | PlainMessage | undefined, b: Sample | PlainMessage | undefined): boolean { + return proto3.util.equals(Sample, a, b); + } +} + +/** + * Stacktrace is a collection of locations. + * + * @generated from message parca.metastore.v1alpha1.Stacktrace + */ +export class Stacktrace extends Message { + /** + * stacktrace_id references stack trace of the stacktrace. + * + * @generated from field: string id = 1; + */ + id = ""; + + /** + * locations are the locations in the stack trace. + * + * @generated from field: repeated string location_ids = 2; + */ + locationIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Stacktrace"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "location_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stacktrace { + return new Stacktrace().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stacktrace { + return new Stacktrace().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stacktrace { + return new Stacktrace().fromJsonString(jsonString, options); + } + + static equals(a: Stacktrace | PlainMessage | undefined, b: Stacktrace | PlainMessage | undefined): boolean { + return proto3.util.equals(Stacktrace, a, b); + } +} + +/** + * SampleLabel are the labels added to a Sample. + * + * @generated from message parca.metastore.v1alpha1.SampleLabel + */ +export class SampleLabel extends Message { + /** + * labels for a label in a Sample. + * + * @generated from field: repeated string labels = 1; + */ + labels: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.SampleLabel"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "labels", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SampleLabel { + return new SampleLabel().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SampleLabel { + return new SampleLabel().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SampleLabel { + return new SampleLabel().fromJsonString(jsonString, options); + } + + static equals(a: SampleLabel | PlainMessage | undefined, b: SampleLabel | PlainMessage | undefined): boolean { + return proto3.util.equals(SampleLabel, a, b); + } +} + +/** + * SampleNumLabel are the num of labels of a Sample. + * + * @generated from message parca.metastore.v1alpha1.SampleNumLabel + */ +export class SampleNumLabel extends Message { + /** + * num_labels are the num_label of a Sample. + * + * @generated from field: repeated int64 num_labels = 1; + */ + numLabels: bigint[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.SampleNumLabel"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "num_labels", kind: "scalar", T: 3 /* ScalarType.INT64 */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SampleNumLabel { + return new SampleNumLabel().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SampleNumLabel { + return new SampleNumLabel().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SampleNumLabel { + return new SampleNumLabel().fromJsonString(jsonString, options); + } + + static equals(a: SampleNumLabel | PlainMessage | undefined, b: SampleNumLabel | PlainMessage | undefined): boolean { + return proto3.util.equals(SampleNumLabel, a, b); + } +} + +/** + * SampleNumUnit are the num units of a Sample. + * + * @generated from message parca.metastore.v1alpha1.SampleNumUnit + */ +export class SampleNumUnit extends Message { + /** + * units of a labels of a Sample. + * + * @generated from field: repeated string units = 1; + */ + units: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.SampleNumUnit"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "units", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SampleNumUnit { + return new SampleNumUnit().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SampleNumUnit { + return new SampleNumUnit().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SampleNumUnit { + return new SampleNumUnit().fromJsonString(jsonString, options); + } + + static equals(a: SampleNumUnit | PlainMessage | undefined, b: SampleNumUnit | PlainMessage | undefined): boolean { + return proto3.util.equals(SampleNumUnit, a, b); + } +} + +/** + * Location describes a single location of a stack traces. + * + * @generated from message parca.metastore.v1alpha1.Location + */ +export class Location extends Message { + /** + * id is the unique identifier for the location. + * + * @generated from field: string id = 1; + */ + id = ""; + + /** + * address is the memory address of the location if present. + * + * @generated from field: uint64 address = 2; + */ + address = protoInt64.zero; + + /** + * mapping_id is the unique identifier for the mapping associated with the location. + * + * @generated from field: string mapping_id = 4; + */ + mappingId = ""; + + /** + * is_folded indicates whether the location is folded into the previous location. + * + * @generated from field: bool is_folded = 5; + */ + isFolded = false; + + /** + * lines are the call frames represented by this location. Multiple lines + * indicate they have been inlined. + * + * @generated from field: repeated parca.metastore.v1alpha1.Line lines = 6; + */ + lines: Line[] = []; + + /** + * mapping_index has the index into the mapping table where mappings are sent deduplicated. + * + * @generated from field: uint32 mapping_index = 7; + */ + mappingIndex = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Location"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "address", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 4, name: "mapping_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "is_folded", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 6, name: "lines", kind: "message", T: Line, repeated: true }, + { no: 7, name: "mapping_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Location { + return new Location().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Location { + return new Location().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Location { + return new Location().fromJsonString(jsonString, options); + } + + static equals(a: Location | PlainMessage | undefined, b: Location | PlainMessage | undefined): boolean { + return proto3.util.equals(Location, a, b); + } +} + +/** + * Line describes a source code function and its line number. + * + * @generated from message parca.metastore.v1alpha1.Line + */ +export class Line extends Message { + /** + * function_id is the ID of the function. + * + * @generated from field: string function_id = 1; + */ + functionId = ""; + + /** + * line is the line number in the source file of the referenced function. + * + * @generated from field: int64 line = 2; + */ + line = protoInt64.zero; + + /** + * function_index is the index in the functions table. + * + * @generated from field: uint32 function_index = 3; + */ + functionIndex = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Line"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "function_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "line", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 3, name: "function_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Line { + return new Line().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Line { + return new Line().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Line { + return new Line().fromJsonString(jsonString, options); + } + + static equals(a: Line | PlainMessage | undefined, b: Line | PlainMessage | undefined): boolean { + return proto3.util.equals(Line, a, b); + } +} + +/** + * Function describes metadata of a source code function. + * + * @generated from message parca.metastore.v1alpha1.Function + */ +export class Function extends Message { + /** + * id is the unique identifier for the function. + * + * @generated from field: string id = 1; + */ + id = ""; + + /** + * start_line is the line number in the source file of the first line of the function. + * + * @generated from field: int64 start_line = 2; + */ + startLine = protoInt64.zero; + + /** + * name is the name of the function. + * + * @generated from field: string name = 3; + */ + name = ""; + + /** + * system_name describes the name of the function, as identified by the + * system. For instance, it can be a C++ mangled name. + * + * @generated from field: string system_name = 4; + */ + systemName = ""; + + /** + * filename is the name of the source file of the function. + * + * @generated from field: string filename = 5; + */ + filename = ""; + + /** + * name_string_index is the index in the string table to the name associated with the function. + * + * @generated from field: uint32 name_string_index = 6; + */ + nameStringIndex = 0; + + /** + * system_name_string_index is the index in the string table to the system_name associated with the function. + * + * @generated from field: uint32 system_name_string_index = 7; + */ + systemNameStringIndex = 0; + + /** + * filename_string_index is the index in the string table to the filename associated with the function. + * + * @generated from field: uint32 filename_string_index = 8; + */ + filenameStringIndex = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Function"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "start_line", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "system_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "filename", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "name_string_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 7, name: "system_name_string_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 8, name: "filename_string_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Function { + return new Function().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Function { + return new Function().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Function { + return new Function().fromJsonString(jsonString, options); + } + + static equals(a: Function | PlainMessage | undefined, b: Function | PlainMessage | undefined): boolean { + return proto3.util.equals(Function, a, b); + } +} + +/** + * Mapping describes a memory mapping. + * + * @generated from message parca.metastore.v1alpha1.Mapping + */ +export class Mapping extends Message { + /** + * id is the unique identifier for the mapping. + * + * @generated from field: string id = 1; + */ + id = ""; + + /** + * start is the start address of the mapping. + * + * @generated from field: uint64 start = 2; + */ + start = protoInt64.zero; + + /** + * limit is the length of the address space of the mapping. + * + * @generated from field: uint64 limit = 3; + */ + limit = protoInt64.zero; + + /** + * offset in the binary that corresponds to the first mapped address. + * + * @generated from field: uint64 offset = 4; + */ + offset = protoInt64.zero; + + /** + * file is the name of the file associated with the mapping. + * + * @generated from field: string file = 5; + */ + file = ""; + + /** + * build_id is the build ID of the mapping. + * + * @generated from field: string build_id = 6; + */ + buildId = ""; + + /** + * has_functions indicates whether the mapping has associated functions. + * + * @generated from field: bool has_functions = 7; + */ + hasFunctions = false; + + /** + * has_filenames indicates whether the mapping has associated filenames. + * + * @generated from field: bool has_filenames = 8; + */ + hasFilenames = false; + + /** + * has_line_numbers indicates whether the mapping has associated line numbers. + * + * @generated from field: bool has_line_numbers = 9; + */ + hasLineNumbers = false; + + /** + * has_inline_frames indicates whether the mapping has associated inline frames. + * + * @generated from field: bool has_inline_frames = 10; + */ + hasInlineFrames = false; + + /** + * fileStringIndex is the index in the string table to the file name associated with the mapping. + * + * @generated from field: uint32 file_string_index = 11; + */ + fileStringIndex = 0; + + /** + * build_id_string_index is the index in the string table to the build ID of the mapping. + * + * @generated from field: uint32 build_id_string_index = 12; + */ + buildIdStringIndex = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.metastore.v1alpha1.Mapping"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "start", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 3, name: "limit", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 4, name: "offset", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 5, name: "file", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "build_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "has_functions", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 8, name: "has_filenames", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 9, name: "has_line_numbers", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 10, name: "has_inline_frames", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 11, name: "file_string_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 12, name: "build_id_string_index", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Mapping { + return new Mapping().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Mapping { + return new Mapping().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Mapping { + return new Mapping().fromJsonString(jsonString, options); + } + + static equals(a: Mapping | PlainMessage | undefined, b: Mapping | PlainMessage | undefined): boolean { + return proto3.util.equals(Mapping, a, b); + } +} + diff --git a/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_connectweb.ts b/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_connectweb.ts new file mode 100644 index 00000000000..f030e0d60b3 --- /dev/null +++ b/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_connectweb.ts @@ -0,0 +1,52 @@ +// @generated by protoc-gen-connect-web v0.8.4 with parameter "target=ts" +// @generated from file parca/profilestore/v1alpha1/profilestore.proto (package parca.profilestore.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { AgentsRequest, AgentsResponse, WriteRawRequest, WriteRawResponse } from "./profilestore_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * ProfileStoreService is the service the accepts pprof writes + * + * @generated from service parca.profilestore.v1alpha1.ProfileStoreService + */ +export const ProfileStoreService = { + typeName: "parca.profilestore.v1alpha1.ProfileStoreService", + methods: { + /** + * WriteRaw accepts a raw set of bytes of a pprof file + * + * @generated from rpc parca.profilestore.v1alpha1.ProfileStoreService.WriteRaw + */ + writeRaw: { + name: "WriteRaw", + I: WriteRawRequest, + O: WriteRawResponse, + kind: MethodKind.Unary, + }, + } +} as const; + +/** + * AgentsService maintains the agents + * + * @generated from service parca.profilestore.v1alpha1.AgentsService + */ +export const AgentsService = { + typeName: "parca.profilestore.v1alpha1.AgentsService", + methods: { + /** + * Agents return the agents that pushed data to the server + * + * @generated from rpc parca.profilestore.v1alpha1.AgentsService.Agents + */ + agents: { + name: "Agents", + I: AgentsRequest, + O: AgentsResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_pb.ts b/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_pb.ts new file mode 100644 index 00000000000..055bd650b7f --- /dev/null +++ b/ui/packages/shared/client/src/parca/profilestore/v1alpha1/profilestore_pb.ts @@ -0,0 +1,419 @@ +// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" +// @generated from file parca/profilestore/v1alpha1/profilestore.proto (package parca.profilestore.v1alpha1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Duration, Message, proto3, Timestamp } from "@bufbuild/protobuf"; + +/** + * WriteRawRequest writes a pprof profile for a given tenant + * + * @generated from message parca.profilestore.v1alpha1.WriteRawRequest + */ +export class WriteRawRequest extends Message { + /** + * tenant is the given tenant to store the pprof profile under + * + * @generated from field: string tenant = 1 [deprecated = true]; + * @deprecated + */ + tenant = ""; + + /** + * series is a set raw pprof profiles and accompanying labels + * + * @generated from field: repeated parca.profilestore.v1alpha1.RawProfileSeries series = 2; + */ + series: RawProfileSeries[] = []; + + /** + * normalized is a flag indicating if the addresses in the profile is normalized for position independent code + * + * @generated from field: bool normalized = 3; + */ + normalized = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.profilestore.v1alpha1.WriteRawRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "tenant", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "series", kind: "message", T: RawProfileSeries, repeated: true }, + { no: 3, name: "normalized", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): WriteRawRequest { + return new WriteRawRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): WriteRawRequest { + return new WriteRawRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): WriteRawRequest { + return new WriteRawRequest().fromJsonString(jsonString, options); + } + + static equals(a: WriteRawRequest | PlainMessage | undefined, b: WriteRawRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(WriteRawRequest, a, b); + } +} + +/** + * WriteRawResponse is the empty response + * + * @generated from message parca.profilestore.v1alpha1.WriteRawResponse + */ +export class WriteRawResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.profilestore.v1alpha1.WriteRawResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): WriteRawResponse { + return new WriteRawResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): WriteRawResponse { + return new WriteRawResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): WriteRawResponse { + return new WriteRawResponse().fromJsonString(jsonString, options); + } + + static equals(a: WriteRawResponse | PlainMessage | undefined, b: WriteRawResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(WriteRawResponse, a, b); + } +} + +/** + * RawProfileSeries represents the pprof profile and its associated labels + * + * @generated from message parca.profilestore.v1alpha1.RawProfileSeries + */ +export class RawProfileSeries extends Message { + /** + * LabelSet is the key value pairs to identify the corresponding profile + * + * @generated from field: parca.profilestore.v1alpha1.LabelSet labels = 1; + */ + labels?: LabelSet; + + /** + * samples are the set of profile bytes + * + * @generated from field: repeated parca.profilestore.v1alpha1.RawSample samples = 2; + */ + samples: RawSample[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "parca.profilestore.v1alpha1.RawProfileSeries"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "labels", kind: "message", T: LabelSet }, + { no: 2, name: "samples", kind: "message", T: RawSample, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RawProfileSeries { + return new RawProfileSeries().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RawProfileSeries { + return new RawProfileSeries().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RawProfileSeries { + return new RawProfileSeries().fromJsonString(jsonString, options); + } + + static equals(a: RawProfileSeries | PlainMessage | undefined, b: RawProfileSeries | PlainMessage | undefined): boolean { + return proto3.util.equals(RawProfileSeries, a, b); + } +} + +/** + * Label is a key value pair of identifiers + * + * @generated from message parca.profilestore.v1alpha1.Label + */ +export class Label extends Message