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

Development: Add admin metrics page tests #9249

Merged
merged 31 commits into from
Sep 19, 2024

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Aug 26, 2024

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.
  • This is a small issue that I tested locally and was confirmed by another developer on a test server.
  • I chose a title conforming to the naming conventions for pull requests.

Server

  • I added one integration test (Spring) related to the feature (with a high test coverage).

Client

  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes. (no changes)

Motivation and Context

Tried to fix #9227

Description

Some content of the metrics endpoint are undefined/not sent by the server anymore, and therefore breaks the metrics page.
As there are some undefined variables, the page breaks and does not display some things, e.g. see metrics on TS3:
image

This PR tried to achieve two things:

  1. Make sure the page does not break when expected content is not available ✅ -> added undefined checks
  2. Find the cause of the metrics endpoint not providing all metrics ✅ -> bug in security dependnecy

The metrics page broke, when the spring_security_version update from 6.2.4 to 6.3.0 happened. It turns out, the issue was a bug in one of the dependencies. It is fixed again on develop, by the update of spring_security_version from 6.3.2 to 6.3.3. See spring-projects/spring-security#15658

The issue was noticed pretty late (2 weeks ago), although it persisted since 25.05.24 (almost 2 moths).
To avoid this in the future, we add an integration test that checks the /management/jhimetrics endpoint.

Steps for Testing

Prerequisites:

  1. As an admin check that the Server Administration -> Metrics page loads everything correctly

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

After the update:

image

Summary by CodeRabbit

  • New Features

    • Enhanced conditional rendering for JVM memory and garbage collector metrics, ensuring only relevant data is displayed.
    • Introduced a new integration test for the JhiMetrics endpoint to validate the functionality and structure of metrics data.
    • Added a method to check the existence and non-emptiness of keys in the metrics object, improving data validation.
  • Bug Fixes

    • Improved UI robustness by preventing the display of empty metrics sections.
  • Documentation

    • Updated HTML structure and element IDs for better clarity and organization.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Aug 26, 2024
@dfuchss dfuchss self-requested a review August 28, 2024 19:38
@github-actions github-actions bot added the tests label Aug 31, 2024
@SimonEntholzer SimonEntholzer marked this pull request as ready for review August 31, 2024 10:21
@SimonEntholzer SimonEntholzer requested a review from a team as a code owner August 31, 2024 10:21
Copy link

coderabbitai bot commented Aug 31, 2024

Walkthrough

The changes involve updates to the rendering logic and structure of the JVM memory and garbage collector metrics components in the Artemis application. Enhancements ensure that metrics are displayed only when relevant data is available, improving the user interface. Additionally, new properties are introduced in the component classes for better encapsulation and access to global objects, and an integration test is added to validate the metrics endpoint functionality.

Changes

Files Change Summary
src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html Enhanced conditional rendering for JVM memory metrics to ensure meaningful data display.
src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.ts Added a protected readonly Object property for improved encapsulation.
src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html Improved conditional rendering and HTML structure for garbage collector metrics, including renaming and layout adjustments.
src/main/webapp/app/admin/metrics/metrics.component.ts Added a protected readonly console property for logging and debugging capabilities; introduced a method to check key existence in metrics.
src/test/java/de/tum/in/www1/artemis/JhiMetricsIntegrationTest.java Introduced a new integration test for validating the JhiMetrics endpoint functionality and ensuring correct data structure.

Assessment against linked issues

Objective Addressed Explanation
See current metrics (Issue #9227)
Fix undefined errors in metrics display (Issue #9227)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI o1 for code reviews: OpenAI's new o1 model is being tested for code reviews. This model has advanced reasoning capabilities and can provide more nuanced feedback on your code.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Co-authored-by: Johannes Stöhr <38322605+JohannesStoehr@users.noreply.github.com>
Copy link

github-actions bot commented Sep 1, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Sep 1, 2024
@SimonEntholzer SimonEntholzer removed the deployment-error Added by deployment workflows if an error occured label Sep 1, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

src/main/webapp/app/admin/metrics/metrics.component.ts Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 1, 2024
Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

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

re-approve after file was moved to another folder

Copy link
Contributor

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

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

Code

Copy link
Contributor

@BaumiCoder BaumiCoder left a comment

Choose a reason for hiding this comment

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

Tested locally again - Looks good to me

Copy link
Contributor

@iyannsch iyannsch left a comment

Choose a reason for hiding this comment

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

Reapprove package change in code

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Thanks for moving the file 👍

@krusche krusche merged commit 64be5de into develop Sep 19, 2024
18 of 23 checks passed
@krusche krusche deleted the chore/bugfix/fix-metrics-page branch September 19, 2024 20:26
@krusche krusche added this to the 7.5.4 milestone Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix client Pull requests that update TypeScript code. (Added Automatically!) ready for review ready to merge tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Application Metrics View is broken