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.

feat: changed start and end time logic for consumer lag details (#6605)

SagarRajput-77405bfbbee3e
diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQDetails.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MQDetails.tsx
index 7eab107e59..41bb54efb4 100644
--- a/frontend/src/pages/MessagingQueues/MQDetails/MQDetails.tsx
+++ b/frontend/src/pages/MessagingQueues/MQDetails/MQDetails.tsx
@@ -24,13 +24,13 @@ const MQServiceDetailTypePerView = (
producerLatencyOption: ProducerLatencyOptions,
): Record<string, MessagingQueueServiceDetailType[]> => ({
[MessagingQueuesViewType.consumerLag.value]: [
- MessagingQueueServiceDetailType.ConsumerDetails,
MessagingQueueServiceDetailType.ProducerDetails,
+ MessagingQueueServiceDetailType.ConsumerDetails,
MessagingQueueServiceDetailType.NetworkLatency,
],
[MessagingQueuesViewType.partitionLatency.value]: [
- MessagingQueueServiceDetailType.ConsumerDetails,
MessagingQueueServiceDetailType.ProducerDetails,
+ MessagingQueueServiceDetailType.ConsumerDetails,
],
[MessagingQueuesViewType.producerLatency.value]: [
producerLatencyOption === ProducerLatencyOptions.Consumers
@@ -122,7 +122,7 @@ function MessagingQueuesDetails({
producerLatencyOption: ProducerLatencyOptions;
}): JSX.Element {
const [currentTab, setCurrentTab] = useState<MessagingQueueServiceDetailType>(
- MessagingQueueServiceDetailType.ConsumerDetails,
+ MessagingQueueServiceDetailType.ProducerDetails,
);
useEffect(() => {
diff --git a/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts b/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts
index ec7fadcdce..e787739cb3 100644
--- a/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts
+++ b/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts
@@ -179,10 +179,13 @@ export const convertToNanoseconds = (timestamp: number): bigint =>
export const getStartAndEndTimesInMilliseconds = (
timestamp: number,
): { start: number; end: number } => {
- const FIVE_MINUTES_IN_MILLISECONDS = 5 * 60 * 1000; // 5 minutes in milliseconds - check with Shivanshu once
+ const FIVE_MINUTES_IN_MILLISECONDS = 5 * 60 * 1000; // 300,000 milliseconds
- const start = Math.floor(timestamp);
- const end = Math.floor(start + FIVE_MINUTES_IN_MILLISECONDS);
+ const pointInTime = Math.floor(timestamp * 1000);
+
+ // Convert timestamp to milliseconds and floor it
+ const start = Math.floor(pointInTime - FIVE_MINUTES_IN_MILLISECONDS);
+ const end = Math.floor(pointInTime + FIVE_MINUTES_IN_MILLISECONDS);
return { start, end };
};
@@ -311,8 +314,8 @@ export const getMetaDataAndAPIPerView = (
return {
[MessagingQueuesViewType.consumerLag.value]: {
tableApiPayload: {
- start: (selectedTimelineQuery?.start || 0) * 1e9,
- end: (selectedTimelineQuery?.end || 0) * 1e9,
+ start: (selectedTimelineQuery?.start || 0) * 1e6,
+ end: (selectedTimelineQuery?.end || 0) * 1e6,
variables: {
partition: selectedTimelineQuery?.partition,
topic: selectedTimelineQuery?.topic,