Skip to content
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

[feature]Support grafana charts for Prometheus #1658

Merged
merged 63 commits into from
Sep 3, 2024
Merged

Conversation

zqr10159
Copy link
Member

@zqr10159 zqr10159 commented Mar 16, 2024

What's changed?

image

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@zqr10159 zqr10159 requested a review from tomsun28 March 16, 2024 02:43
@tomsun28 tomsun28 added enhancement New feature or request good first pull request Good for newcomers task new feature labels Mar 16, 2024
wang1027-wqh
wang1027-wqh previously approved these changes Mar 22, 2024
@zqr10159
Copy link
Member Author

zqr10159 commented Apr 9, 2024

@tomsun28 I resolved conflicts and test errors ,please help review them.

…afana

# Conflicts:
#	common/src/main/java/org/apache/hertzbeat/common/entity/manager/Monitor.java
#	web-app/src/app/pojo/Monitor.ts
#	web-app/src/app/routes/monitor/monitor.module.ts
…eature#grafana

# Conflicts:
#	common/src/main/java/org/apache/hertzbeat/common/entity/manager/Monitor.java
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 2404 files.

Valid Invalid Ignored Fixed
1124 4 1276 0
Click to see the invalid file list
  • grafana/src/main/java/org/apache/hertzbeat/grafana/controller/DashboardController.java
  • grafana/src/main/java/org/apache/hertzbeat/grafana/controller/ServiceAccountController.java
  • grafana/src/main/java/org/apache/hertzbeat/grafana/service/DashboardService.java
  • grafana/src/main/java/org/apache/hertzbeat/grafana/service/DatasourceService.java
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

zqr10159 and others added 4 commits August 29, 2024 00:56
Implement the ability to upload Grafana dashboard JSON files through the monitor form,
enhancing the integration between Hertzbeat and Grafana. This feature allows users to
easily configure and visualize monitoring data within Grafana.

Additionally, refactor the datasource and service account management to use a moreefficient header creation method. This change simplifies the process of authenticating
requests to the Grafana API.

BREAKING CHANGE: The datasource and service account creation endpoints now expect
Base64 encoded credentials in the Authorization header. Adjustments may be required
for external systems relying on the previous implementation.
```
…lityThe code imports have been organized, and constants have been grouped together to improvethe readability in several classes within the grafana module. Excessive whitespace has also

been removed to ensure a cleaner and more standardized code appearance.
```
Update the license headers for the Grafana module files to reflect the Apache License 2.0.
Ensure that all contributor license agreements are in place and verify the copyright ownership
before proceeding with the update.

BREAKING CHANGE: All dashboard controllers and services now adhere to the updated licensing
agreement. Review the NOTICE file for detailed information regarding copyright ownership and
permissions.```
zqr10159 and others added 7 commits August 29, 2024 09:03
Due to the integration of the new backend, the forest HTTP client is no longer required
and has been removed from the Grafana module dependencies. This simplifies the projectstructure and eliminates the need for managing an additional HTTP client library.
```
Remove the handling of HTTP prefixes from grafana URLs across the application, as the
GrafanaConfiguration class now handles it. This change avoids redundancy and potential
mistakes in removing the prefix at multiple points in the application.
zqr10159 and others added 11 commits September 2, 2024 10:03
…d list display

Change the return type of the createDatasource and deleteDatasource methods in the
DatasourceService to void, removing the ResponseEntity. This simplifies the method
signatures and aligns them with the updated requirements.

Also, modify the monitor-form component to show the upload list for improved user
feedback in file selection steps of the monitor form process.
…line dashboard deletion

- Incorporate a unique instance identifier into the Grafana dashboard URL to support
  individualized access. This enhancement involves modifying the URL construction to include
  the `INSTANCE` parameter followed by the `monitorId`.

- Streamline the dashboard deletion process by moving the call to `dashboardDao.deleteByMonitorId`
  outside of the try-catch block, ensuring that dashboard deletion from the database is always
  attempted regardless of the API call's outcome. This change simplifies dashboard lifecycle
  management and helps maintain data consistency.

Additionally, correct the comments in `GrafanaInit` to reflect the logical step order in the
initialization sequence, improving code readability.
```
Refactor the dashboard deletion logic in the grafana module to simplify the code and
remove unnecessary return statements. The method now ensures that only the relevant
dashboard is deleted, even when multiple dashboards with the same UID exist.
…tion

Adjust the Grafana dashboard URL formatting in DashboardService to properly handle the
concatenation and spacing. Also, correct the definition of the INSTANCE constant in
CommonConstants to ensure consistency and avoid potential errors in token formatting.

The changes ensure the URL construction follows the intended structure and the INSTANCE
constant adheres to the project's coding standards.
```
…sChange property access pattern from GrafanaConfiguration to GrafanaProperties for

consistency with other modules and to align with project property management standards.
This update affects several services and controllers that previously used the older
configuration pattern.

BREAKING CHANGE: Replaced GrafanaConfiguration with GrafanaProperties. This may affect
other parts of the system depending on the previous configuration class, so ensure to
check all occurrences and make necessary adjustments.
@LiuTianyou LiuTianyou merged commit 589b0d9 into master Sep 3, 2024
4 checks passed
@zqr10159 zqr10159 deleted the feature#grafana branch September 3, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

7 participants