Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Trey Ivy committed Sep 29, 2024
1 parent a2ab966 commit 5bb1515
Show file tree
Hide file tree
Showing 36 changed files with 191 additions and 110 deletions.
4 changes: 2 additions & 2 deletions ent/schema/actioncachestatistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (ActionCacheStatistics) Fields() []ent.Field {
// action cache has not been loaded in this invocation.
field.Int64("load_time_in_ms").Optional(),

//// Cache counters.
// Cache counters.
field.Int32("hits").Optional(),
field.Int32("misses").Optional(),
}
Expand All @@ -37,7 +37,7 @@ func (ActionCacheStatistics) Fields() []ent.Field {
// Edges of the ActionCacheStatistics.
func (ActionCacheStatistics) Edges() []ent.Edge {
return []ent.Edge{
//edge back to the associated action summary
// Edge back to the associated action summary.
edge.From("action_summary", ActionSummary.Type).
Ref("action_cache_statistics"),

Expand Down
4 changes: 2 additions & 2 deletions ent/schema/actiondata.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type ActionData struct {
func (ActionData) Fields() []ent.Field {
return []ent.Field{

//the action name
// The action name.
field.String("mnemonic").Optional(),

// The total number of actions of this type executed during the build. As
Expand Down Expand Up @@ -47,7 +47,7 @@ func (ActionData) Fields() []ent.Field {
// Edges of the ActionData.
func (ActionData) Edges() []ent.Edge {
return []ent.Edge{
//edge back to the associated action summary
// Edge back to the associated action summary.
edge.From("action_summary", ActionSummary.Type).
Ref("action_data"),
}
Expand Down
2 changes: 1 addition & 1 deletion ent/schema/actionsummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (ActionSummary) Edges() []ent.Edge {
// Contains the top N actions by number of actions executed.
edge.To("action_data", ActionData.Type),

//Count of which Runner types were executed which actions
// Count of which Runner types were executed which actions.
edge.To("runner_count", RunnerCount.Type),

// Information about the action cache behavior during a single invocation.
Expand Down
2 changes: 1 addition & 1 deletion ent/schema/artifactmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (ArtifactMetrics) Fields() []ent.Field {
// Edges of the ArtifactMetrics.
func (ArtifactMetrics) Edges() []ent.Edge {
return []ent.Edge{
//edge back to the metrics object
// Edge back to the metrics object
edge.From("metrics", Metrics.Type).Ref("artifact_metrics"),

// Measures all source files newly read this build. Does not include
Expand Down
47 changes: 37 additions & 10 deletions ent/schema/bazelinvocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,84 @@ type BazelInvocation struct {
// Fields of the BazelInvocation.
func (BazelInvocation) Fields() []ent.Field {
return []ent.Field{

// The bazel client invocation ID.
field.UUID("invocation_id", uuid.UUID{}).Unique().Immutable(),

// Time the event started.
field.Time("started_at"),

// Time the event ended
field.Time("ended_at").Optional(),

// Rethink? Keep for now to capture existing processing.
field.Int("change_number").Optional(),

// Rethink? Keep for now.
field.Int("patchset_number").Optional(),
field.JSON("summary", summary.InvocationSummary{}).Annotations(entgql.Skip()), // NOTE: Internal model, not exposed to API.

// NOTE: Internal model, not exposed to API.
// contains invocation information
field.JSON("summary", summary.InvocationSummary{}).Annotations(entgql.Skip()),

// Build Event Protocol completed successfuly.
field.Bool("bep_completed").Optional(),

// Rethink, keep for now.
// A step label pulled from the metada
field.String("step_label"),
field.JSON("related_files", map[string]string{}).Annotations(entgql.Skip()), // NOTE: Uses custom resolver.

//email address of the user who launched the invocation if provided
// NOTE: Uses custom resolver.
// Log snippets of error saved to disk. Rethink and store in db?
field.JSON("related_files", map[string]string{}).Annotations(entgql.Skip()),

// Email address of the user who launched the invocation if provided.
field.String("user_email").Optional(),

//ldap (username) of the user who launched the invocation if provided//The user who
// Ldap (username) of the user who launched the invocation if provided.
field.String("user_ldap").Optional(),

//the full logs from the build
// The full logs from the build..
field.String("build_logs").Optional(),

//the cpu type from the configuration event(s)
// The cpu type from the configuration event(s).
field.String("cpu").Optional(),

//the platform name from the configuration event(s)
// The platform name from the configuration event(s).
field.String("platform_name").Optional(),

//the name from the configuration event(s)
// The name from the configuration event(s).
field.String("configuration_mnemonic").Optional(),

//the number of successful fetch events seen
// The number of successful fetch events seen.
field.Int64("num_fetches").Optional(),
}
}

// Edges of the BazelInvocation.
func (BazelInvocation) Edges() []ent.Edge {
return []ent.Edge{

// Edge back from the Event Files.
edge.From("event_file", EventFile.Type).
Ref("bazel_invocation").
Unique().
Required(),

// Edge back from the Build.
edge.From("build", Build.Type).
Ref("invocations").
Unique(),

// Edge to any probles detected.
// NOTE: Uses custom resolver / types.
edge.To("problems", BazelInvocationProblem.Type).
Annotations(entgql.Skip(entgql.SkipType)), // NOTE: Uses custom resolver / types.
Annotations(entgql.Skip(entgql.SkipType)),

//Build Metrics for the Completed Invocation
edge.To("metrics", Metrics.Type).
Unique(),

//Test Data for the completed Invocation
edge.To("test_collection", TestCollection.Type),

Expand Down
8 changes: 7 additions & 1 deletion ent/schema/bazelinvocationproblem.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ type BazelInvocationProblem struct {
// Fields of the BazelInvocationProblem.
func (BazelInvocationProblem) Fields() []ent.Field {
return []ent.Field{
// The Problem Type.
field.String("problem_type"),

// The Problem Label.
field.String("label"),
field.JSON("bep_events", json.RawMessage{}).Annotations(entgql.Skip()), // NOTE: Internal model, not exposed to API.

// The bep_events raw message associated with the field.
// NOTE: Internal model, not exposed to API.
field.JSON("bep_events", json.RawMessage{}).Annotations(entgql.Skip()),
}
}

Expand Down
15 changes: 15 additions & 0 deletions ent/schema/buildgraphmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,55 @@ type BuildGraphMetrics struct {
func (BuildGraphMetrics) Fields() []ent.Field {
return []ent.Field{

// Action Value Lookup Count.
// How many configured targets/aspects were in this build, including any
// that were analyzed on a prior build and are still valid. May not be
// populated if analysis phase was fully cached. Note: for historical
// reasons this includes input/output files and other configured targets
// that do not actually have associated actions.
field.Int32("action_lookup_value_count").Optional(),

// Action Value Lookup Count Not Including Aspects.
// How many configured targets alone were in this build: always at most
// action_lookup_value_count. Useful mainly for historical comparisons to
// TargetMetrics.targets_configured, which used to not count aspects. This
// also includes configured targets that do not have associated actions.
field.Int32("action_lookup_value_count_not_including_aspects").Optional(),

// Action Count.
// How many actions belonged to the configured targets/aspects above. It may
// not be necessary to execute all of these actions to build the requested
// targets. May not be populated if analysis phase was fully cached.
field.Int32("action_count").Optional(),

// Action Count Not Including Aspects.
// How many configured targets alone were in this build: always at most
// action_lookup_value_count. Useful mainly for historical comparisons to
// TargetMetrics.targets_configured, which used to not count aspects. This
// also includes configured targets that do not have associated actions.
field.Int32("action_count_not_including_aspects").Optional(),

// Input File Configured Target Count.
// How many "input file" configured targets there were: one per source file.
// Should agree with artifact_metrics.source_artifacts_read.count above,
field.Int32("input_file_configured_target_count").Optional(),

// Output File Configured Target Count.
// How many "output file" configured targets there were: output files that
// are targets (not implicit outputs).
field.Int32("output_file_configured_target_count").Optional(),

// Other Configured Target Count.
// How many "other" configured targets there were (like alias,
// package_group, and other non-rule non-file configured targets).
field.Int32("other_configured_target_count").Optional(),

// Output Artifact Count.
// How many artifacts are outputs of the above actions. May not be populated
// if analysis phase was fully cached.
field.Int32("output_artifact_count").Optional(),

// Post Invocation Skyframe Node Count.
// How many Skyframe nodes there are in memory at the end of the build. This
// may underestimate the number of nodes when running with memory-saving
// settings or with Skybuild, and may overestimate if there are nodes from
Expand All @@ -68,25 +77,31 @@ func (BuildGraphMetrics) Edges() []ent.Edge {
return []ent.Edge{
edge.From("metrics", Metrics.Type).
Ref("build_graph_metrics"),

//NOTE: these are all missing from the proto, but i'm including them here for now for completeness

// Dirtied Values.
// Number of SkyValues that were dirtied during the build. Dirtied nodes are
// those that transitively depend on a node that changed by itself (e.g. one
// representing a file in the file system)
edge.To("dirtied_values", EvaluationStat.Type),

// Changed Values.
// Number of SkyValues that changed by themselves. For example, when a file
// on the file system changes, the SkyValue representing it will change.
edge.To("changed_values", EvaluationStat.Type),

// Built Values.
// Number of SkyValues that were built. This means that they were evaluated
// and were found to have changed from their previous version.
edge.To("built_values", EvaluationStat.Type),

// Cleaned Values.
// Number of SkyValues that were evaluated and found clean, i.e. equal to
// their previous version.
edge.To("cleaned_values", EvaluationStat.Type),

// Evaluated Values.
// Number of evaluations to build SkyValues. This includes restarted
// evaluations, which means there can be multiple evaluations per built
// SkyValue. Subtract built_values from this number to get the number of
Expand Down
4 changes: 3 additions & 1 deletion ent/schema/cumulativemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ type CumulativeMetrics struct {
func (CumulativeMetrics) Fields() []ent.Field {
return []ent.Field{

// Number Of Analyses.
// One-indexed number of "analyses" the server has run, including the
// current one. Will be incremented for every build/test/cquery/etc. command
// that reaches the analysis phase.
field.Int32("num_analyses").Optional(),

// Number of Builds.
// One-indexed number of "builds" the server has run, including the current
// one. Will be incremented for every build/test/run/etc. command that
// reaches the execution phase.
Expand All @@ -31,7 +33,7 @@ func (CumulativeMetrics) Fields() []ent.Field {
func (CumulativeMetrics) Edges() []ent.Edge {
return []ent.Edge{

//edge back to the metircs object
// Edge back to the metircs object.
edge.From("metrics", Metrics.Type).Ref("cumulative_metrics"),
}
}
2 changes: 1 addition & 1 deletion ent/schema/dynamicexecutionmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (DynamicExecutionMetrics) Fields() []ent.Field {
func (DynamicExecutionMetrics) Edges() []ent.Edge {
return []ent.Edge{

//edge back to the metrics object
// Edge back to the metrics object.
edge.From("metrics", Metrics.Type).Ref("dynamic_execution_metrics"),

// Race statistics grouped by mnemonic, local_name, remote_name.
Expand Down
7 changes: 6 additions & 1 deletion ent/schema/evaluationstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,30 @@ func (EvaluationStat) Edges() []ent.Edge {
return []ent.Edge{
edge.From("build_graph_metrics", BuildGraphMetrics.Type).

//NOTE: Not populated on the proto currently, but included here for completeness
// NOTE: Not populated on the proto currently, but included here for completeness.

// Dirtied Values.
// Number of SkyValues that were dirtied during the build. Dirtied nodes are
// those that transitively depend on a node that changed by itself (e.g. one
// representing a file in the file system)
Ref("dirtied_values").

// Changed Values.
// Number of SkyValues that changed by themselves. For example, when a file
// on the file system changes, the SkyValue representing it will change.
Ref("changed_values").

// Built Values.
// Number of SkyValues that were built. This means that they were evaluated
// and were found to have changed from their previous version.
Ref("built_values").

// Cleaned Values.
// Number of SkyValues that were evaluated and found clean, i.e. equal to
// their previous version.
Ref("cleaned_values").

// Evaluated Values.
// Number of evaluations to build SkyValues. This includes restarted
// evaluations, which means there can be multiple evaluations per built
// SkyValue. Subtract built_values from this number to get the number of
Expand Down
6 changes: 4 additions & 2 deletions ent/schema/executioninfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (ExectionInfo) Fields() []ent.Field {
// Deprecated, use TargetComplete.test_timeout instead.
field.Int32("timeout_seconds").Optional(),

// Name of the strategy to execute this test action (e.g., "local", "remote")
// Name of the strategy to execute this test action (e.g., "local", "remote").
field.String("strategy").Optional(),

// True, if the reported attempt was a cache hit in a remote cache.
Expand All @@ -27,6 +27,7 @@ func (ExectionInfo) Fields() []ent.Field {
// The exit code of the test action.
field.Int32("exit_code").Optional(),

// Hostname.
// The hostname of the machine where the test action was executed (in case
// of remote execution), if known.
field.String("hostname").Optional(),
Expand All @@ -36,7 +37,8 @@ func (ExectionInfo) Fields() []ent.Field {
// Edges of ExectionInfo.
func (ExectionInfo) Edges() []ent.Edge {
return []ent.Edge{
//edge back to the test result

// Edge back to the test result
edge.From("test_result", TestResultBES.Type).Ref("execution_info"),

// Represents a hierarchical timing breakdown of an activity.
Expand Down
8 changes: 6 additions & 2 deletions ent/schema/filesmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type FilesMetric struct {
func (FilesMetric) Fields() []ent.Field {
return []ent.Field{

// The total size in bytes
// The total size in bytes.
field.Int64("size_in_bytes").Optional(),

//The total Coount
// The total Coount.
field.Int32("count").Optional(),
}
}
Expand All @@ -28,21 +28,25 @@ func (FilesMetric) Edges() []ent.Edge {
return []ent.Edge{
edge.From("artifact_metrics", ArtifactMetrics.Type).

// Source Artifacts Read.
// Measures all source files newly read this build. Does not include
// unchanged sources on incremental builds.
Ref("source_artifacts_read").

// Output Artifacts Seen.
// Measures all output artifacts from executed actions. This includes
// actions that were cached locally (via the action cache) or remotely (via
// a remote cache or executor), but does *not* include outputs of actions
// that were cached internally in Skyframe.
Ref("output_artifacts_seen").

// Output Artifacts From Cache.
// Measures all output artifacts from actions that were cached locally
// via the action cache. These artifacts were already present on disk at the
// start of the build. Does not include Skyframe-cached actions' outputs.
Ref("output_artifacts_from_action_cache").

// Top Level Artifacts.
// Measures all artifacts that belong to a top-level output group. Does not
// deduplicate, so if there are two top-level targets in this build that
// share an artifact, it will be counted twice.
Expand Down
2 changes: 1 addition & 1 deletion ent/schema/garbagemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (GarbageMetrics) Fields() []ent.Field {
func (GarbageMetrics) Edges() []ent.Edge {
return []ent.Edge{

//edge back to the memory metrics object
// Edge back to the memory metrics object
edge.From("memory_metrics", MemoryMetrics.Type).
Ref("garbage_metrics"),
}
Expand Down
Loading

0 comments on commit 5bb1515

Please sign in to comment.