Documentation ¶
Overview ¶
Package perfdata contains a client for the performance data storage server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // BaseURL is the base URL of the storage server. BaseURL string // HTTPClient is the HTTP client for sending requests. If nil, http.DefaultClient will be used. HTTPClient *http.Client }
A Client issues queries to a performance data storage server. It is safe to use from multiple goroutines simultaneously.
func (*Client) ListUploads ¶
func (c *Client) ListUploads(ctx context.Context, q string, extraLabels []string, limit int) *UploadList
ListUploads searches for uploads containing results matching the given query string. The query may be empty, in which case all uploads will be returned. extraLabels specifies other labels to be retrieved. If limit is 0, no limit will be provided to the server. The uploads are returned starting with the most recent upload.
func (*Client) NewUpload ¶
NewUpload starts a new upload to the storage server. The upload must have Abort or Commit called on it. If the server requires authentication for uploads, c.HTTPClient should be set to the result of oauth2.NewClient.
func (*Client) Query ¶
Query searches for results matching the given query string. The result is a stream of bytes containing text benchmark data. This data may be parsed and processed by the x/perf/benchfmt package.
The query string is first parsed into quoted words (as in the shell) and then each word must be formatted as one of the following: key:value - exact match on label "key" = "value" key>value - value greater than (useful for dates) key<value - value less than (also useful for dates)
type Upload ¶
type Upload struct {
// contains filtered or unexported fields
}
An Upload is an in-progress upload. Use CreateFile to upload one or more files, then call Commit or Abort.
u := client.NewUpload() w, err := u.CreateFile() if err != nil { u.Abort() return err } fmt.Fprintf(w, "BenchmarkResult 1 1 ns/op\n") if err := u.Commit(); err != nil { return err }
func (*Upload) Commit ¶
func (u *Upload) Commit() (*UploadStatus, error)
Commit attempts to commit the upload.
type UploadInfo ¶
type UploadInfo struct { Count int UploadID string LabelValues benchfmt.Labels `json:",omitempty"` }
UploadInfo represents an upload summary.
type UploadList ¶
type UploadList struct {
// contains filtered or unexported fields
}
UploadList is the result of ListUploads. Use Next to advance through the rows, making sure to call Close when done:
q := db.ListUploads("key:value") defer q.Close() for q.Next() { id, count := q.Row() labels := q.LabelValues() ... } err = q.Err() // get any error encountered during iteration ...
func (*UploadList) Close ¶
func (ul *UploadList) Close() error
Close frees resources associated with the query.
func (*UploadList) Err ¶
func (ul *UploadList) Err() error
Err returns the error state of the query.
func (*UploadList) Info ¶
func (ul *UploadList) Info() UploadInfo
Info returns the most recent UploadInfo generated by a call to Next.
func (*UploadList) Next ¶
func (ul *UploadList) Next() bool
Next prepares the next result for reading with the Result method. It returns false when there are no more results, either by reaching the end of the input or an error.
type UploadStatus ¶
type UploadStatus struct { // UploadID is the upload ID assigned to the upload. UploadID string `json:"uploadid"` // FileIDs is the list of file IDs assigned to the files in the upload. FileIDs []string `json:"fileids"` // ViewURL is a server-supplied URL to view the results. ViewURL string `json:"viewurl"` }
UploadStatus contains information about a successful upload.
Directories ¶
Path | Synopsis |
---|---|
Package app implements the performance data storage server.
|
Package app implements the performance data storage server. |
This binary contains an App Engine app for perfdata.golang.org
|
This binary contains an App Engine app for perfdata.golang.org |
Package db provides the high-level database interface for the storage app.
|
Package db provides the high-level database interface for the storage app. |
sqlite3
Package sqlite3 provides the sqlite3 driver for x/build/perfdata/db.
|
Package sqlite3 provides the sqlite3 driver for x/build/perfdata/db. |
Package fs provides a backend-agnostic filesystem layer for storing performance results.
|
Package fs provides a backend-agnostic filesystem layer for storing performance results. |
gcs
Package gcs implements the fs.FS interface using Google Cloud Storage.
|
Package gcs implements the fs.FS interface using Google Cloud Storage. |
local
Package local implements the fs.FS interface using local files.
|
Package local implements the fs.FS interface using local files. |
Localperfdata runs an HTTP server for benchmark perfdata.
|
Localperfdata runs an HTTP server for benchmark perfdata. |
Package query provides tools for parsing a query.
|
Package query provides tools for parsing a query. |