简体   繁体   English

如何检查我的回复是否包含采样数据

[英]How to check if my response contains sampled data

I am using Google.Apis.AnalyticsReporting.v4 to download a view between two days.我正在使用Google.Apis.AnalyticsReporting.v4在两天之间下载一个视图。 I would like to know where in my response can I see whether the data contains sampled data?我想知道在我的回复中哪里可以看到数据是否包含采样数据?

This is the code for my request and we catch the data in response object below:这是我请求的代码,我们在下面的 object response中捕获数据:

using (var analytics = new AnalyticsReportingService(new BaseClientService.Initializer { HttpClientInitializer = credential }))
{
    while (nextPageToken != null)
    {
        var reportRequest = new ReportRequest
        {
            ViewId = "123456",
            DateRanges = new[] { new DateRange { StartDate = "2021-06-01", EndDate = "2021-11-30" } },
            Dimensions = new List<Dimension>() {
                new Dimension { Name = "ga:transactionId" },
                new Dimension { Name = "ga:campaign" },
                new Dimension { Name = "ga:sourceMedium" }
            },
            Metrics = new[] { new Metric { Expression = "ga:users" }, new Metric { Expression = "ga:sessions" } },
                       
        };
        var requests = new List<ReportRequest>();
        requests.Add(reportRequest);
        // Create the GetReportsRequest object.
        var getReport = new GetReportsRequest() { ReportRequests = requests };

        // Call the batchGet method.
        var response = analytics.Reports.BatchGet(getReport).Execute();
    }
}

It does not sample the data requested through Google.Apis.AnalyticsReporting.v4 .它不会对通过Google.Apis.AnalyticsReporting.v4请求的数据进行采样。 However, if your query is too complex, it will return a 5xx error.但是,如果您的查询过于复杂,则会返回 5xx 错误。 Looks like it prevents its backend from executing queries for too long to avoid high loads.看起来它可以防止其后端执行查询过长时间以避免高负载。 In that case, you'd need to chop your request into a few.在这种情况下,您需要将您的请求分成几个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM