final protected function AppAnalyticsFormBase::getAnalytics in Apigee Edge 8
Retrieves the app analytics for the given criteria.
Parameters
\Drupal\apigee_edge\Entity\AppInterface $app: The app entity that analytics data gets displayed.
string $metric: The filter parameter.
string $since: The start date parameter.
string $until: The end date parameter.
string $environment: The analytics environment to query.
Return value
array The raw analytics API response for the given criteria.
Throws
\Moment\MomentException If provided date values are invalid.
\Apigee\Edge\Exception\ApiException If analytics query fails.
1 call to AppAnalyticsFormBase::getAnalytics()
- AppAnalyticsFormBase::generateResponse in src/
Form/ AppAnalyticsFormBase.php - Requests analytics data and pass to the JavaScript chart drawing function.
File
- src/
Form/ AppAnalyticsFormBase.php, line 500
Class
- AppAnalyticsFormBase
- App analytics form builder for developer- and team apps.
Namespace
Drupal\apigee_edge\FormCode
protected final function getAnalytics(AppInterface $app, string $metric, string $since, string $until, string $environment) : array {
$stats_controller = new StatsController($environment, $this->connector
->getOrganization(), $this->connector
->getClient());
$stats_query = new StatsQuery([
$metric,
], new Period(new \DateTimeImmutable('@' . $since), new \DateTimeImmutable('@' . $until)));
$stats_query
->setFilter("({$this->getAnalyticsFilterCriteriaByAppOwner($app)} and developer_app eq '{$app->getName()}')")
->setTimeUnit('hour');
return $stats_controller
->getOptimizedMetricsByDimensions([
'apps',
], $stats_query);
}