-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmemorymetrics.go
46 lines (39 loc) · 1.26 KB
/
memorymetrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// MemoryMetrics holds the schema definition for the Blob entity.
type MemoryMetrics struct {
ent.Schema
}
// Fields of the MemoryMetrics.
func (MemoryMetrics) Fields() []ent.Field {
return []ent.Field{
// Size of the JVM heap post build in bytes. This is only collected if
// --memory_profile is set, since it forces a full GC.
field.Int64("peak_post_gc_heap_size").Optional(),
// Size of the peak JVM heap size in bytes post GC. Note that this reports 0
// if there was no major GC during the build.
field.Int64("used_heap_size_post_build").Optional(),
// Size of the peak tenured space JVM heap size event in bytes post GC. Note
// that this reports 0 if there was no major GC during the build.
field.Int64("peak_post_gc_tenured_space_heap_size").Optional(),
}
}
// Edges of MemoryMetrics.
func (MemoryMetrics) Edges() []ent.Edge {
return []ent.Edge{
// Edge back to the memory metrics object
edge.From("metrics", Metrics.Type).
Ref("memory_metrics").
Unique(),
// Metrics about garbage collection
edge.To("garbage_metrics", GarbageMetrics.Type).
Annotations(
entsql.OnDelete(entsql.Cascade),
),
}
}