Skip to content

Data observability changes#355

Open
JeraldJF wants to merge 15 commits intomainfrom
dataObserve
Open

Data observability changes#355
JeraldJF wants to merge 15 commits intomainfrom
dataObserve

Conversation

@JeraldJF
Copy link
Collaborator

No description provided.

Base automatically changed from release-1.9.0 to main June 3, 2025 05:38
@manjudr manjudr changed the base branch from main to release-1.10.0 June 3, 2025 06:02
Base automatically changed from release-1.10.0 to main July 4, 2025 13:19
@manjudr manjudr requested a review from Copilot July 18, 2025 10:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements significant data observability enhancements to support time-based metrics tracking and system downtime monitoring. The changes expand the metrics service to handle both hourly and daily granularity data aggregation, introduce infrastructure monitoring capabilities, and enhance the API to support flexible date range queries.

  • Enhanced metrics collection with hourly/daily granularity support and status tracking over time
  • Added comprehensive downtime monitoring with Prometheus integration for Kubernetes pod health
  • Replaced data quality metrics with infrastructure downtime tracking capabilities

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
DatasetMetricsService.ts Major refactor to support time-series data with hourly/daily granularity and added downtime monitoring
queries.ts Updated query functions to support time periods and added new Prometheus queries for extractor metrics
DatasetMetricsController.ts Added date range validation and switched from data_quality to down_time category
DatasetMetrics.json Updated schema to support date ranges and downtime configuration
DataObsrvDefaults.ts New configuration file defining container monitoring setup

if (totalEvents > 0) {
const failurePercentage = (failedEvents / totalEvents) * 100;
status = failurePercentage > 5 ? "Unhealthy" : "Healthy";
reason = status === "Unhealthy" ? "High events failure rate detected is higher than threshold" : "No issues reported";
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message contains redundant text. 'High events failure rate detected is higher than threshold' should be simplified to 'Events failure rate is higher than threshold' to avoid the redundant 'detected is higher' phrasing.

Suggested change
reason = status === "Unhealthy" ? "High events failure rate detected is higher than threshold" : "No issues reported";
reason = status === "Unhealthy" ? "Events failure rate is higher than threshold" : "No issues reported";

Copilot uses AI. Check for mistakes.
throw new Error(`Prometheus query failed: ${response.statusText}`);
}
return await response.json();
}
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon after the function declaration. JavaScript/TypeScript functions should end with a semicolon for consistency.

Suggested change
}
};

Copilot uses AI. Check for mistakes.
for (let i = 0; i < 24; i++) {
const currentHour = startTime.add(i + 1, 'hour');
const timestamp = currentHour.format('YYYY-MM-DDTHH:00:00.000Z');
const processingTime: any = dataMap.get(timestamp) || 0;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type instead since the value is expected to be numeric (defaulting to 0).

Suggested change
const processingTime: any = dataMap.get(timestamp) || 0;
const processingTime: number = (dataMap.get(timestamp) as number) || 0;

Copilot uses AI. Check for mistakes.
// Fill in all days
while (currentDate.isBefore(lastDate)) {
const dateStr = currentDate.format('YYYY-MM-DD');
const processingTime: any = dataMap.get(dateStr) || 0;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type instead since the value is expected to be numeric (defaulting to 0).

Suggested change
const processingTime: any = dataMap.get(dateStr) || 0;
const processingTime: number = dataMap.get(dateStr) || 0;

Copilot uses AI. Check for mistakes.
Comment on lines +155 to +156
const totalEvents: any = eventsMap.get(timestamp) || 0;
const failedEvents: any = failedEventsMap.get(timestamp) || 0;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type instead since the value is expected to be numeric (defaulting to 0).

Suggested change
const totalEvents: any = eventsMap.get(timestamp) || 0;
const failedEvents: any = failedEventsMap.get(timestamp) || 0;
const totalEvents: number = eventsMap.get(timestamp) || 0;
const failedEvents: number = failedEventsMap.get(timestamp) || 0;

Copilot uses AI. Check for mistakes.
while (currentDate.isBefore(lastDate)) {
const dateStr = currentDate.format('YYYY-MM-DD');
const totalEvents: any = eventsMap.get(dateStr) || 0;
const failedEvents: any = failedEventsMap.get(dateStr) || 0;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type instead since the value is expected to be numeric (defaulting to 0).

Suggested change
const failedEvents: any = failedEventsMap.get(dateStr) || 0;
const failedEvents: number = failedEventsMap.get(dateStr) || 0;

Copilot uses AI. Check for mistakes.
Comment on lines +253 to +254
const totalEventsCount: any = Array.from(eventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalFailedEventsCount: any = Array.from(failedEventsMap.values()).reduce((sum: any, count) => sum + count, 0);
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type for both totalEventsCount and the sum parameter since they represent numeric values.

Suggested change
const totalEventsCount: any = Array.from(eventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalFailedEventsCount: any = Array.from(failedEventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalEventsCount: number = Array.from(eventsMap.values()).reduce((sum: number, count: number) => sum + count, 0);
const totalFailedEventsCount: number = Array.from(failedEventsMap.values()).reduce((sum: number, count: number) => sum + count, 0);

Copilot uses AI. Check for mistakes.
Comment on lines +253 to +254
const totalEventsCount: any = Array.from(eventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalFailedEventsCount: any = Array.from(failedEventsMap.values()).reduce((sum: any, count) => sum + count, 0);
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats TypeScript's type safety. Consider using 'number' type for both totalFailedEventsCount and the sum parameter since they represent numeric values.

Suggested change
const totalEventsCount: any = Array.from(eventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalFailedEventsCount: any = Array.from(failedEventsMap.values()).reduce((sum: any, count) => sum + count, 0);
const totalEventsCount: number = Array.from(eventsMap.values()).reduce((sum: number, count: number) => sum + count, 0);
const totalFailedEventsCount: number = Array.from(failedEventsMap.values()).reduce((sum: number, count: number) => sum + count, 0);

Copilot uses AI. Check for mistakes.
})();

const duration = time_period_str === "1" ? "1h" : "1d";
const downtimeMetrics: any[] = [];
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any[]' type defeats TypeScript's type safety. Consider defining a proper interface for downtime metrics with properties like container, componentType, totalDowntime, intervalStart, and status.

Suggested change
const downtimeMetrics: any[] = [];
const downtimeMetrics: DowntimeMetric[] = [];

Copilot uses AI. Check for mistakes.
const totalFailedEventsPayload = totalFailedEventsQuery(intervals, dataset_id);
const totalQueryCalls = generateTotalQueryCallsQuery(config?.data_observability?.data_out_query_time_period);
const totalQueryCallsAtDatasetLevel = generateDatasetQueryCallsQuery(dataset_id, config?.data_observability?.data_out_query_time_period);
export const getDataObservability = async (dataset_id: string, intervals: string, time_period: any) => {
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter 'time_period' uses 'any' type. Consider using 'number' type instead since it's used in numeric operations and comparisons.

Suggested change
export const getDataObservability = async (dataset_id: string, intervals: string, time_period: any) => {
export const getDataObservability = async (dataset_id: string, intervals: string, time_period: number) => {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants