public function NewRelicApiClient::getAppId in New Relic 8
Same name and namespace in other branches
- 2.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::getAppId()
- 2.0.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::getAppId()
Lazy load the application ID from newrelic.
Return value
int|null The application ID or null if it failed.
1 call to NewRelicApiClient::getAppId()
- NewRelicApiClient::createDeployment in src/
Client/ NewRelicApiClient.php - Create a deployment marker in newrelic.
File
- src/
Client/ NewRelicApiClient.php, line 119
Class
- NewRelicApiClient
- Controls the interaction between us and newrelic rest API v2.
Namespace
Drupal\new_relic_rpm\ClientCode
public function getAppId() {
if (empty($this->appName)) {
return NULL;
}
if (empty($this->appId)) {
// Populate the appId from the name.
try {
$applications = $this
->listApplications($this->appName);
} catch (GuzzleException $e) {
return NULL;
}
foreach ($applications as $application_details) {
if ($application_details['name'] === $this->appName) {
$this->appId = $application_details['id'];
break;
}
}
if (empty($this->appId)) {
$this->logger
->error('Unable to get appId for :name', [
':name' => $this->appName,
]);
}
}
return $this->appId;
}