in kubelet-to-gcm/monitor/controller/translator.go [58:96]
func (t *Translator) translateEviction(metrics *Metrics) *v3.TimeSeries {
monitoredLabels := map[string]string{
"project_id": t.project,
"cluster_name": t.cluster,
"zone": t.zone,
"instance_id": t.instanceID,
"namespace_id": "",
"pod_id": "machine",
"container_name": "",
}
now := time.Now().Format(time.RFC3339)
createTime := time.Unix(metrics.CreateTime, 0).Format(time.RFC3339)
point := &v3.Point{
Interval: &v3.TimeInterval{
StartTime: createTime,
EndTime: now,
},
Value: &v3.TypedValue{
Int64Value: monitor.Int64Ptr(metrics.NodeEvictions),
ForceSendFields: []string{"Int64Value"},
},
}
return &v3.TimeSeries{
Metric: &v3.Metric{
Labels: noLabels,
Type: "container.googleapis.com/master/node_controller/node_eviction_count",
},
MetricKind: "CUMULATIVE",
ValueType: "INT64",
Resource: &v3.MonitoredResource{
Labels: monitoredLabels,
Type: "gke_container",
},
Points: []*v3.Point{point},
}
}