-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[feature]Add time series data forecasting functionality #3909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Created analysis module with Spring configuration - Implemented AnalysisService interface for forecasting - Added AnalysisServiceImpl with TinyProphet model integration - Built TimeSeriesPreprocessor for data resampling and interpolation - Developed TinyProphet algorithm using Fourier series and OLS regression - Configured Maven module and dependencies including commons-math3 - Registered analysis module in parent pom.xml - Added preprocessing and forecasting pipeline for historical metrics
There was a problem hiding this 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 pull request adds comprehensive time series forecasting functionality to HertzBeat, introducing a new analysis module with machine learning capabilities for predicting future metric values based on historical data. The implementation includes both backend forecasting algorithms and frontend visualization of predictions with confidence intervals.
Key Changes:
- Added new
hertzbeat-analysisMaven module with NLinear forecasting model usi 8000 ng ridge regression and time series preprocessing capabilities - Implemented REST API endpoint
/api/analysis/predictfor time series prediction with automatic training window calculation - Enhanced frontend chart component to automatically load and visualize forecast data with confidence intervals after historical data loads
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
web-app/src/assets/i18n/zh-CN.json |
Added Chinese translations for forecast, confidence lower, and confidence upper labels |
web-app/src/assets/i18n/en-US.json |
Added English translations for forecast visualization labels |
web-app/src/app/service/monitor.service.ts |
Added new service method to call prediction API with history parameter |
web-app/src/app/routes/monitor/monitor-data-chart/monitor-data-chart.component.ts |
Implemented auto-loading of prediction data and chart visualization with stacked confidence bands |
script/sureness.yml (and docker-compose variants) |
Added security rules for /api/analysis/** endpoints accessible by admin and user roles |
pom.xml |
Added hertzbeat-analysis module and commons-math3 dependency for statistical computations |
hertzbeat-startup/src/main/resources/sureness.yml |
Added analysis API security configuration |
hertzbeat-manager/src/test/resources/sureness.yml |
Added analysis API security configuration for tests |
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/controller/AnalysisController.java |
New controller implementing prediction endpoint with dynamic training window calculation and metric validation |
hertzbeat-manager/pom.xml |
Added dependency on hertzbeat-analysis module |
hertzbeat-e2e/hertzbeat-log-e2e/src/test/resources/sureness.yml |
Added analysis API security configuration for e2e tests |
hertzbeat-collector/hertzbeat-collector-basic/pom.xml |
Formatting fix (newline at end of file) |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/service/impl/AnalysisServiceImpl.java |
Service implementation orchestrating preprocessing, model training, and forecasting |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/service/AnalysisService.java |
Service interface defining forecast contract |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/algorithm/TimeSeriesPreprocessor.java |
Implements data resampling, interpolation, and gap filling for model input |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/algorithm/PredictionResult.java |
Data class encapsulating forecast values with confidence bounds and timestamp |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/algorithm/NLinearModel.java |
Core forecasting algorithm using ridge regression with flat-line detection and fallback strategies |
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/AnalysisModule.java |
Spring configuration enabling component scanning for analysis package |
hertzbeat-analysis/pom.xml |
Maven configuration for new analysis module with dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
web-app/src/app/routes/monitor/monitor-data-chart/monitor-data-chart.component.ts
Show resolved
Hide resolved
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/controller/AnalysisController.java
Show resolved
Hide resolved
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/controller/AnalysisController.java
Outdated
Show resolved
Hide resolved
hertzbeat-analysis/src/main/java/org/apache/hertzbeat/analysis/algorithm/NlinearModel.java
Show resolved
Hide resolved
web-app/src/app/routes/monitor/monitor-data-chart/monitor-data-chart.component.ts
Show resolved
Hide resolved
...t-analysis/src/main/java/org/apache/hertzbeat/analysis/service/impl/AnalysisServiceImpl.java
Show resolved
Hide resolved
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/controller/AnalysisController.java
Outdated
Show resolved
Hide resolved
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/controller/AnalysisController.java
Outdated
Show resolved
Hide resolved
web-app/src/app/routes/monitor/monitor-data-chart/monitor-data-chart.component.ts
Outdated
Show resolved
Hide resolved
…riable names for clarity
…ontroller/AnalysisController.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Logic <zqr10159@126.com>
…ontroller/AnalysisController.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Logic <zqr10159@126.com>
…-chart.component.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Logic <zqr10159@126.com>
Signed-off-by: Logic <zqr10159@dromara.org>
…ontroller/AnalysisController.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Logic <zqr10159@126.com>
…riable names for clarity
This pull request introduces a new analysis module to the project, focused on time series forecasting and preprocessing. It adds a Maven module with its own dependencies, implements core algorithms for time series prediction (including a robust NLinear model and a lightweight Prophet-inspired model), and provides supporting infrastructure for data preprocessing and service abstraction.
Key changes include:
Module Setup and Dependencies
hertzbeat-analysiswith its ownpom.xml, specifying dependencies on core Hertzbeat modules, Spring Boot, and Apache Commons Math. Java 17 is set as the source/target version.Core Algorithms for Time Series Forecasting
NLinearModel, an industrial-grade robust time series forecasting model using ridge regression (L2 regularization) for stability and overfitting prevention. Includes logic for flat line detection and fallback strategies.TinyProphet, a lightweight time series forecasting model inspired by Prophet, using OLS regression with Fourier features for seasonality and trend detection.PredictionResultas a data class to encapsulate forecast values and confidence intervals.Data Preprocessing
TimeSeriesPreprocessorfor resampling and interpolating time series data, handling missing values and aligning data to fixed time steps for model input.Service Abstraction and Spring Integration
AnalysisServiceinterface for model training and forecasting, establishing a contract for future service implementations.AnalysisModuleas a Spring configuration class to enable component scanning for the new analysis package.