Skip to content

Conversation

@barnabasdomozi
Copy link
Collaborator

This PR implements paged versions of existing functions in CppMetricsService:

  • getPagedCppAstNodeMetricsForPath
  • getPagedCppAstNodeMetricsDetailedForPath
  • getPagedCppFileMetricsForPath

I also upgraded the C++ standard to 17, since I used if constexpr in a function template.

The Thrift CppMetricsService was missing JavaScript bindings, I think this is a mistake so I added that as well to plugins/metrics/service/CMakeLists.txt.

On a high level, the paging is implemented as follows:

  1. We select DISTINCT astNodeId from table CppAstNodeMetrics.
  2. We filter for path (using LIKE) and also for pageSize and pageNumber (using LIMIT and OFFSET).
  3. Finally, we have a list of astNodeId with exact size as pageSize. We run SELECT on CppAstNodeMetrics once again, selecting all rows where the astNodeId is in the list (using SQL IN keyword).

The PR was also tested using Thrift JS bindings.

Copy link
Collaborator

@mcserep mcserep left a comment

Choose a reason for hiding this comment

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

Nice approach on avoiding code redundancy in the service implementation! 👏

The Thrift CppMetricsService was missing JavaScript bindings, I think this is a mistake so I added that as well to plugins/metrics/service/CMakeLists.txt.

I think it was simply missing, because the frontend does not support metrics yet. It can be added though.

@mcserep
Copy link
Collaborator

mcserep commented Apr 8, 2025

@wbqpk3 The CI fails to build on Ubuntu 20.04. While we should drop support for Ubuntu 20.04 soon, now it should be checked why the build fails there, otherwise the Docker images won't be build too in the pipeline.

@mcserep mcserep added Kind: Enhancement 🌟 Plugin: Metrics Issues related to the code metrics plugin. Plugin: C++ Issues related to the parsing and presentation of C++ projects. labels Apr 8, 2025
@mcserep mcserep added this to Roadmap Apr 8, 2025
@github-project-automation github-project-automation bot moved this to In progress in Roadmap Apr 8, 2025
@mcserep mcserep added this to the Upcoming Release milestone Apr 8, 2025
@mcserep mcserep changed the title CppMetrics paging Add paging support for C++ metrics Apr 8, 2025
@barnabasdomozi
Copy link
Collaborator Author

@mcserep

Looking at the build logs, it seems the error is caused by the switch to the C++ 17 standard.
On Ubuntu 20.04, we install ODB from package repositories resulting in an older ODB version which has issues with C++ 17 changes.
In 77566fe I attempted to fix this issue by compiling ODB from source.

@barnabasdomozi
Copy link
Collaborator Author

I just also noticed a warning message that Ubuntu 20.04 runner images on GitHub will no longer be supported after 2025-04-15.
actions/runner-images#11101

@mcserep
Copy link
Collaborator

mcserep commented Apr 8, 2025

I just also noticed a warning message that Ubuntu 20.04 runner images on GitHub will no longer be supported after 2025-04-15. actions/runner-images#11101

Yes, and while it is not April 15th yet, CI jobs for Ubuntu 20.04 already started to skip, due to image unavailability. I have disabled the CI build for Ubuntu 20.04 in b9e6733, and added an issue #789 to deprecate it completely.

Looking at the build logs, it seems the error is caused by the switch to the C++ 17 standard.
On Ubuntu 20.04, we install ODB from package repositories resulting in an older ODB version which has issues with C++ 17 changes.
In 77566fe I attempted to fix this issue by compiling ODB from source.

Thanks for attempting to resolve it, but in this case it is not necessary anymore and simply reverting 77566fe would be better.

@barnabasdomozi
Copy link
Collaborator Author

@mcserep Removed the Ubuntu 20.04 CI commit and rebased to master.

@mcserep mcserep merged commit be4893b into Ericsson:master Apr 9, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Roadmap Apr 9, 2025
@barnabasdomozi barnabasdomozi deleted the cppmetrics_paging branch April 9, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind: Enhancement 🌟 Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants