justbetter / magento2-sentry

Magento 2 module to log to Sentry
MIT License
165 stars 70 forks source link

Feature: Add INP Support #135

Closed amenk closed 4 months ago

amenk commented 7 months ago

Feature: What is your use case for such a feature?

Tracking INP, see https://sentry.io/changelog/sentry-officially-supports-inp/

Feature: What is your proposed configuration entry? The new option to add? What is the behavior?

Not sure if we should add an option or enable it by default if the tracing is enabled?

What is the version of Magento and of Sentry extension you are using? Always use the latest version of the extension one before opening a bug issue.

Extension: 3.6.0 Magento: 2.4.6-p3

Draft patch

diff --git a/Block/SentryScript.php b/Block/SentryScript.php
index c35b1ef..b4ec084 100644
--- a/Block/SentryScript.php
+++ b/Block/SentryScript.php
@@ -9,7 +9,7 @@ use Magento\Framework\View\Element\Template;

 class SentryScript extends Template
 {
-    const CURRENT_VERSION = '7.39.0';
+    const CURRENT_VERSION = '7.110.0';

     /**
      * SentryScript constructor.
diff --git a/view/frontend/templates/script/sentry.phtml b/view/frontend/templates/script/sentry.phtml
index c1a7c75..c152fa0 100644
--- a/view/frontend/templates/script/sentry.phtml
+++ b/view/frontend/templates/script/sentry.phtml
@@ -35,13 +35,15 @@ if (typeof Sentry !== 'undefined') {
         environment: '<?= $block->escapeHtml(trim($block->getEnvironment())) ?>',
         integrations: [
             <?php if ($block->isTracingEnabled()): ?>
-                new Sentry.BrowserTracing(),
+                Sentry.browserTracingIntegration({
+                    enableInp: true,
+                })),
             <?php endif ?>
             <?php if ($block->useSessionReplay()): ?>
             new Sentry.Replay({
                 blockAllMedia: <?= $block->escapeHtml($block->getReplayBlockMedia() ? 'true' : 'false') ?>,
                 maskAllText: <?= $block->escapeHtml($block->getReplayMaskText() ? 'true' : 'false') ?>,
-            })
+            }),
             <?php endif ?>
         ],
         <?php if ($block->isTracingEnabled()): ?>

Shall I make a PR as is or make it configurable?

amenk commented 5 months ago

I guess it's best to make the Inp-Part configurable...

amenk commented 5 months ago

@indykoning I would close this issue as https://github.com/justbetter/magento2-sentry/pull/137 was merged - but I was wondering, if you plan to tag a release? or will new things stay a bit in the main branch before tagging a release?

indykoning commented 4 months ago

It has been released in version 3.7.0 🚀