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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
import { getDefaultOption } from 'container/TopNav/DateTimeSelectionV2/constants';
import {
GLOBAL_TIME_LOADING_START,
GlobalTimeAction,
UPDATE_AUTO_REFRESH_DISABLED,
UPDATE_AUTO_REFRESH_INTERVAL,
UPDATE_TIME_INTERVAL,
} from 'types/actions/globalTime';
import { GlobalReducer } from 'types/reducer/globalTime';
const initialState: GlobalReducer = {
maxTime: Date.now() * 1000000,
minTime: (Date.now() - 15 * 60 * 1000) * 1000000,
loading: true,
selectedTime: getDefaultOption(
typeof window !== 'undefined' ? window?.location?.pathname : '',
),
isAutoRefreshDisabled: false,
selectedAutoRefreshInterval: '',
};
const globalTimeReducer = (
state = initialState,
action: GlobalTimeAction,
): GlobalReducer => {
switch (action.type) {
case UPDATE_TIME_INTERVAL: {
return {
...state,
...action.payload,
loading: false,
};
}
case GLOBAL_TIME_LOADING_START: {
return {
...state,
loading: true,
};
}
case UPDATE_AUTO_REFRESH_DISABLED: {
return {
...state,
isAutoRefreshDisabled: action.payload,
};
}
case UPDATE_AUTO_REFRESH_INTERVAL: {
return {
...state,
selectedAutoRefreshInterval: action.payload,
};
}
default:
return state;
}
};
export default globalTimeReducer;