analysis/

directory
v0.0.0-...-110cdec Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0

README

LUCI Analysis

LUCI Analysis is a system designed to understand and reduce the impact of test failures.

Prerequisites

Commands below assume you are running in the infra environment. To enter the infra env (via the infra.git checkout), run:

eval infra/go/env.py

Local Development flow

To run the server locally, first authorize as the correct GCP project (you should only need to do this once):

gcloud config set project luci-analysis-dev
gcloud auth application-default login

Authenticate in LUCI and in CIPD:

  1. In LUCI Analysis's frontend directory run:
    luci-auth login -scopes "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.email"
    
  2. In the same directory run:
    cipd auth-login
    

Once the GCP project is authorized, in one terminal start esbuild to rebuild the UI code after any changes:

cd frontend/ui
npm run watch

To run the server, in another terminal use:

cd frontend
go run main.go \
 -cloud-project luci-analysis-dev \
 -spanner-database projects/luci-analysis-dev/instances/dev/databases/luci-analysis-dev \
 -auth-service-host chrome-infra-auth-dev.appspot.com \
 -luci-analysis-host 127.0.0.1:8800 \
 -default-request-timeout 10m0s \
 -buganizer-mode disable \
 -config-local-dir ../configs \
 -encrypted-cookies-expose-state-endpoint

-default-request-timeout is needed if exercising cron jobs through the admin portal as cron jobs run through the /admin/ endpoint attract the default timeout of 1 minute, instead of the 10 minute timeout of the /internal/ endpoint (hit by GAE cron jobs when they are actually executing).

-buganizer-mode is needed when running cron jobs that create/update buganizer issues (e.g. update-analysis-and-bugs). Set the mode to disable to prevent the cron job from filing buganizer bugs.

Note that -config-local-dir is required only if you plan on modifying config and loading it into Cloud Datastore via the read-config cron job accessible via http://127.0.0.1:8900/admin/portal/cron for testing. Omitting this, the server will fetch the current config from Cloud Datastore (as periodically refreshed from LUCI Config Service).

You may also be able to use an arbitrary cloud project (e.g. 'dev') if you setup Cloud Datastore emulator and setup a config for that project under configs.

Running UI tests

You can run the UI tests by:

cd frontend/ui
npm run test

Run Spanner integration tests using Cloud Spanner Emulator

Install Cloud Spanner Emulator
Linux

The Cloud Spanner Emulator is part of the bundled gcloud, to make sure it's installed:

cd infra
gclient runhooks
eval `./go/env.py`
which gcloud # should show bundled gcloud
gcloud components list # should see cloud-spanner-emulator is installed
Run tests

From command line, first set environment variables:

export INTEGRATION_TESTS=1

Then run go test as usual. For example:

go test go.chromium.org/luci/analysis/...

Run UI linter

To run the UI code linter (note: this will also try to auto-fix issues), run:

cd frontend/ui
npm run lint

To additionally auto-fix issues, run:

cd frontend/ui
npm run lint-fix

Regenerating UI proto bindings

You can regenerate typescript bindings for proto files by running:

cd frontend/ui
npm run gen_proto

Deployment

Developer Testing

LUCI Analysis uses gae.py for deployment of the GAE instances for developer testing (e.g. of local changes).

First, enter the infra env (via the infra.git checkout):

eval infra/go/env.py

Then use the following commands to deploy:

cd frontend/ui
npm run build
gae.py upload -A luci-analysis-dev default api
Dev and Prod Instances

The dev and prod instances are managed via LUCI GAE Automatic Deployment (Googlers-only).

Make a production release
  1. Make sure that you have an infra_internal checkout.
  2. Navigate to data/gae directory under your base checkout directory, should be ~/infra.
  3. Pull the latest with git rebase-update or git checkout main && git pull.
  4. Create a new branch git new-branch <NAME> or git -b <NAME>.
  5. run ./scripts/promote.py luci-analysis --canary --stable --commit.
  6. Upload the CL git cl upload.
  7. Request approval from space: LUCI Test War Room.

Directories

