metrics

package
v0.0.0-...-5ad8ebe Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatastoreKindName

func GetDatastoreKindName(data interface{}) string

GetDatastoreKindName gets the full (namespaced) data type name for the given interface (whether a pointer or not).

Types

type PassRateMetadata

type PassRateMetadata struct {
	TestRunsMetadata
}

PassRateMetadata constitutes metadata capturing: - When metric run was performed; - What test runs are part of the metric run; - Where the metric run results reside (a URL).

type PassRateMetadataLegacy

type PassRateMetadataLegacy struct {
	TestRunsMetadataLegacy
}

PassRateMetadataLegacy is a struct for storing a PassRateMetadata entry in the datastore, avoiding nested arrays. PassRateMetadata is the legacy format, used for loading the entity, for backward compatibility.

type RunInfo

type RunInfo struct {
	shared.ProductAtRevision
}

RunInfo is an alias of ProductAtRevision with a custom marshaler to produce the "run_info" object in wptreport.json.

func (RunInfo) MarshalJSON

func (r RunInfo) MarshalJSON() ([]byte, error)

MarshalJSON is the custom JSON marshaler that produces field names matching the "run_info" object in wptreport.json.

type SubTest

type SubTest struct {
	Name    string  `json:"name"`
	Status  string  `json:"status"`
	Message *string `json:"message"`
}

SubTest models a single test within a WPT test file.

type TestResults

type TestResults struct {
	Test     string    `json:"test"`
	Status   string    `json:"status"`
	Message  *string   `json:"message"`
	Subtests []SubTest `json:"subtests"`
}

TestResults captures the results of running the tests in a WPT test file.

type TestResultsReport

type TestResultsReport struct {
	Results []*TestResults `json:"results"`
	RunInfo RunInfo        `json:"run_info,omitempty"`
}

TestResultsReport models the `wpt run` results report JSON file format.

type TestRunLegacy

type TestRunLegacy struct {
	ID int64 `json:"id" datastore:"-"`

	shared.ProductAtRevision

	// URL for summary of results, which is derived from raw results.
	ResultsURL string `json:"results_url"`

	// Time when the test run metadata was first created.
	CreatedAt time.Time `json:"created_at"`

	// Time when the test run started.
	TimeStart time.Time `json:"time_start"`

	// Time when the test run ended.
	TimeEnd time.Time `json:"time_end"`

	// URL for raw results JSON object. Resembles the JSON output of the
	// wpt report tool.
	RawResultsURL string `json:"raw_results_url"`

	// Legacy format's Labels are (necessarily) ignored by datastore.
	Labels []string `datastore:"-" json:"labels"`
}

TestRunLegacy is a copy of the TestRun struct, before the `Labels` field was added (which causes an array of array and breaks datastore).

func ConvertRuns

func ConvertRuns(runs shared.TestRuns) (converted []TestRunLegacy, err error)

ConvertRuns converts TestRuns into the legacy format.

func (*TestRunLegacy) Load

func (r *TestRunLegacy) Load(ps []datastore.Property) error

Load is part of the datastore.PropertyLoadSaver interface. We use it to reset all time to UTC and trim their monotonic clock.

func (*TestRunLegacy) Save

func (r *TestRunLegacy) Save() ([]datastore.Property, error)

Save is part of the datastore.PropertyLoadSaver interface. Delegate to the default behaviour.

type TestRunsMetadata

type TestRunsMetadata struct {
	// TestRuns are the TestRun entities, loaded from the TestRunIDs
	TestRuns   shared.TestRuns   `json:"test_runs,omitempty" datastore:"-"`
	TestRunIDs shared.TestRunIDs `json:"-"`
	StartTime  time.Time         `json:"start_time"`
	EndTime    time.Time         `json:"end_time"`
	DataURL    string            `json:"url"`
}

TestRunsMetadata is a struct for metadata derived from a group of TestRun entities.

func (*TestRunsMetadata) Load

func (t *TestRunsMetadata) Load(ps []datastore.Property) error

Load is part of the datastore.PropertyLoadSaver interface. We use it to reset all time to UTC and trim their monotonic clock.

func (*TestRunsMetadata) LoadTestRuns

func (t *TestRunsMetadata) LoadTestRuns(ctx context.Context) (err error)

LoadTestRuns fetches the TestRun entities for the PassRateMetadata's TestRunIDs.

func (*TestRunsMetadata) Save

func (t *TestRunsMetadata) Save() ([]datastore.Property, error)

Save is part of the datastore.PropertyLoadSaver interface. Delegate to the default behaviour.

type TestRunsMetadataLegacy

type TestRunsMetadataLegacy struct {
	TestRuns   []TestRunLegacy   `json:"test_runs"`
	TestRunIDs shared.TestRunIDs `json:"-"`
	StartTime  time.Time         `json:"start_time"`
	EndTime    time.Time         `json:"end_time"`
	DataURL    string            `json:"url"`
}

TestRunsMetadataLegacy is a struct for loading legacy TestRunMetadata entities, which may have nested TestRun entities.

func (*TestRunsMetadataLegacy) Load

Load is part of the datastore.PropertyLoadSaver interface. We use it to reset all time to UTC and trim their monotonic clock.

func (*TestRunsMetadataLegacy) LoadTestRuns

func (t *TestRunsMetadataLegacy) LoadTestRuns(ctx context.Context) (err error)

LoadTestRuns fetches the TestRun entities for the PassRateMetadata's TestRunIDs.

func (*TestRunsMetadataLegacy) Save

Save is part of the datastore.PropertyLoadSaver interface. Delegate to the default behaviour.

Jump to

Keyboard shortcuts

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