Documentation
¶
Overview ¶
Package profilehandler provides a Pyroscope-compatible API implementation backed by the ProfileQL engine.
Index ¶
- type PyroscopeAPI
- func (h *PyroscopeAPI) GetApps(ctx context.Context) ([]pyroscopeapi.ApplicationMetadata, error)
- func (h *PyroscopeAPI) Ingest(ctx context.Context, _ *pyroscopeapi.IngestReqWithContentType, ...) error
- func (h *PyroscopeAPI) LabelValues(ctx context.Context, params pyroscopeapi.LabelValuesParams) (pyroscopeapi.LabelValues, error)
- func (h *PyroscopeAPI) Labels(ctx context.Context, params pyroscopeapi.LabelsParams) (pyroscopeapi.Labels, error)
- func (h *PyroscopeAPI) NewError(ctx context.Context, err error) *pyroscopeapi.ErrorStatusCode
- func (h *PyroscopeAPI) Render(ctx context.Context, params pyroscopeapi.RenderParams) (pyroscopeapi.RenderRes, error)
- type PyroscopeAPIOptions
- type QuerierService
- func (s *QuerierService) GetProfileStats(ctx context.Context, _ *connect.Request[typesv1.GetProfileStatsRequest]) (*connect.Response[typesv1.GetProfileStatsResponse], error)
- func (s *QuerierService) LabelNames(ctx context.Context, req *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)
- func (s *QuerierService) LabelValues(ctx context.Context, req *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)
- func (s *QuerierService) ProfileTypes(ctx context.Context, req *connect.Request[querierv1.ProfileTypesRequest]) (*connect.Response[querierv1.ProfileTypesResponse], error)
- func (s *QuerierService) SelectMergeProfile(ctx context.Context, req *connect.Request[querierv1.SelectMergeProfileRequest]) (*connect.Response[googlev1.Profile], error)
- func (s *QuerierService) SelectMergeStacktraces(ctx context.Context, ...) (*connect.Response[querierv1.SelectMergeStacktracesResponse], error)
- func (s *QuerierService) SelectSeries(ctx context.Context, req *connect.Request[querierv1.SelectSeriesRequest]) (*connect.Response[querierv1.SelectSeriesResponse], error)
- func (s *QuerierService) Series(ctx context.Context, req *connect.Request[querierv1.SeriesRequest]) (*connect.Response[querierv1.SeriesResponse], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PyroscopeAPI ¶
type PyroscopeAPI struct {
// contains filtered or unexported fields
}
PyroscopeAPI implements pyroscopeapi.Handler.
func NewPyroscopeAPI ¶
func NewPyroscopeAPI( q profilestorage.Querier, engine *profileqlengine.Engine, opts PyroscopeAPIOptions, ) *PyroscopeAPI
NewPyroscopeAPI creates a new PyroscopeAPI.
func (*PyroscopeAPI) GetApps ¶
func (h *PyroscopeAPI) GetApps(ctx context.Context) ([]pyroscopeapi.ApplicationMetadata, error)
GetApps implements getApps operation.
Returns the list of application metadata. Used by Grafana to test the connection to Pyroscope.
GET /api/apps
func (*PyroscopeAPI) Ingest ¶
func (h *PyroscopeAPI) Ingest(ctx context.Context, _ *pyroscopeapi.IngestReqWithContentType, _ pyroscopeapi.IngestParams) error
Ingest implements ingest operation.
Push data to Pyroscope.
POST /ingest
func (*PyroscopeAPI) LabelValues ¶
func (h *PyroscopeAPI) LabelValues(ctx context.Context, params pyroscopeapi.LabelValuesParams) (pyroscopeapi.LabelValues, error)
LabelValues implements labelValues operation.
Returns the list of label values.
GET /label-values
func (*PyroscopeAPI) Labels ¶
func (h *PyroscopeAPI) Labels(ctx context.Context, params pyroscopeapi.LabelsParams) (pyroscopeapi.Labels, error)
Labels implements labels operation.
Returns the list of labels.
GET /labels
func (*PyroscopeAPI) NewError ¶
func (h *PyroscopeAPI) NewError(ctx context.Context, err error) *pyroscopeapi.ErrorStatusCode
NewError creates *ErrorStatusCode from an error returned by the handler.
Used for the common default response.
func (*PyroscopeAPI) Render ¶
func (h *PyroscopeAPI) Render(ctx context.Context, params pyroscopeapi.RenderParams) (pyroscopeapi.RenderRes, error)
Render implements render operation.
Renders the given query in the requested format (json, pprof, collapsed or html).
GET /render
type PyroscopeAPIOptions ¶
type PyroscopeAPIOptions struct {
// DefaultSince sets the default lookback for the time range when only the
// end (or nothing) is provided. Defaults to one [time.Hour].
DefaultSince time.Duration
}
PyroscopeAPIOptions describes PyroscopeAPI options.
type QuerierService ¶
type QuerierService struct {
querierv1connect.UnimplementedQuerierServiceHandler
// contains filtered or unexported fields
}
QuerierService implements the connect QuerierService API used by Grafana's built-in Pyroscope datasource, backed by the same ProfileQL engine and profilestorage.Querier as the legacy Pyroscope HTTP API (PyroscopeAPI). The two are served side by side on the Pyroscope listener.
Methods that have no representation in oteldb's storage (span profiles, heatmaps, diffs, async queries) are left to the embedded Unimplemented handler, which returns CodeUnimplemented.
func NewQuerierService ¶
func NewQuerierService(q profilestorage.Querier, engine *profileqlengine.Engine) *QuerierService
NewQuerierService returns a QuerierService backed by q and engine.
func (*QuerierService) GetProfileStats ¶
func (s *QuerierService) GetProfileStats(ctx context.Context, _ *connect.Request[typesv1.GetProfileStatsRequest]) (*connect.Response[typesv1.GetProfileStatsResponse], error)
GetProfileStats implements the GetProfileStats RPC. Grafana uses it to detect whether the datasource has any data; oteldb does not track ingestion timestamps, so only data_ingested is set.
func (*QuerierService) LabelNames ¶
func (s *QuerierService) LabelNames(ctx context.Context, req *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)
LabelNames implements the LabelNames RPC.
func (*QuerierService) LabelValues ¶
func (s *QuerierService) LabelValues(ctx context.Context, req *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)
LabelValues implements the LabelValues RPC.
func (*QuerierService) ProfileTypes ¶
func (s *QuerierService) ProfileTypes(ctx context.Context, req *connect.Request[querierv1.ProfileTypesRequest]) (*connect.Response[querierv1.ProfileTypesResponse], error)
ProfileTypes implements the ProfileTypes RPC.
func (*QuerierService) SelectMergeProfile ¶
func (s *QuerierService) SelectMergeProfile(ctx context.Context, req *connect.Request[querierv1.SelectMergeProfileRequest]) (*connect.Response[googlev1.Profile], error)
SelectMergeProfile implements the SelectMergeProfile RPC, returning the merged profile in pprof (google.v1.Profile) format.
func (*QuerierService) SelectMergeStacktraces ¶
func (s *QuerierService) SelectMergeStacktraces(ctx context.Context, req *connect.Request[querierv1.SelectMergeStacktracesRequest]) (*connect.Response[querierv1.SelectMergeStacktracesResponse], error)
SelectMergeStacktraces implements the SelectMergeStacktraces RPC, returning the merged flamegraph.
func (*QuerierService) SelectSeries ¶
func (s *QuerierService) SelectSeries(ctx context.Context, req *connect.Request[querierv1.SelectSeriesRequest]) (*connect.Response[querierv1.SelectSeriesResponse], error)
SelectSeries implements the SelectSeries RPC by evaluating the merged total per time bucket. The group_by labels are not honored (a single total series is returned); the engine has no grouped time-series primitive, so this trades fidelity for a useful timeline.
func (*QuerierService) Series ¶
func (s *QuerierService) Series(ctx context.Context, req *connect.Request[querierv1.SeriesRequest]) (*connect.Response[querierv1.SeriesResponse], error)
Series implements the Series RPC. oteldb's querier does not enumerate full series (unique label sets), so this returns a best-effort approximation: for each requested label name, one single-label series per distinct value. It is enough for Grafana to populate group-by and label-value pickers.