Path Synopsis
Package app contains pub/sub handlers.
Package app contains pub/sub handlers.
internal
admin
Package admin contains RPCs used to manage the LUCI Analysis service.
Package admin contains RPCs used to manage the LUCI Analysis service.
admin/proto
Package adminpb defines the LUCI Analysis management interface.
Package adminpb defines the LUCI Analysis management interface.
aip
Package aip contains utilities used to comply with API Improvement Proposals (AIPs) from https://google.aip.dev/.
Package aip contains utilities used to comply with API Improvement Proposals (AIPs) from https://google.aip.dev/.
analysis
Package analysis contains methods to query cluster analysis maintained in BigQuery, and to add/update clustered failures used by the analysis.
Package analysis contains methods to query cluster analysis maintained in BigQuery, and to add/update clustered failures used by the analysis.
analysis/metrics
Package metrics provides a framework for cluster-based metrics.
Package metrics provides a framework for cluster-based metrics.
bqutil
Package bqutil provides utility functions to interact with BigQuery.
Package bqutil provides utility functions to interact with BigQuery.
bugs/buganizer
Package buganizer contains methods to manage issues in Issue Tracker linked to failure association rules.
Package buganizer contains methods to manage issues in Issue Tracker linked to failure association rules.
bugs/cron
Package cron defines the update-analysis-and-bugs cron job handler.
Package cron defines the update-analysis-and-bugs cron job handler.
bugs/updater
Package updater contains methods to orchestrate automatic bug management, including automatic bug filing and automatic priority updates/auto-closure.
Package updater contains methods to orchestrate automatic bug management, including automatic bug filing and automatic priority updates/auto-closure.
buildbucket
Package buildbucket contains logic of interacting with Buildbucket.
Package buildbucket contains logic of interacting with Buildbucket.
changepoints
Package changepoints handles change point detection and analysis.
Package changepoints handles change point detection and analysis.
changepoints/analyzer
Package analyzer converts the input buffer into segments using changepoint analysis, and synthesises those segments with the segments in the output buffer to produce a logical segementation of the test history.
Package analyzer converts the input buffer into segments using changepoint analysis, and synthesises those segments with the segments in the output buffer to produce a logical segementation of the test history.
changepoints/bayesian
Package bayesian implements bayesian analysis for detecting change points.
Package bayesian implements bayesian analysis for detecting change points.
changepoints/bqexporter
Package bqexporter handles the export of test variant analysis results to BigQuery.
Package bqexporter handles the export of test variant analysis results to BigQuery.
changepoints/bqupdater
Package bqupdator handles the update of bigquery tables related to changepoint analysis.
Package bqupdator handles the update of bigquery tables related to changepoint analysis.
changepoints/groupexporter
Package groupexporter provides functions to export grouped changepoints to BigQuery.
Package groupexporter provides functions to export grouped changepoints to BigQuery.
changepoints/groupscheduler
Package groupscheduler schedules group changepoints tasks.
Package groupscheduler schedules group changepoints tasks.
changepoints/inputbuffer
Package inputbuffer handles the input buffer of change point analysis.
Package inputbuffer handles the input buffer of change point analysis.
changepoints/model
Package model contains common types used in changepoint analysis.
Package model contains common types used in changepoint analysis.
changepoints/sorbet
Package sorbet implements analysis for test changepoint culprits.
Package sorbet implements analysis for test changepoint culprits.
changepoints/sources
Package sources handles sources information.
Package sources handles sources information.
changepoints/testutil
Package testutil contains utility functions for tests.
Package testutil contains utility functions for tests.
changepoints/testvariantbranch
Package testvariantbranch handles test variant branch of change point analysis.
Package testvariantbranch handles test variant branch of change point analysis.
checkpoints
Package checkpoints contains methods for maintaining and using process checkpoints to ensure processes run once only.
Package checkpoints contains methods for maintaining and using process checkpoints to ensure processes run once only.
clustering/algorithms/failurereason
Package failurereason contains the failure reason clustering algorithm for LUCI Analysis.
Package failurereason contains the failure reason clustering algorithm for LUCI Analysis.
clustering/algorithms/testname
Package testname contains the test name-based clustering algorithm for LUCI Analysis.
Package testname contains the test name-based clustering algorithm for LUCI Analysis.
clustering/algorithms/testname/rules
Package rules provides methods to evaluate test name clustering rules.
Package rules provides methods to evaluate test name clustering rules.
clustering/rules
Package rules contains methods to read and write failure association rules.
Package rules contains methods to read and write failure association rules.
clustering/rules/exporter
Package exporter provides methods to interact with the failure_assocation_rules BigQuery table.
Package exporter provides methods to interact with the failure_assocation_rules BigQuery table.
clustering/rules/lang
Package lang parses failure association rule predicates.
Package lang parses failure association rule predicates.
clustering/shards
Package shards provides methods to access the ReclusteringShards Spanner table.
Package shards provides methods to access the ReclusteringShards Spanner table.
config
Package config implements app-level configs for LUCI Analysis.
Package config implements app-level configs for LUCI Analysis.
config/compiledcfg
Package compiledcfg contains compiled versions of the LUCI Analysis config.
Package compiledcfg contains compiled versions of the LUCI Analysis config.
cv
Package cv contains logic of interacting with CV (LUCI Change Verifier).
Package cv contains logic of interacting with CV (LUCI Change Verifier).
failureattributes
Package failureattributes supports computing and recording additional attributes of a test failure.
Package failureattributes supports computing and recording additional attributes of a test failure.
gerrit
Package gerrit contains logic for interacting with Gerrit.
Package gerrit contains logic for interacting with Gerrit.
gerritchangelists
Package gerritchangelists contains methods for maintaining a cache of whether gerrit changelists were authored by humans or automation.
Package gerritchangelists contains methods for maintaining a cache of whether gerrit changelists were authored by humans or automation.
gitiles
Package gitiles contains logic for interacting with gitiles.
Package gitiles contains logic for interacting with gitiles.
hosts
Package hosts defines a LUCI Server module used to configure the hostnames of the services LUCI Analysis communicates with in a deplpoyment.
Package hosts defines a LUCI Server module used to configure the hostnames of the services LUCI Analysis communicates with in a deplpoyment.
ingestion/control
Package control provides methods to read and write records used to:
Package control provides methods to read and write records used to:
ingestion/join
Package join contains methods for joining buildbucket build completions with LUCI CV completions and ResultDB invocation finalizations.
Package join contains methods for joining buildbucket build completions with LUCI CV completions and ResultDB invocation finalizations.
perms
Package perms defines permissions used to control access to LUCI Analysis resources, and related methods.
Package perms defines permissions used to control access to LUCI Analysis resources, and related methods.
resultdb
Package resultdb contains logic of interacting with resultdb.
Package resultdb contains logic of interacting with resultdb.
scopedauth
Package scopedauth defines a LUCI Server module used to configure how LUCI Analysis authenticates to buildbucket, resultdb and gerrit.
Package scopedauth defines a LUCI Server module used to configure how LUCI Analysis authenticates to buildbucket, resultdb and gerrit.
services/backfill
Package backfill implements tasks to backfill data in BigQuery.
Package backfill implements tasks to backfill data in BigQuery.
services/bugupdater
Package bugupdater defines a task for updating a project's LUCI Analysis bugs in response to the latest cluster metrics.
Package bugupdater defines a task for updating a project's LUCI Analysis bugs in response to the latest cluster metrics.
services/buildjoiner
Package buildjoiner defines a task to join a completed build with the other context (presubmit run and/or ResultDB invocation) required for ingestion.
Package buildjoiner defines a task to join a completed build with the other context (presubmit run and/or ResultDB invocation) required for ingestion.
services/changepointgrouper
Package changepointgrouper defines the top-level task queue which groups changepoints from changepoint analysis and export it BigQuery table.
Package changepointgrouper defines the top-level task queue which groups changepoints from changepoint analysis and export it BigQuery table.
services/resultingester
Package resultingester defines the task queue which ingests test results from ResultDB and pushes it into: - Test results table (for exoneration analysis) - Test results BigQuery export - Changepoint analysis
Package resultingester defines the task queue which ingests test results from ResultDB and pushes it into: - Test results table (for exoneration analysis) - Test results BigQuery export - Changepoint analysis
services/verdictingester
Package verdictingester defines the top-level task queue which ingests test verdicts from ResultDB and pushes it into LUCI Analysis's analysis and BigQuery export pipelines.
Package verdictingester defines the top-level task queue which ingests test verdicts from ResultDB and pushes it into LUCI Analysis's analysis and BigQuery export pipelines.
span
Package span contains utility functions to interact with the underlying Spanner storage.
Package span contains utility functions to interact with the underlying Spanner storage.
testresults
Package testresults contains methods for accessing test results in Spanner.
Package testresults contains methods for accessing test results in Spanner.
testresults/exporter
Package exporter contains methods to export test results to BigQuery.
Package exporter contains methods to export test results to BigQuery.
testresults/lowlatency
Package lowlatency contains methods for accessing the low-latency test results table in Spanner.
Package lowlatency contains methods for accessing the low-latency test results table in Spanner.
testresults/stability
Package stability implements the test stability analysis used by the QueryStability RPC.
Package stability implements the test stability analysis used by the QueryStability RPC.
testverdicts
Package testverdicts handles read and write test verdicts to BigQuery.
Package testverdicts handles read and write test verdicts to BigQuery.
tracing
Package tracing contains helper for reporting OpenTelemetry tracing spans.
Package tracing contains helper for reporting OpenTelemetry tracing spans.
views
Package views contains methods to interact with BigQuery views.
Package views contains methods to interact with BigQuery views.
Package pbutil contains methods for manipulating LUCI Analysis protos.
Package pbutil contains methods for manipulating LUCI Analysis protos.
proto
bq
v1
Package analysispb defines the API of the LUCI Analysis service.
Package analysispb defines the API of the LUCI Analysis service.
Package rpc contains implementations for remote proceedure calls exposed by LUCI Analysis.
Package rpc contains implementations for remote proceedure calls exposed by LUCI Analysis.
Package server contains shared server initialisation logic for LUCI Analysis services.
Package server contains shared server initialisation logic for LUCI Analysis services.

Jump to

Keyboard shortcuts

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