add the time_format field to qlog common_fields

This commit is contained in:
Marten Seemann
2021-02-13 12:56:44 +08:00
parent 0b97ae5632
commit 7e59a091a4
2 changed files with 2 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ var _ = Describe("Tracing", func() {
Expect(commonFields).To(HaveKey("reference_time"))
referenceTime := time.Unix(0, int64(commonFields["reference_time"].(float64)*1e6))
Expect(referenceTime).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(commonFields).To(HaveKeyWithValue("time_format", "relative"))
Expect(trace).To(HaveKey("vantage_point"))
vantagePoint := trace["vantage_point"].(map[string]interface{})
Expect(vantagePoint).To(HaveKeyWithValue("type", "server"))

View File

@@ -49,6 +49,7 @@ func (f commonFields) MarshalJSONObject(enc *gojay.Encoder) {
enc.StringKey("group_id", f.ODCID.String())
enc.StringKeyOmitEmpty("protocol_type", f.ProtocolType)
enc.Float64Key("reference_time", float64(f.ReferenceTime.UnixNano())/1e6)
enc.StringKey("time_format", "relative")
}
func (f commonFields) IsNil() bool { return false }