Repository navigation
chore(appengine): upgrade Google Cloud dependencies to ^2.0 #2346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "require-dev": { | ||
| "monolog\/monolog": "^2.0", | ||
| "google/cloud-logging": "^1.14" | ||
| "google/cloud-logging": "^2.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "require": { | ||
| "google/cloud-logging": "^1.12" | ||
| "google/cloud-logging": "^2.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "require": { | ||
| "google/cloud-logging": "^1.14" | ||
| "google/cloud-logging": "^2.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "require": { | ||
| "google/cloud-error-reporting": "^0.25.0" | ||
| "google/cloud-error-reporting": "^0.28.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,9 @@ | |
|
|
||
| use Google\ApiCore\ApiException; | ||
| use Google\Cloud\Core\ExponentialBackoff; | ||
| use Google\Cloud\ErrorReporting\V1beta1\ErrorStatsServiceClient; | ||
| use Google\Cloud\ErrorReporting\V1beta1\Client\ErrorStatsServiceClient; | ||
| use Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest; | ||
| use Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsRequest; | ||
| use Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange; | ||
| use Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange\Period; | ||
| use Google\Cloud\TestUtils\TestTrait; | ||
|
|
@@ -56,16 +58,19 @@ private function verifyReportedError($projectId, $message) | |
| // Iterate through all elements | ||
| $testFunc = function () use ($errorStats, $projectName, $timeRange, $message) { | ||
| $messages = []; | ||
| $response = $errorStats->listGroupStats($projectName, [ | ||
| 'timeRange' => $timeRange, | ||
| 'pageSize' => 100, | ||
| ]); | ||
| foreach ($response->iterateAllElements() as $groupStat) { | ||
| $response = $errorStats->listEvents($projectName, $groupStat->getGroup()->getGroupId(), [ | ||
| 'timeRange' => $timeRange, | ||
| 'pageSize' => 100, | ||
| ]); | ||
| foreach ($response->iterateAllElements() as $event) { | ||
| $request = (new ListGroupStatsRequest()) | ||
| ->setProjectName($projectName) | ||
| ->setTimeRange($timeRange) | ||
| ->setPageSize(100); | ||
| $groupStatsResponse = $errorStats->listGroupStats($request); | ||
| foreach ($groupStatsResponse->iterateAllElements() as $groupStat) { | ||
| $eventsRequest = (new ListEventsRequest()) | ||
| ->setProjectName($projectName) | ||
| ->setGroupId($groupStat->getGroup()->getGroupId()) | ||
| ->setTimeRange($timeRange) | ||
| ->setPageSize(100); | ||
| $eventsResponse = $errorStats->listEvents($eventsRequest); | ||
| foreach ($eventsResponse->iterateAllElements() as $event) { | ||
| $messages[] = $event->getMessage(); | ||
| } | ||
|
Comment on lines
+61
to
75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reusing the $request = (new ListGroupStatsRequest())
->setProjectName($projectName)
->setTimeRange($timeRange)
->setPageSize(100);
$groupStatsResponse = $errorStats->listGroupStats($request);
foreach ($groupStatsResponse->iterateAllElements() as $groupStat) {
$eventsRequest = (new ListEventsRequest())
->setProjectName($projectName)
->setGroupId($groupStat->getGroup()->getGroupId())
->setTimeRange($timeRange)
->setPageSize(100);
$eventsResponse = $errorStats->listEvents($eventsRequest);
foreach ($eventsResponse->iterateAllElements() as $event) {
$messages[] = $event->getMessage();
} |
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reusing the
$responsevariable name for both the outerlistGroupStatsresponse and the innerlistEventsresponse is confusing and can lead to readability or maintenance issues. It is cleaner and more idiomatic to use distinct, descriptive variable names like$groupStatsResponseand$eventsResponse.