Documentation
¶
Index ¶
- Constants
- Variables
- func InjectCollectDiagnostics(ctx context.Context, collect bool) context.Context
- func InjectCollectDiagnosticsFromHeader(ctx context.Context, headers map[string][]string) context.Context
- type Context
- type DiagnosticSummary
- type Store
- func (s *Store) Add(id string, diag *queryv1.Diagnostics)
- func (s *Store) AddRequest(id string, method string, request any)
- func (s *Store) AddResponse(id string, response any, sizeBytes int64, responseTimeMs int64)
- func (s *Store) Cleanup(ctx context.Context) (int, error)
- func (s *Store) Delete(ctx context.Context, tenantID, id string) error
- func (s *Store) Export(ctx context.Context, tenantID, id string) ([]byte, error)
- func (s *Store) Flush(ctx context.Context, tenantID, id string) error
- func (s *Store) Get(ctx context.Context, tenantID, id string) (*StoredDiagnostics, error)
- func (s *Store) Import(ctx context.Context, tenantID string, newID string, zipData []byte) (string, error)
- func (s *Store) ListByTenant(ctx context.Context, tenant string) ([]*DiagnosticSummary, error)
- type StoreOption
- type StoredDiagnostics
- type Wrapper
- func (w *Wrapper) AnalyzeQuery(ctx context.Context, req *connect.Request[querierv1.AnalyzeQueryRequest]) (*connect.Response[querierv1.AnalyzeQueryResponse], error)
- func (w *Wrapper) Diff(ctx context.Context, req *connect.Request[querierv1.DiffRequest]) (*connect.Response[querierv1.DiffResponse], error)
- func (w *Wrapper) GetProfileStats(ctx context.Context, req *connect.Request[typesv1.GetProfileStatsRequest]) (*connect.Response[typesv1.GetProfileStatsResponse], error)
- func (w *Wrapper) LabelNames(ctx context.Context, req *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)
- func (w *Wrapper) LabelValues(ctx context.Context, req *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)
- func (w *Wrapper) ProfileTypes(ctx context.Context, req *connect.Request[querierv1.ProfileTypesRequest]) (*connect.Response[querierv1.ProfileTypesResponse], error)
- func (w *Wrapper) SelectHeatmap(ctx context.Context, req *connect.Request[querierv1.SelectHeatmapRequest]) (*connect.Response[querierv1.SelectHeatmapResponse], error)
- func (w *Wrapper) SelectMergeProfile(ctx context.Context, req *connect.Request[querierv1.SelectMergeProfileRequest]) (*connect.Response[profilev1.Profile], error)
- func (w *Wrapper) SelectMergeSpanProfile(ctx context.Context, ...) (*connect.Response[querierv1.SelectMergeSpanProfileResponse], error)
- func (w *Wrapper) SelectMergeStacktraces(ctx context.Context, ...) (*connect.Response[querierv1.SelectMergeStacktracesResponse], error)
- func (w *Wrapper) SelectSeries(ctx context.Context, req *connect.Request[querierv1.SelectSeriesRequest]) (*connect.Response[querierv1.SelectSeriesResponse], error)
- func (w *Wrapper) Series(ctx context.Context, req *connect.Request[querierv1.SeriesRequest]) (*connect.Response[querierv1.SeriesResponse], error)
- type Writer
Constants ¶
const ( RequestHeader = "X-Pyroscope-Collect-Diagnostics" IdHeader = "X-Pyroscope-Diagnostics-Id" )
Variables ¶
var Interceptor = &interceptor{}
Interceptor is a connect interceptor that extracts the diagnostics collection flag from request headers and injects it into the context.
Functions ¶
func InjectCollectDiagnostics ¶
InjectCollectDiagnostics injects the diagnostics collection flag and start time into the context.
Types ¶
type DiagnosticSummary ¶
type DiagnosticSummary struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
Method string `json:"method"`
ResponseTimeMs int64 `json:"response_time_ms"`
ResponseSizeBytes int64 `json:"response_size_bytes"`
Request json.RawMessage `json:"request,omitempty"`
}
DiagnosticSummary contains minimal info for listing diagnostics.
type Store ¶
Store manages query diagnostics storage and retrieval.
func (*Store) Add ¶
func (s *Store) Add(id string, diag *queryv1.Diagnostics)
Add stores diagnostics in memory for later flushing.
func (*Store) AddRequest ¶
AddRequest stores request related data for later flushing.
func (*Store) AddResponse ¶
AddResponse stores response related data for later flushing.
func (*Store) Import ¶
func (s *Store) Import(ctx context.Context, tenantID string, newID string, zipData []byte) (string, error)
Import extracts a zip archive and stores the diagnostic files. The files are stored under the tenantID provided as an argument; the tenantID from the zip file is ignored.
func (*Store) ListByTenant ¶
ListByTenant returns all diagnostics for a given tenant.
type StoreOption ¶
type StoreOption func(*Store)
StoreOption is a functional option for configuring a Store.
func WithTTL ¶
func WithTTL(ttl time.Duration) StoreOption
WithTTL sets the TTL for stored diagnostics.
type StoredDiagnostics ¶
type StoredDiagnostics struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
TenantID string `json:"tenant_id"`
ResponseTimeMs int64 `json:"response_time_ms,omitempty"`
ResponseSizeBytes int64 `json:"response_size_bytes,omitempty"`
Method string `json:"method,omitempty"`
Request json.RawMessage `json:"request,omitempty"`
Response json.RawMessage `json:"response,omitempty"`
Plan *queryv1.QueryPlan `json:"plan,omitempty"`
Execution *queryv1.ExecutionNode `json:"execution,omitempty"`
}
StoredDiagnostics wraps the query diagnostics with metadata.
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper wraps a QuerierServiceClient to handle query diagnostics.
func NewWrapper ¶
func NewWrapper(logger log.Logger, client querierv1connect.QuerierServiceClient, writer Writer) *Wrapper