Skip to content

Commit 31d6663

Browse files
committed
AC-15461:Migration New Relic from REST v2 to NerdGraph (GraphQL)
1 parent 15139ba commit 31d6663

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private function displayDeploymentDetails(OutputInterface $output, array $deploy
166166
) : 'N/A']
167167
];
168168

169-
if (!empty($deployment['change_log'])) {
170-
$rows[] = ['Change log', $deployment['change_log']];
169+
if (!empty($deployment['changelog'])) {
170+
$rows[] = ['Change log', $deployment['changelog']];
171171
}
172172
if (!empty($deployment['commit'])) {
173173
$rows[] = ['Commit', $deployment['commit']];

app/code/Magento/NewRelicReporting/Model/Apm/Deployments.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function setV2RestDeployment(string $description, bool|string $changelog
151151
$params = [
152152
'deployment' => [
153153
'description' => $description,
154-
'change_log' => $changelog,
154+
'changelog' => $changelog,
155155
'user' => $user,
156156
'revision' => $revision
157157
]
@@ -166,7 +166,15 @@ private function setV2RestDeployment(string $description, bool|string $changelog
166166
}
167167

168168
if ($response->getStatusCode() < 200 || $response->getStatusCode() > 210) {
169-
$this->logger->warning('Deployment marker request did not send a 200 status code.');
169+
$this->logger->warning(
170+
'Deployment marker request did not send a 200 status code.',
171+
[
172+
'status_code' => $response->getStatusCode(),
173+
'response_body' => $response->getBody(),
174+
'request_url' => $apiUrl,
175+
'request_params' => $params
176+
]
177+
);
170178
return false;
171179
}
172180

app/code/Magento/NewRelicReporting/Model/NerdGraph/DeploymentTracker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private function addOptionalFields(
216216
?string $groupId
217217
): void {
218218
if ($changelog) {
219-
$variables['deployment']['change_log'] = $changelog;
219+
$variables['deployment']['changelog'] = $changelog;
220220
}
221221

222222
if ($user) {
@@ -278,7 +278,7 @@ private function processDeploymentResponse(
278278
'entityGuid' => $deploymentData['entityGuid'],
279279
'version' => $deployedVersion,
280280
'description' => $description,
281-
'change_log' => $changelog,
281+
'changelog' => $changelog,
282282
'user' => $user,
283283
'commit' => $commit,
284284
'deepLink' => $deepLink,

app/code/Magento/NewRelicReporting/Test/Unit/Console/Command/DeployMarkerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function testExecuteSuccessWithArrayResultNerdGraphStyle()
181181
'description' => $message,
182182
'user' => $user,
183183
'timestamp' => 1234567890000, // Feb 13, 2009 23:31:30 UTC
184-
'change_log' => 'New features',
184+
'changelog' => 'New features',
185185
'commit' => $commit,
186186
'deepLink' => $deepLink,
187187
'groupId' => $groupId
@@ -452,7 +452,7 @@ public function testExecuteSuccessWithCompleteDeploymentDataNerdGraphStyle()
452452
'description' => $message,
453453
'user' => 'complete-user',
454454
'timestamp' => 1640995200000, // 2022-01-01 00:00:00 UTC
455-
'change_log' => 'Added new features',
455+
'changelog' => 'Added new features',
456456
'commit' => 'abc123def456',
457457
'deepLink' => 'https://github.com/test/releases/v2.0.0',
458458
'groupId' => 'production'

app/code/Magento/NewRelicReporting/Test/Unit/Model/Apm/DeploymentsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ private function getDataVariables(): array
872872
$params = [
873873
'deployment' => [
874874
'description' => $description,
875-
'change_log' => $changelog,
875+
'changelog' => $changelog,
876876
'user' => $user,
877877
'revision' => $revision
878878
]

app/code/Magento/NewRelicReporting/Test/Unit/Model/NerdGraph/DeploymentTrackerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testCreateDeploymentSuccess()
112112
$variables['deployment']['entityGuid'] === $entityGuid &&
113113
$variables['deployment']['description'] === $description &&
114114
$variables['deployment']['version'] === $version &&
115-
$variables['deployment']['change_log'] === $changelog &&
115+
$variables['deployment']['changelog'] === $changelog &&
116116
$variables['deployment']['user'] === $user &&
117117
$variables['deployment']['commit'] === $commit &&
118118
$variables['deployment']['deepLink'] === $deepLink &&
@@ -140,7 +140,7 @@ public function testCreateDeploymentSuccess()
140140
$this->assertEquals($entityGuid, $result['entityGuid']);
141141
$this->assertEquals($version, $result['version']);
142142
$this->assertEquals($description, $result['description']);
143-
$this->assertEquals($changelog, $result['change_log']);
143+
$this->assertEquals($changelog, $result['changelog']);
144144
$this->assertEquals($user, $result['user']);
145145
$this->assertEquals($commit, $result['commit']);
146146
$this->assertEquals($deepLink, $result['deepLink']);
@@ -180,7 +180,7 @@ public function testCreateDeploymentWithMinimalParameters()
180180
return isset($variables['deployment']) &&
181181
$variables['deployment']['entityGuid'] === $entityGuid &&
182182
$variables['deployment']['description'] === $description &&
183-
!isset($variables['deployment']['change_log']) &&
183+
!isset($variables['deployment']['changelog']) &&
184184
!isset($variables['deployment']['user']);
185185
})
186186
)
@@ -542,7 +542,7 @@ public function testCreateDeploymentWithLongParameters()
542542
'entityGuid' => $entityGuid,
543543
'timestamp' => 1234567890000,
544544
'description' => $description,
545-
'change_log' => $changelog,
545+
'changelog' => $changelog,
546546
'user' => $user
547547
]
548548
]
@@ -606,7 +606,7 @@ public function testCreateDeploymentMutationStructure()
606606
return isset($variables['deployment']) &&
607607
$variables['deployment']['entityGuid'] === $entityGuid &&
608608
$variables['deployment']['description'] === $description &&
609-
$variables['deployment']['change_log'] === $changelog &&
609+
$variables['deployment']['changelog'] === $changelog &&
610610
$variables['deployment']['user'] === $user &&
611611
$variables['deployment']['version'] === $version &&
612612
$variables['deployment']['commit'] === $commit &&

0 commit comments

Comments
 (0)