Beispiel #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
        }
Beispiel #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
        }
 /// <summary>Snippet for DeleteEvents</summary>
 public void DeleteEvents()
 {
     // Snippet: DeleteEvents(ProjectName,CallSettings)
     // Create client
     ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
     // Initialize request argument(s)
     ProjectName projectName = new ProjectName("[PROJECT]");
     // Make the request
     DeleteEventsResponse response = errorStatsServiceClient.DeleteEvents(projectName);
     // End snippet
 }
        /// <summary>Snippet for ListGroupStats</summary>
        public void ListGroupStats_RequestObject()
        {
            // Snippet: ListGroupStats(ListGroupStatsRequest, CallSettings)
            // Create client
            ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
            // Initialize request argument(s)
            ListGroupStatsRequest request = new ListGroupStatsRequest
            {
                ProjectNameAsProjectName = new ProjectName("[PROJECT]"),
                GroupId            = { "", },
                ServiceFilter      = new ServiceContextFilter(),
                TimeRange          = new QueryTimeRange(),
                TimedCountDuration = new Duration(),
                Alignment          = TimedCountAlignment.ErrorCountAlignmentUnspecified,
                AlignmentTime      = new Timestamp(),
                Order = ErrorGroupOrder.GroupOrderUnspecified,
            };
            // Make the request
            PagedEnumerable <ListGroupStatsResponse, ErrorGroupStats> response = errorStatsServiceClient.ListGroupStats(request);

            // 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 pages (of server-defined size), performing one RPC per page
            foreach (ListGroupStatsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ErrorGroupStats item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <ErrorGroupStats> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (ErrorGroupStats item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Beispiel #5
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
        }
 /// <summary>Snippet for DeleteEvents</summary>
 public void DeleteEvents_RequestObject()
 {
     // Snippet: DeleteEvents(DeleteEventsRequest,CallSettings)
     // Create client
     ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
     // Initialize request argument(s)
     DeleteEventsRequest request = new DeleteEventsRequest
     {
         ProjectNameAsProjectName = new ProjectName("[PROJECT]"),
     };
     // Make the request
     DeleteEventsResponse response = errorStatsServiceClient.DeleteEvents(request);
     // End snippet
 }
        /// <summary>Snippet for ListEvents</summary>
        public void ListEvents_ResourceNames()
        {
            // Snippet: ListEvents(ProjectName, string, string, int?, CallSettings)
            // Create client
            ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create();
            // Initialize request argument(s)
            ProjectName projectName = new ProjectName("[PROJECT]");
            string      groupId     = "";
            // Make the request
            PagedEnumerable <ListEventsResponse, ErrorEvent> response = errorStatsServiceClient.ListEvents(projectName, groupId);

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

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListEventsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ErrorEvent item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <ErrorEvent> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (ErrorEvent item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Beispiel #8
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
        }
Beispiel #9
0
 public ErrorReportingTest()
 {
     _projectName = new ProjectName(Utils.GetProjectIdFromEnvironment());
     _client      = ErrorStatsServiceClient.Create();
 }