You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "fgerlits (via GitHub)" <gi...@apache.org> on 2023/04/26 15:03:24 UTC

[GitHub] [nifi-minifi-cpp] fgerlits commented on a diff in pull request #1490: MINIFICPP-2022 Add valid repository size metrics for all repositories

fgerlits commented on code in PR #1490:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1490#discussion_r1158705892


##########
libminifi/include/core/repository/FileSystemRepository.h:
##########
@@ -50,6 +52,18 @@ class FileSystemRepository : public core::ContentRepository {
 
   void clearOrphans() override;
 
+  uint64_t getRepositorySize() const override {
+    return utils::file::FileUtils::path_size(directory_);

Review Comment:
   nitpicking, but `FileUtils` is not needed:
   ```suggestion
       return utils::file::path_size(directory_);
   ```



##########
libminifi/include/core/repository/FileSystemRepository.h:
##########
@@ -50,6 +52,18 @@ class FileSystemRepository : public core::ContentRepository {
 
   void clearOrphans() override;
 
+  uint64_t getRepositorySize() const override {
+    return utils::file::FileUtils::path_size(directory_);
+  }
+
+  uint64_t getRepositoryEntryCount() const override {
+    auto dir_it = std::filesystem::directory_iterator(directory_);

Review Comment:
   It looks a bit strange that `getRepositorySize` uses a recursive directory iterator, but `getRepositoryEntryCount` uses a non-recursive one.  I guess we know that `FileSystemRepository` doesn't create subdirectories, but I think it would be safer to use a recursive listing here, too.



##########
METRICS.md:
##########
@@ -100,17 +100,19 @@ QueueMetrics is a system level metric that reports queue metrics for every conne
 
 ### RepositoryMetrics
 
-RepositoryMetrics is a system level metric that reports metrics for the registered repositories (by default flowfile and provenance repository)
+RepositoryMetrics is a system level metric that reports metrics for the registered repositories (by default flowfile, content, and provenance repositories)
 
-| Metric name          | Labels          | Description                           |
-|----------------------|-----------------|---------------------------------------|
-| is_running           | repository_name | Is the repository running (1 or 0)    |
-| is_full              | repository_name | Is the repository full (1 or 0)       |
-| repository_size      | repository_name | Current size of the repository        |
+| Metric name               | Labels          | Description                                     |
+|---------------------------|-----------------|-------------------------------------------------|
+| is_running                | repository_name | Is the repository running (1 or 0)              |
+| is_full                   | repository_name | Is the repository full (1 or 0)                 |
+| repository_size_bytes     | repository_name | Current size of the repository                  |
+| max_repository_size_bytes | repository_name | Maximum size of the repository (0 if unlimited) |
+| repository_entry_count    | repository_name | Current number of entries in the repository     |
 
-| Label                    | Description                                                     |
-|--------------------------|-----------------------------------------------------------------|
-| repository_name          | Name of the reported repository                                 |
+| Label                    | Description                                                                                                                           |
+|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
+| repository_name          | Name of the reported repository. There are three repositories present with the following names: `flowile`, `content` and `provenance` |

Review Comment:
   typo:
   ```suggestion
   | repository_name          | Name of the reported repository. There are three repositories present with the following names: `flowfile`, `content` and `provenance` |
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org