Skip to content

Commit

Permalink
Merge pull request #1121 from M0rgan01/sentry-tags
Browse files Browse the repository at this point in the history
Add new sentry tags
  • Loading branch information
Quetzacoalt91 authored Jan 20, 2025
2 parents fe4bc6f + 38f6197 commit 8ae4a6a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions _dev/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ interface AutoUpgradeVariables {
admin_dir: string;
stepper_parent_id: string;
module_version: string;
php_version: string;
anonymous_id: string;
}

declare global {
Expand Down
4 changes: 3 additions & 1 deletion _dev/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ window.AutoUpgradeVariables = {
admin_url: 'http://localhost',
admin_dir: '/admin_directory',
stepper_parent_id: 'stepper_content',
module_version: '7.1.0'
module_version: '7.1.0',
anonymous_id: 'b168a116d1a14fda8c21a22c7560fa27ade7dae22641ce9d773be680640dac0f',
php_version: '7.4.33'
};

beforeAll(() => {});
8 changes: 6 additions & 2 deletions _dev/src/ts/api/sentryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export function sendUserFeedback(
level,
tags: {
url: maskedUrl,
source: feedbackModalTag
source: feedbackModalTag,
phpVersion: window.AutoUpgradeVariables.php_version,
anonymousId: window.AutoUpgradeVariables.anonymous_id
}
});

Expand All @@ -85,7 +87,9 @@ export function sendUserFeedback(
captureContext: {
tags: {
url: maskedUrl,
source: feedbackModalTag
source: feedbackModalTag,
phpVersion: window.AutoUpgradeVariables.php_version,
anonymousId: window.AutoUpgradeVariables.anonymous_id
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions classes/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,9 @@ private function hasOptedOut(): bool
return isset($_SERVER[self::URL_TRACKING_ENV_NAME])
&& ((bool) $_SERVER[self::URL_TRACKING_ENV_NAME] === false || $_SERVER[self::URL_TRACKING_ENV_NAME] === 'false');
}

public function getAnonymousId(): string
{
return $this->anonymousId;
}
}
3 changes: 3 additions & 0 deletions controllers/admin/AdminSelfUpgradeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use PrestaShop\Module\AutoUpgrade\Tools14;
use PrestaShop\Module\AutoUpgrade\UpgradeContainer;
use PrestaShop\Module\AutoUpgrade\UpgradePage;
use PrestaShop\Module\AutoUpgrade\VersionUtils;
use Symfony\Component\HttpFoundation\Request;

class AdminSelfUpgradeController extends ModuleAdminController
Expand Down Expand Up @@ -533,6 +534,8 @@ private function getScriptsVariables()
'admin_dir' => $adminDir,
'stepper_parent_id' => \PrestaShop\Module\AutoUpgrade\Twig\PageSelectors::STEPPER_PARENT_ID,
'module_version' => $this->module->version,
'php_version' => VersionUtils::getHumanReadableVersionOf(PHP_VERSION_ID),
'anonymous_id' => $this->upgradeContainer->getAnalytics()->getAnonymousId(),
];
}

Expand Down

0 comments on commit 8ae4a6a

Please sign in to comment.