diff --git a/apps/nowcasting-app/components/map/measuringUnit.tsx b/apps/nowcasting-app/components/map/measuringUnit.tsx index 5b3c64d7..b7f4d3cc 100644 --- a/apps/nowcasting-app/components/map/measuringUnit.tsx +++ b/apps/nowcasting-app/components/map/measuringUnit.tsx @@ -1,6 +1,7 @@ import { Dispatch, MouseEvent as ReactMouseEvent, SetStateAction } from "react"; import { ActiveUnit, NationalAggregation } from "./types"; import useGlobalState from "../helpers/globalState"; +import * as Sentry from "@sentry/nextjs"; const MeasuringUnit = ({ activeUnit, @@ -24,8 +25,15 @@ const MeasuringUnit = ({ aggregation: NationalAggregation ) => { event.preventDefault(); + Sentry.captureMessage("Event: Aggregation level changed", { + extra: { + eventType: "UserAction", + aggregation, + timestamp: new Date().getTime() // Just to make the event unique + } + }); setNationalAggregation(aggregation); - console.log("aggregation", aggregation); + console.log("sent event to Sentry: aggregation", aggregation); }; const buttonClasses = "relative inline-flex items-center px-3 py-0.5 text-sm dash:text-lg dash:tracking-wide font-extrabold hover:bg-ocf-yellow border-gray-600"; diff --git a/apps/nowcasting-app/sentry.client.config.js b/apps/nowcasting-app/sentry.client.config.js index 0a81eb40..c90d55a0 100644 --- a/apps/nowcasting-app/sentry.client.config.js +++ b/apps/nowcasting-app/sentry.client.config.js @@ -39,13 +39,16 @@ Sentry.init({ // sessions when an error occurs. replaysOnErrorSampleRate: 1.0, - integrations: [ - Sentry.replayIntegration({ - // Additional SDK configuration goes in here, for example: - maskAllText: true, - blockAllMedia: true - }) - ], + integrations: (integrations) => { + return [ + ...integrations, + Sentry.replayIntegration({ + // Additional SDK configuration goes in here, for example: + maskAllText: true, + blockAllMedia: true + }) + ].filter((integration) => integration.name !== "Dedupe"); + }, environment: process.env.NEXT_PUBLIC_SENTRY_ENV_LABEL || process.env.NODE_ENV // ... // Note: if you want to override the automatic release value, do not set a