frontend

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

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

Go to latest
Published: Nov 26, 2024 License: BSD-3-Clause Imports: 61 Imported by: 0

README

This directory contains the frontend service implementation and it's respective controllers.

The frontend service is intended to host api endpoints that are user facing and invoked from the UI.

frontend.go is the entry point to the service and defines what apis are to be hosted. It also creates the necessary objects (store implementations, data/feature providers, etc) that are required by the individual apis and passes them on when creating the api instances.

api directory contains individual apis that have a struct per category. Below are the currently supported apis.

API Description
Alerts Contains endpoints related to regression alert configurations
Favorites Contains endpoints for the Favorites feature
Graphs Contains endpoints that provide data and trigger actions related to plotting individual graphs
Pinpoint Contains endpoints related to pinpoint jobs
Query Contains endpoints that serve the query dialog
Regressions Contains endpoints related to regressions detected by the system
Shortcuts Contains endpoints that create and manage shortcuts

Adding a new endpoint

  1. Check if the endpoint you are adding falls into any of the categories described above.
  2. If yes, add your handler function for the endpoint in the respective file and register the http route for that endpoint in the RegisterHandlers function in that file.
  3. If no, create a new file and define a struct for the api. The struct needs to implement the FrontendApi interface, so add the RegisterHandlers implementation and add the routes and their corresponding handlers. Once ready, add your struct implementation to the list in getFrontendApis() in frontend.go.

Documentation

Overview

Package frontend contains the Go code that servers the Perf web UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frontend

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

Frontend is the server for the Perf web UI.

func New

func New(flags *config.FrontendFlags) (*Frontend, error)

New returns a new Frontend instance.

func (*Frontend) GetHandler

func (f *Frontend) GetHandler(allowedHosts []string) http.Handler

GetHandler creates the http.Handler for all supported endpoints.

func (*Frontend) RoleEnforcedHandler

func (f *Frontend) RoleEnforcedHandler(role roles.Role, handler http.Handler) http.Handler

func (*Frontend) Serve

func (f *Frontend) Serve()

Serve content on the configured endpoints.Serve.

This method does not return.

type SkPerfConfig

type SkPerfConfig struct {
	Radius                     int                `json:"radius"`                          // The number of commits when doing clustering.
	KeyOrder                   []string           `json:"key_order"`                       // The order of the keys to appear first in query-sk elements.
	NumShift                   int                `json:"num_shift"`                       // The number of commits the shift navigation buttons should jump.
	Interesting                float32            `json:"interesting"`                     // The threshold for a cluster to be interesting.
	StepUpOnly                 bool               `json:"step_up_only"`                    // If true then only regressions that are a step up are displayed.
	CommitRangeURL             string             `json:"commit_range_url"`                // A URI Template to be used for expanding details on a range of commits. See cluster-summary2-sk.
	Demo                       bool               `json:"demo"`                            // True if this is a demo page, as opposed to being in production. Used to make puppeteer tests deterministic.
	DisplayGroupBy             bool               `json:"display_group_by"`                // True if the Group By section of Alert config should be displayed.
	HideListOfCommitsOnExplore bool               `json:"hide_list_of_commits_on_explore"` // True if the commit-detail-panel-sk element on the Explore details tab should be hidden.
	Notifications              notifytypes.Type   `json:"notifications"`                   // The type of notifications that can be sent.
	FetchChromePerfAnomalies   bool               `json:"fetch_chrome_perf_anomalies"`     // If true explore-sk will show the bisect button
	FeedbackURL                string             `json:"feedback_url"`                    // The URL for the Provide Feedback link
	ChatURL                    string             `json:"chat_url"`                        // The URL for the Ask the Team link
	HelpURLOverride            string             `json:"help_url_override"`               // If specified, this URL will override the help link
	TraceFormat                config.TraceFormat `json:"trace_format"`                    // Trace formatter to use
	NeedAlertAction            bool               `json:"need_alert_action"`               // Action to take for the alert.
	BugHostURL                 string             `json:"bug_host_url"`                    // The URL for the bug host for the instance.
	GitRepoUrl                 string             `json:"git_repo_url"`                    // The URL for the associated git repo.
	KeysForCommitRange         []string           `json:"keys_for_commit_range"`           // The link keys for commit range url display of individual points.
	ImageTag                   string             `json:"image_tag"`                       // The image tag that the running instance is built from, typically a git commit hash.
}

SkPerfConfig is the configuration data that will appear in Javascript under the window.perf variable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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