Kubelet: record the initial pod processing latency

Add a new latency metric for the time from seeing the pod for the first time
to starting a pod worker for it.

Also, change PodStartLatency to include this initial processing latency.
This commit is contained in:
Yu-Ju Hong
2015-06-05 12:42:23 -07:00
parent abac8c86c7
commit f96a8d0935
6 changed files with 74 additions and 4 deletions

View File

@@ -16,7 +16,10 @@ limitations under the License.
package types
import "net/http"
import (
"net/http"
"time"
)
// DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids
type DockerID string
@@ -24,3 +27,32 @@ type DockerID string
type HttpGetter interface {
Get(url string) (*http.Response, error)
}
// Timestamp wraps around time.Time and offers utilities to format and parse
// the time using RFC3339Nano
type Timestamp struct {
time time.Time
}
// NewTimestamp returns a Timestamp object using the current time.
func NewTimestamp() *Timestamp {
return &Timestamp{time.Now()}
}
// ConvertToTimestamp takes a string, parses it using the RFC3339Nano layout,
// and converts it to a Timestamp object.
func ConvertToTimestamp(timeString string) *Timestamp {
parsed, _ := time.Parse(time.RFC3339Nano, timeString)
return &Timestamp{parsed}
}
// Get returns the time as time.Time.
func (t *Timestamp) Get() time.Time {
return t.time
}
// GetString returns the time in the string format using the RFC3339Nano
// layout.
func (t *Timestamp) GetString() string {
return t.time.Format(time.RFC3339Nano)
}