diff --git a/rpc/flipt/evaluation/evaluation.go b/rpc/flipt/evaluation/evaluation.go index 28e8fe9b7d..7720987308 100644 --- a/rpc/flipt/evaluation/evaluation.go +++ b/rpc/flipt/evaluation/evaluation.go @@ -37,6 +37,14 @@ func (x *EvaluationResponse) SetRequestIDIfNotBlank(id string) string { return "" } +func (x *VariantEvaluationResponse) SetRequestIDIfNotBlank(id string) string { + if x.RequestId == "" { + x.RequestId = id + } + + return x.RequestId +} + // SetRequestIDIfNotBlank attempts to set the provided ID on the instance // If the ID was blank, it returns the ID provided to this call. // If the ID was not blank, it returns the ID found on the instance. @@ -93,6 +101,11 @@ func (x *EvaluationResponse) SetTimestamps(start, end time.Time) { } } +func (x *VariantEvaluationResponse) SetTimestamps(start, end time.Time) { + x.Timestamp = timestamppb.New(end) + x.RequestDurationMillis = float64(end.Sub(start)) / float64(time.Millisecond) +} + // SetTimestamps records the start and end times on the target instance. func (x *BatchEvaluationResponse) SetTimestamps(start, end time.Time) { x.RequestDurationMillis = float64(end.Sub(start)) / float64(time.Millisecond)