Open riccardomurri opened 3 years ago
Hello!
It looks like the StackDriver sink of event-exporter truncates timestamps to the second, although both the internal metav1.Time values and the StackDriver Timestamp object allow nanosecond precision.
metav1.Time
Timestamp
The reason for this seems to be the MarshalJSON() method in the vendorized package k8s.io/apimachinery/pkg/apis/meta/v1 which uses the time.RFC3339 format instead of RFC3339Nano:
MarshalJSON()
k8s.io/apimachinery/pkg/apis/meta/v1
time.RFC3339
RFC3339Nano
// MarshalJSON implements the json.Marshaler interface. func (t Time) MarshalJSON() ([]byte, error) { ... buf = t.UTC().AppendFormat(buf, time.RFC3339) buf = append(buf, '"') return buf, nil }
Is there a reason for this truncation?
/cc @kawych
Hello!
It looks like the StackDriver sink of event-exporter truncates timestamps to the second, although both the internal
metav1.Time
values and the StackDriverTimestamp
object allow nanosecond precision.The reason for this seems to be the
MarshalJSON()
method in the vendorized packagek8s.io/apimachinery/pkg/apis/meta/v1
which uses thetime.RFC3339
format instead ofRFC3339Nano
:Is there a reason for this truncation?