Skip to content

Commit

Permalink
add aggregation change Sentry event
Browse files Browse the repository at this point in the history
  • Loading branch information
braddf committed Jan 9, 2025
1 parent 42caeb0 commit 4ca3462
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
10 changes: 9 additions & 1 deletion apps/nowcasting-app/components/map/measuringUnit.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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";
Expand Down
17 changes: 10 additions & 7 deletions apps/nowcasting-app/sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ca3462

Please sign in to comment.