@@ -690,7 +690,6 @@ func TestPodStore(t *testing.T) {
690
690
},
691
691
},
692
692
{
693
-
694
693
Obj : & v1.Pod {
695
694
ObjectMeta : metav1.ObjectMeta {
696
695
Name : "pod6" ,
@@ -797,6 +796,9 @@ func TestPodStore(t *testing.T) {
797
796
Terminated : & v1.ContainerStateTerminated {
798
797
Reason : "DeadlineExceeded" ,
799
798
ExitCode : 143 ,
799
+ FinishedAt : metav1.Time {
800
+ Time : time .Unix (1501779547 , 0 ),
801
+ },
800
802
},
801
803
},
802
804
},
@@ -806,6 +808,7 @@ func TestPodStore(t *testing.T) {
806
808
Want : `
807
809
# HELP kube_pod_container_status_last_terminated_exitcode Describes the exit code for the last container in terminated state.
808
810
# HELP kube_pod_container_status_last_terminated_reason Describes the last reason the container was in terminated state.
811
+ # HELP kube_pod_container_status_last_terminated_timestamp Last terminated time for a pod container, when container was terminated with kube_pod_container_status_last_terminated_reason, in unix timestamp.
809
812
# HELP kube_pod_container_status_running [STABLE] Describes whether the container is currently in running state.
810
813
# HELP kube_pod_container_state_started [STABLE] Start time in unix timestamp for a pod container.
811
814
# HELP kube_pod_container_status_terminated [STABLE] Describes whether the container is currently in terminated state.
@@ -814,6 +817,7 @@ func TestPodStore(t *testing.T) {
814
817
# HELP kube_pod_container_status_waiting_reason [STABLE] Describes the reason the container is currently in waiting state.
815
818
# TYPE kube_pod_container_status_last_terminated_exitcode gauge
816
819
# TYPE kube_pod_container_status_last_terminated_reason gauge
820
+ # TYPE kube_pod_container_status_last_terminated_timestamp gauge
817
821
# TYPE kube_pod_container_status_running gauge
818
822
# TYPE kube_pod_container_state_started gauge
819
823
# TYPE kube_pod_container_status_terminated gauge
@@ -823,6 +827,7 @@ func TestPodStore(t *testing.T) {
823
827
kube_pod_container_state_started{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1.501777018e+09
824
828
kube_pod_container_status_last_terminated_exitcode{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 143
825
829
kube_pod_container_status_last_terminated_reason{container="container7",namespace="ns7",pod="pod7",reason="DeadlineExceeded",uid="uid7"} 1
830
+ kube_pod_container_status_last_terminated_timestamp{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1.501779547e+09
826
831
kube_pod_container_status_running{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1
827
832
kube_pod_container_status_terminated{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 0
828
833
kube_pod_container_status_waiting{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 0
@@ -832,6 +837,7 @@ func TestPodStore(t *testing.T) {
832
837
"kube_pod_container_state_started" ,
833
838
"kube_pod_container_status_terminated" ,
834
839
"kube_pod_container_status_terminated_reason" ,
840
+ "kube_pod_container_status_last_terminated_timestamp" ,
835
841
"kube_pod_container_status_waiting" ,
836
842
"kube_pod_container_status_last_terminated_reason" ,
837
843
"kube_pod_container_status_last_terminated_exitcode" ,
@@ -2217,6 +2223,9 @@ func BenchmarkPodStore(b *testing.B) {
2217
2223
},
2218
2224
LastTerminationState : v1.ContainerState {
2219
2225
Terminated : & v1.ContainerStateTerminated {
2226
+ FinishedAt : metav1.Time {
2227
+ Time : time .Unix (1501779547 , 0 ),
2228
+ },
2220
2229
Reason : "OOMKilled" ,
2221
2230
ExitCode : 137 ,
2222
2231
},
@@ -2234,6 +2243,9 @@ func BenchmarkPodStore(b *testing.B) {
2234
2243
},
2235
2244
LastTerminationState : v1.ContainerState {
2236
2245
Terminated : & v1.ContainerStateTerminated {
2246
+ FinishedAt : metav1.Time {
2247
+ Time : time .Unix (1501779547 , 0 ),
2248
+ },
2237
2249
Reason : "OOMKilled" ,
2238
2250
ExitCode : 137 ,
2239
2251
},
@@ -2251,6 +2263,9 @@ func BenchmarkPodStore(b *testing.B) {
2251
2263
},
2252
2264
LastTerminationState : v1.ContainerState {
2253
2265
Terminated : & v1.ContainerStateTerminated {
2266
+ FinishedAt : metav1.Time {
2267
+ Time : time .Unix (1501779547 , 0 ),
2268
+ },
2254
2269
Reason : "OOMKilled" ,
2255
2270
ExitCode : 137 ,
2256
2271
},
@@ -2260,7 +2275,7 @@ func BenchmarkPodStore(b *testing.B) {
2260
2275
},
2261
2276
}
2262
2277
2263
- expectedFamilies := 53
2278
+ expectedFamilies := 54
2264
2279
for n := 0 ; n < b .N ; n ++ {
2265
2280
families := f (pod )
2266
2281
if len (families ) != expectedFamilies {
0 commit comments