search

package
v0.0.0-...-2d420a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 31 Imported by: 3

Documentation

Overview

Package search2 encapsulates various queries we make against Gold's data. It is backed by the SQL database and aims to replace the current search package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	// NewAndUntriagedSummaryForCL returns a summarized look at the new digests produced by a CL
	// (that is, digests not currently on the primary branch for this grouping at all) as well as
	// how many of the newly produced digests are currently untriaged.
	NewAndUntriagedSummaryForCL(ctx context.Context, qCLID string) (NewAndUntriagedSummary, error)

	// ChangelistLastUpdated returns the timestamp that the given CL was updated. It returns an
	// error if the CL does not exist.
	ChangelistLastUpdated(ctx context.Context, qCLID string) (time.Time, error)

	// Search queries the current tile based on the parameters specified in
	// the instance of the *query.Search.
	Search(context.Context, *query.Search) (*frontend.SearchResponse, error)

	// GetPrimaryBranchParamset returns all params that are on the most recent few tiles. If
	// this is public view, it will only return the params on the traces which match the publicly
	// visible rules.
	GetPrimaryBranchParamset(ctx context.Context) (paramtools.ReadOnlyParamSet, error)

	// GetChangelistParamset returns all params that were produced by the given CL. If
	// this is public view, it will only return the params on the traces which match the publicly
	// visible rules.
	GetChangelistParamset(ctx context.Context, crs, clID string) (paramtools.ReadOnlyParamSet, error)

	// GetBlamesForUntriagedDigests finds all untriaged digests at head and then tries to determine
	// which commits first introduced those untriaged digests. It returns a list of commits or
	// commit ranges that are believed to have caused those untriaged digests.
	GetBlamesForUntriagedDigests(ctx context.Context, corpus string) (BlameSummaryV1, error)

	// GetCluster returns all digests from the traces matching the various filters compared to
	// all other digests in that set, so they can be drawn as a 2d cluster. This helps visualize
	// patterns in the images, which can identify errors in triaging, among other things.
	GetCluster(ctx context.Context, opts ClusterOptions) (frontend.ClusterDiffResult, error)

	// GetCommitsInWindow returns the commits in the configured window.
	GetCommitsInWindow(ctx context.Context) ([]frontend.Commit, error)

	// GetDigestsForGrouping returns all digests that were produced in a given grouping in the most
	// recent window of data.
	GetDigestsForGrouping(ctx context.Context, grouping paramtools.Params) (frontend.DigestListResponse, error)

	// GetDigestDetails returns information about the given digest as produced on the given
	// grouping. If the CL and CRS are provided, it will include information specific to that CL.
	GetDigestDetails(ctx context.Context, grouping paramtools.Params, digest types.Digest, clID, crs string) (frontend.DigestDetails, error)

	// GetDigestsDiff returns comparison and triage information about the left and right digest.
	GetDigestsDiff(ctx context.Context, grouping paramtools.Params, left, right types.Digest, clID, crs string) (frontend.DigestComparison, error)

	// CountDigestsByTest summarizes the counts of digests according to some limited filtering
	// and breaks it down by test.
	CountDigestsByTest(ctx context.Context, q frontend.ListTestsQuery) (frontend.ListTestsResponse, error)

	// ComputeGUIStatus looks at all visible traces at head and returns a summary of how many are
	// untriaged for each corpus, as well as the most recent commit for which we have data.
	ComputeGUIStatus(ctx context.Context) (frontend.GUIStatus, error)
}

type AffectedGrouping

type AffectedGrouping struct {
	Grouping         paramtools.Params
	UntriagedDigests int
	SampleDigest     types.Digest
	// contains filtered or unexported fields
}

type BlameEntry

type BlameEntry struct {
	// CommitRange is either a single commit id or two commit ids separated by a colon indicating
	// a range. This string can be used as the "blame id" in the search.
	CommitRange string
	// TotalUntriagedDigests is the number of digests that are believed to be first untriaged
	// in this commit range.
	TotalUntriagedDigests int
	// AffectedGroupings summarize the untriaged digests affected in the commit range.
	AffectedGroupings []*AffectedGrouping
	// Commits is one or two commits corresponding to the CommitRange.
	Commits []frontend.Commit
}

BlameEntry represents a commit or range of commits that is responsible for some amount of untriaged digests. It allows us to identify potentially problematic commits and coordinate with the authors as necessary.

type BlameSummaryV1

type BlameSummaryV1 struct {
	Ranges []BlameEntry
}

type ClusterOptions

type ClusterOptions struct {
	Grouping                paramtools.Params
	Filters                 paramtools.ParamSet
	IncludePositiveDigests  bool
	IncludeNegativeDigests  bool
	IncludeUntriagedDigests bool
	CodeReviewSystem        string
	ChangelistID            string
	PatchsetID              string
}

type Impl

type Impl struct {
	// contains filtered or unexported fields
}

func New

func New(sqlDB *pgxpool.Pool, windowLength int, cacheClient cache.Cache, cache_corpora []string) *Impl

New returns an implementation of API.

func (*Impl) ChangelistLastUpdated

func (s *Impl) ChangelistLastUpdated(ctx context.Context, qCLID string) (time.Time, error)

ChangelistLastUpdated implements the API interface.

func (*Impl) ComputeGUIStatus

func (s *Impl) ComputeGUIStatus(ctx context.Context) (frontend.GUIStatus, error)

ComputeGUIStatus implements the API interface. It has special logic for public views vs the normal views to avoid leaking.

func (*Impl) CountDigestsByTest

func (s *Impl) CountDigestsByTest(ctx context.Context, q frontend.ListTestsQuery) (frontend.ListTestsResponse, error)

