Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: add log events for timezone interactions in date/time picker and timezone adaptation (#6676)

Shaheer Kochai53ebd39f419d
diff --git a/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx b/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
index 6064b64a09..48b2f2082f 100644
--- a/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
+++ b/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
@@ -3,6 +3,7 @@
import './CustomTimePicker.styles.scss';
import { Input, Popover, Tooltip, Typography } from 'antd';
+import logEvent from 'api/common/logEvent';
import cx from 'classnames';
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
import {
@@ -297,6 +298,18 @@ function CustomTimePicker({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location.pathname]);
+ const handleTimezoneHintClick = (e: React.MouseEvent): void => {
+ e.stopPropagation();
+ handleViewChange('timezone');
+ setIsOpenedFromFooter(false);
+ logEvent(
+ 'DateTimePicker: Timezone picker opened from time range input badge',
+ {
+ page: location.pathname,
+ },
+ );
+ };
+
return (
<div className="custom-time-picker">
<Popover
@@ -360,14 +373,7 @@ function CustomTimePicker({
suffix={
<>
{!!isTimezoneOverridden && activeTimezoneOffset && (
- <div
- className="timezone-badge"
- onClick={(e): void => {
- e.stopPropagation();
- handleViewChange('timezone');
- setIsOpenedFromFooter(false);
- }}
- >
+ <div className="timezone-badge" onClick={handleTimezoneHintClick}>
<span>{activeTimezoneOffset}</span>
</div>
)}
diff --git a/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx b/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
index a42bb6b478..d5c4339bc7 100644
--- a/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
+++ b/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
@@ -2,6 +2,7 @@ import './CustomTimePicker.styles.scss';
import { Color } from '@signozhq/design-tokens';
import { Button } from 'antd';
+import logEvent from 'api/common/logEvent';
import cx from 'classnames';
import ROUTES from 'constants/routes';
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
@@ -81,6 +82,12 @@ function CustomTimePickerPopoverContent({
const handleTimezoneHintClick = (): void => {
setActiveView('timezone');
setIsOpenedFromFooter(true);
+ logEvent(
+ 'DateTimePicker: Timezone picker opened from time range picker footer',
+ {
+ page: pathname,
+ },
+ );
};
if (activeView === 'timezone') {
diff --git a/frontend/src/components/CustomTimePicker/TimezonePicker.tsx b/frontend/src/components/CustomTimePicker/TimezonePicker.tsx
index 2f4da45837..0259e51087 100644
--- a/frontend/src/components/CustomTimePicker/TimezonePicker.tsx
+++ b/frontend/src/components/CustomTimePicker/TimezonePicker.tsx
@@ -2,6 +2,7 @@ import './TimezonePicker.styles.scss';
import { Color } from '@signozhq/design-tokens';
import { Input } from 'antd';
+import logEvent from 'api/common/logEvent';
import cx from 'classnames';
import { TimezonePickerShortcuts } from 'constants/shortcuts/TimezonePickerShortcuts';
import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys';
@@ -157,6 +158,12 @@ function TimezonePicker({
updateTimezone(timezone);
handleCloseTimezonePicker();
setIsOpen(false);
+ logEvent('DateTimePicker: New Timezone Selected', {
+ timezone: {
+ name: timezone.name,
+ offset: timezone.offset,
+ },
+ });
},
[handleCloseTimezonePicker, setIsOpen, updateTimezone],
);
diff --git a/frontend/src/container/MySettings/TimezoneAdaptation/TimezoneAdaptation.tsx b/frontend/src/container/MySettings/TimezoneAdaptation/TimezoneAdaptation.tsx
index a716d4196d..b9e3b5bf5c 100644
--- a/frontend/src/container/MySettings/TimezoneAdaptation/TimezoneAdaptation.tsx
+++ b/frontend/src/container/MySettings/TimezoneAdaptation/TimezoneAdaptation.tsx
@@ -2,6 +2,7 @@ import './TimezoneAdaptation.styles.scss';
import { Color } from '@signozhq/design-tokens';
import { Switch } from 'antd';
+import logEvent from 'api/common/logEvent';
import { Delete } from 'lucide-react';
import { useTimezone } from 'providers/Timezone';
import { useMemo } from 'react';
@@ -27,6 +28,18 @@ function TimezoneAdaptation(): JSX.Element {
const handleOverrideClear = (): void => {
updateTimezone(browserTimezone);
+ logEvent('Settings: Timezone override cleared', {});
+ };
+
+ const handleSwitchChange = (): void => {
+ setIsAdaptationEnabled((prev) => {
+ const isEnabled = !prev;
+ logEvent(
+ `Settings: Timezone adaptation ${isEnabled ? 'enabled' : 'disabled'}`,
+ {},
+ );
+ return isEnabled;
+ });
};
return (
@@ -35,7 +48,7 @@ function TimezoneAdaptation(): JSX.Element {
<h2 className="timezone-adaption__title">Adapt to my timezone</h2>
<Switch
checked={isAdaptationEnabled}
- onChange={setIsAdaptationEnabled}
+ onChange={handleSwitchChange}
style={getSwitchStyles()}
/>
</div>