Exemplo n.º 1
0
        public void ListGroupStats()
        {
            // Snippet: ListGroupStats(string,QueryTimeRange,string,int?,CallSettings)
            // Create client
            ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
            // Initialize request argument(s)
            string         formattedProjectName = ErrorStatsServiceClient.FormatProjectName("[PROJECT]");
            QueryTimeRange timeRange            = new QueryTimeRange();
            // Make the request
            IPagedEnumerable <ListGroupStatsResponse, ErrorGroupStats> response =
                errorStatsServiceClient.ListGroupStats(formattedProjectName, timeRange);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (ErrorGroupStats item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over fixed-sized pages, lazily performing RPCs as required
            int pageSize = 10;

            foreach (FixedSizePage <ErrorGroupStats> page in response.AsPages().WithFixedSize(pageSize))
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ErrorGroupStats item in page)
                {
                    Console.WriteLine(item);
                }
            }
            // End snippet
        }
Exemplo n.º 2
0
        public async Task ListEventsAsync()
        {
            // Snippet: ListEventsAsync(string,string,string,int?,CallSettings)
            // Create client
            ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
            // Initialize request argument(s)
            string formattedProjectName = ErrorStatsServiceClient.FormatProjectName("[PROJECT]");
            string groupId = "";
            // Make the request
            IPagedAsyncEnumerable <ListEventsResponse, ErrorEvent> response =
                errorStatsServiceClient.ListEventsAsync(formattedProjectName, groupId);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((ErrorEvent item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over fixed-sized pages, lazily performing RPCs as required
            int pageSize = 10;
            IAsyncEnumerable <FixedSizePage <ErrorEvent> > fixedSizePages = response.AsPages().WithFixedSize(pageSize);
            await fixedSizePages.ForEachAsync((FixedSizePage <ErrorEvent> page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ErrorEvent item in page)
                {
                    Console.WriteLine(item);
                }
            });

            // End snippet
        }
Exemplo n.º 3
0
 public void DeleteEvents()
 {
     // Snippet: DeleteEvents(string,CallSettings)
     // Create client
     ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
     // Initialize request argument(s)
     string formattedProjectName = ErrorStatsServiceClient.FormatProjectName("[PROJECT]");
     // Make the request
     DeleteEventsResponse response = errorStatsServiceClient.DeleteEvents(formattedProjectName);
     // End snippet
 }
Exemplo n.º 4
0
        public async Task DeleteEventsAsync()
        {
            // Snippet: DeleteEventsAsync(string,CallSettings)
            // Additional: DeleteEventsAsync(string,CancellationToken)
            // Create client
            ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
            // Initialize request argument(s)
            string formattedProjectName = ErrorStatsServiceClient.FormatProjectName("[PROJECT]");
            // Make the request
            DeleteEventsResponse response = await errorStatsServiceClient.DeleteEventsAsync(formattedProjectName);

            // End snippet
        }
Exemplo n.º 5
0
        public void ListGroupStats()
        {
            string projectId = _fixture.ProjectId;

            // Snippet: ListGroupStats
            ErrorStatsServiceClient client = ErrorStatsServiceClient.Create();
            string projectName             = ErrorStatsServiceClient.FormatProjectName(projectId);
            IPagedEnumerable <ListGroupStatsResponse, ErrorGroupStats> groupStats = client.ListGroupStats(
                projectName,
                new QueryTimeRange {
                Period = Period._30Days
            });

            foreach (ErrorGroupStats item in groupStats)
            {
                // Sample output: Group: 8002882452986879952; Count: 6; Services: SampleApp/1.0.0
                IEnumerable <string> services = item.AffectedServices.Select(s => $"{s.Service}/{s.Version}");
                Console.WriteLine($"Group: {item.Group.GroupId}; Count: {item.Count}; Services: {string.Join(", ", services)}");
            }
            // End snippet
        }