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 ¶
- type API
- type AffectedGrouping
- type BlameEntry
- type BlameSummaryV1
- type ClusterOptions
- type Impl
- func (s *Impl) ChangelistLastUpdated(ctx context.Context, qCLID string) (time.Time, error)
- func (s *Impl) ComputeGUIStatus(ctx context.Context) (frontend.GUIStatus, error)
- func (s *Impl) CountDigestsByTest(ctx context.Context, q frontend.ListTestsQuery) (frontend.ListTestsResponse, error)
- func (s *Impl) GetBlamesForUntriagedDigests(ctx context.Context, corpus string) (BlameSummaryV1, error)
- func (s *Impl) GetChangelistParamset(ctx context.Context, crs, clID string) (paramtools.ReadOnlyParamSet, error)
- func (s *Impl) GetCluster(ctx context.Context, opts ClusterOptions) (frontend.ClusterDiffResult, error)
- func (s *Impl) GetCommitsInWindow(ctx context.Context) ([]frontend.Commit, error)
- func (s *Impl) GetDigestDetails(ctx context.Context, grouping paramtools.Params, digest types.Digest, ...) (frontend.DigestDetails, error)
- func (s *Impl) GetDigestsDiff(ctx context.Context, grouping paramtools.Params, left, right types.Digest, ...) (frontend.DigestComparison, error)
- func (s *Impl) GetDigestsForGrouping(ctx context.Context, grouping paramtools.Params) (frontend.DigestListResponse, error)
- func (s *Impl) GetPrimaryBranchParamset(ctx context.Context) (paramtools.ReadOnlyParamSet, error)
- func (s *Impl) NewAndUntriagedSummaryForCL(ctx context.Context, qCLID string) (NewAndUntriagedSummary, error)
- func (s *Impl) Search(ctx context.Context, q *query.Search) (*frontend.SearchResponse, error)
- func (s *Impl) SetDatabaseType(dbType config.DatabaseType)
- func (s *Impl) SetReviewSystemTemplates(m map[string]string)
- func (s *Impl) StartApplyingPublicParams(ctx context.Context, matcher publicparams.Matcher, interval time.Duration) error
- func (s *Impl) StartCacheProcess(ctx context.Context, interval time.Duration, commitsWithData int) error
- func (s *Impl) StartMaterializedViews(ctx context.Context, corpora []string, updateInterval time.Duration) error
- type NewAndUntriagedSummary
- type PatchsetNewAndUntriagedSummary
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 ¶
ChangelistLastUpdated implements the API interface.
func (*Impl) ComputeGUIStatus ¶
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 ¶
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) SetDatabaseType ¶
func (s *Impl) SetDatabaseType(dbType config.DatabaseType)
SetDatabaseType sets the database type for the current configuration.
func (*Impl) SetReviewSystemTemplates ¶
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.