CountDigestsByTest counts only the digests at head that match the given query.

func (*Impl) GetBlamesForUntriagedDigests

func (s *Impl) GetBlamesForUntriagedDigests(ctx context.Context, corpus string) (BlameSummaryV1, error)

GetBlamesForUntriagedDigests implements the API interface.

func (*Impl) GetChangelistParamset

func (s *Impl) GetChangelistParamset(ctx context.Context, crs, clID string) (paramtools.ReadOnlyParamSet, error)

GetChangelistParamset returns a possibly cached ParamSet of all visible traces seen in the given changelist. It returns an error if no data has been seen for the given CL.

func (*Impl) GetCluster

func (s *Impl) GetCluster(ctx context.Context, opts ClusterOptions) (frontend.ClusterDiffResult, error)

GetCluster implements the API interface. TODO(kjlubick) Handle CL data (frontend currently does not).

func (*Impl) GetCommitsInWindow

func (s *Impl) GetCommitsInWindow(ctx context.Context) ([]frontend.Commit, error)

GetCommitsInWindow implements the API interface

func (*Impl) GetDigestDetails

func (s *Impl) GetDigestDetails(ctx context.Context, grouping paramtools.Params, digest types.Digest, clID, crs string) (frontend.DigestDetails, error)

GetDigestDetails is very similar to the Search() function, but it only has one digest, so there is only one result.

func (*Impl) GetDigestsDiff

func (s *Impl) GetDigestsDiff(ctx context.Context, grouping paramtools.Params, left, right types.Digest, clID, crs string) (frontend.DigestComparison, error)

GetDigestsDiff implements the API interface.

func (*Impl) GetDigestsForGrouping

func (s *Impl) GetDigestsForGrouping(ctx context.Context, grouping paramtools.Params) (frontend.DigestListResponse, error)

GetDigestsForGrouping implements the API interface.

func (*Impl) GetPrimaryBranchParamset

func (s *Impl) GetPrimaryBranchParamset(ctx context.Context) (paramtools.ReadOnlyParamSet, error)

GetPrimaryBranchParamset returns a possibly cached ParamSet of all visible traces over the last N tiles that correspond to the windowLength.

func (*Impl) NewAndUntriagedSummaryForCL

func (s *Impl) NewAndUntriagedSummaryForCL(ctx context.Context, qCLID string) (NewAndUntriagedSummary, error)

NewAndUntriagedSummaryForCL queries all the patchsets in parallel (to keep the query less complex). If there are no patchsets for the provided CL, it returns an error.

func (*Impl) Search

func (s *Impl) Search(ctx context.Context, q *query.Search) (*frontend.SearchResponse, error)

Search implements the SearchAPI interface.

func (*Impl) SetReviewSystemTemplates

func (s *Impl) SetReviewSystemTemplates(m map[string]string)

SetReviewSystemTemplates sets the URL templates that are used to link to the code review system. The Changelist ID will be substituted in using fmt.Sprintf and a %s placeholder.

func (*Impl) StartApplyingPublicParams

func (s *Impl) StartApplyingPublicParams(ctx context.Context, matcher publicparams.Matcher, interval time.Duration) error

StartApplyingPublicParams loads the cached set of traces which are publicly visible and then starts a goroutine to update this cache as per the provided interval.

func (*Impl) StartCacheProcess

func (s *Impl) StartCacheProcess(ctx context.Context, interval time.Duration, commitsWithData int) error

StartCacheProcess loads the caches used for searching and starts a goroutine to keep those up to date.

func (*Impl) StartMaterializedViews

func (s *Impl) StartMaterializedViews(ctx context.Context, corpora []string, updateInterval time.Duration) error

StartMaterializedViews creates materialized views for non-ignored traces belonging to the given corpora. It starts a goroutine to keep these up to date.

type NewAndUntriagedSummary

type NewAndUntriagedSummary struct {
	// ChangelistID is the nonqualified id of the CL.
	ChangelistID string
	// PatchsetSummaries is a summary for all Patchsets for which we have data.
	PatchsetSummaries []PatchsetNewAndUntriagedSummary
	// LastUpdated returns the timestamp of the CL, which corresponds to the last datapoint for
	// this CL.
	LastUpdated time.Time
	// Outdated is set to true if the value that was previously cached was out of date and is
	// currently being recalculated. We do this to return something quickly to the user (even if
	// something like the
	Outdated bool
}

NewAndUntriagedSummary is a summary of the results associated with a given CL. It focuses on the untriaged and new images produced.

type PatchsetNewAndUntriagedSummary

type PatchsetNewAndUntriagedSummary struct {
	// NewImages is the number of new images (digests) that were produced by this patchset by
	// non-ignored traces and not seen on the primary branch.
	NewImages int
	// NewUntriagedImages is the number of NewImages which are still untriaged. It is less than or
	// equal to NewImages.
	NewUntriagedImages int
	// TotalUntriagedImages is the number of images produced by this patchset by non-ignored traces
	// that are untriaged. This includes images that are untriaged and observed on the primary
	// branch (i.e. might not be the fault of this CL/PS). It is greater than or equal to
	// NewUntriagedImages.
	TotalUntriagedImages int
	// PatchsetID is the nonqualified id of the patchset. This is usually a git hash.
	PatchsetID string
	// PatchsetOrder is represents the chronological order the patchsets are in. It starts at 1.
	PatchsetOrder int
}

PatchsetNewAndUntriagedSummary is the summary for a specific PS. It focuses on the untriaged and new images produced.

Directories

Path Synopsis
Package query contains the logic involving parsing queries to Gold's search endpoints.
Package query contains the logic involving parsing queries to Gold's search endpoints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL