func()

in exporter/collector/integrationtest/testcases/testcase.go [374:401]


func (tc *TestCase) updateMetricExpectFixture(
	t testing.TB,
	startTime time.Time,
	endTime time.Time,
	fixture *protos.MetricExpectFixture,
) {
	reqs := append(
		fixture.GetCreateTimeSeriesRequests(),
		fixture.GetCreateServiceTimeSeriesRequests()...,
	)
	for _, req := range reqs {
		for _, ts := range req.GetTimeSeries() {
			for _, p := range ts.GetPoints() {
				if p.GetInterval().GetStartTime() != nil {
					p.GetInterval().StartTime = timestamppb.New(startTime)
				}
				if p.GetInterval().GetEndTime() != nil {
					p.GetInterval().EndTime = timestamppb.New(endTime)
				}
				if ts.GetValueType() == googlemetricpb.MetricDescriptor_DISTRIBUTION {
					for _, ex := range p.GetValue().GetDistributionValue().GetExemplars() {
						ex.Timestamp = timestamppb.New(endTime)
					}
				}
			}
		}
	}
}