You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "DomGarguilo (via GitHub)" <gi...@apache.org> on 2024/05/17 17:35:43 UTC
[PR] Add metrics for compactor entries read and write [accumulo]
DomGarguilo opened a new pull request, #4572:
URL: https://github.com/apache/accumulo/pull/4572
Fixes #4553
Adds metrics for entries read and entries written.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo closed pull request #4572: Add metrics for compactor entries read and write
URL: https://github.com/apache/accumulo/pull/4572
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2125817768
The process name and IP are set as common tags when the metrics are initialized and do not need to be added again.
Common tags cannot be added once the metrics are initialized, but you could add custom tags when you create the meter if there is a need to differentiate a metric. Adding a custom tag would be appropriate when it makes sense if multiple meters could be rolled up into and presented as a single metric.
Say something was like response.time and there were individual components that make up that value. Using a tag like "client.a", "client.b" would let the overall response.time to be presented by the metrics collection / display - and still allow the ability to drill down to the component if needed.
If they do not make sense rolled up, then using a unique name for each meter would probably be better,
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2128200138
> I tried merging your branch into this one but I haven't been able to see these metrics. The new IT that I added was picking them up before but I am not seeing them at all now. Still looking into why that might be.
@DomGarguilo just saw this comment, missed it earlier when I reviewed. I can take at a look at this.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo merged PR #4572:
URL: https://github.com/apache/accumulo/pull/4572
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2125553154
> > One thing I am wondering now is if the metric name should be same for both processes.
>
> IMO, yes. The tags differentiate the process names, host names, etc.
Are these just examples or do you think these tags should be applied here? @dlmarion
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2127800361
> I experimented with pushing the metric data all into FileCompactor in [365e261](https://github.com/apache/accumulo/commit/365e26146c42d56c4d2ab66d63d48cc12142b8fb) in this [branch](https://github.com/keith-turner/accumulo/tree/addCompactorReadWriteEntriesMetrics). Thinking that if the data collection is pushed there it can easily be used by tablet server and compactor. One thing I am wondering now is if the metric name should be same for both processes.
I tried merging your branch into this one but I haven't been able to see these metrics. The new IT that I added was picking them up before but I am not seeing them at all now. Still looking into why that might be.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1617819019
##########
core/src/main/java/org/apache/accumulo/core/metrics/MetricsProducer.java:
##########
@@ -583,6 +583,8 @@ public interface MetricsProducer {
String METRICS_COMPACTOR_PREFIX = "accumulo.compactor.";
String METRICS_COMPACTOR_MAJC_STUCK = METRICS_COMPACTOR_PREFIX + "majc.stuck";
+ String METRICS_COMPACTOR_ENTRIES_READ = METRICS_COMPACTOR_PREFIX + "entries.read";
Review Comment:
Do you think its fine to leave this as the name for 2.1 and main where tservers could be running the compactions? Or should we change the name to something more agnostic of where the compaction is running for those?
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612378404
##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -159,6 +160,15 @@ protected Compactor(CompactorServerOpts opts, String[] args) {
@Override
public void registerMetrics(MeterRegistry registry) {
+
+ // TODO Should the metrics have the same name in both processes?
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "compactor").register(registry);
Review Comment:
Looking at the metrics in elasticity those seem to already have tags like `process.name=compactor`, `process.name=tserver`,`process.name=manager`, etc. Can not remember for sure if 2.1 has this, but I think it does. May not need to add the tag of `type=compactor` here if that is already covered by the common tags added to all metrics.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612378404
##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -159,6 +160,15 @@ protected Compactor(CompactorServerOpts opts, String[] args) {
@Override
public void registerMetrics(MeterRegistry registry) {
+
+ // TODO Should the metrics have the same name in both processes?
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "compactor").register(registry);
Review Comment:
Looking at the metrics in elasticity those seem to already have tags like `process.name=compactor`, `process.name=tserver`,`process.name=manager`, etc. Can not remember if 2.1 has this. May not need to add the tag of `type=compactor` here if that is already covered by the common tags added to all metrics.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2118320226
#4553 says to add additional Compactor metrics, but I have to assume that we would want these for internal compactions too, right @ddanielr ?
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1619317285
##########
core/src/main/java/org/apache/accumulo/core/metrics/MetricsProducer.java:
##########
@@ -583,6 +583,8 @@ public interface MetricsProducer {
String METRICS_COMPACTOR_PREFIX = "accumulo.compactor.";
String METRICS_COMPACTOR_MAJC_STUCK = METRICS_COMPACTOR_PREFIX + "majc.stuck";
+ String METRICS_COMPACTOR_ENTRIES_READ = METRICS_COMPACTOR_PREFIX + "entries.read";
Review Comment:
I think the name is fine. The name is not optimal for 2.1, but its great for later releases.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "ddanielr (via GitHub)" <gi...@apache.org>.
ddanielr commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2118358155
Yes, adding them for internal compactions would be good
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612397539
##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -159,6 +160,15 @@ protected Compactor(CompactorServerOpts opts, String[] args) {
@Override
public void registerMetrics(MeterRegistry registry) {
+
+ // TODO Should the metrics have the same name in both processes?
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "compactor").register(registry);
Review Comment:
> I don't think type=compactor is a common tag - it may be being added as a custom tag.
Yeah I don't think its a common tag. Was thinking that `process.name` provides the same info and therefore may not need to add the type tag.
Found the 2.1 code that adds the `process.name` tag. So I think the type tag could be dropped here as its redundant w/ `process.name`
https://github.com/apache/accumulo/blob/b21837a39e51968b8cc87dcf9781fa37b5aefd39/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java#L119
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612385132
##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -159,6 +160,15 @@ protected Compactor(CompactorServerOpts opts, String[] args) {
@Override
public void registerMetrics(MeterRegistry registry) {
+
+ // TODO Should the metrics have the same name in both processes?
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "compactor").register(registry);
Review Comment:
I don't think type=compactor is a common tag - it may be being added as a custom tag.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2123342527
> One thing I am wondering now is if the metric name should be same for both processes.
IMO, yes. The tags differentiate the process names, host names, etc.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612411802
##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -159,6 +160,15 @@ protected Compactor(CompactorServerOpts opts, String[] args) {
@Override
public void registerMetrics(MeterRegistry registry) {
+
+ // TODO Should the metrics have the same name in both processes?
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "compactor").register(registry);
Review Comment:
I mis-read your comment, I thought you were saying that type should be added. The current common tags (2.1):
- host
- port
- process name
- instance.name
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1617740771
##########
server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java:
##########
@@ -141,9 +153,61 @@ public synchronized String getCurrentLocalityGroup() {
return currentLocalityGroup;
}
- private void clearStats() {
- entriesRead.set(0);
- entriesWritten.set(0);
+ private void clearCurrentEntryCounts() {
+ currentEntriesRead.set(0);
+ currentEntriesWritten.set(0);
+ }
+
+ private void updateGlobalEntryCounts() {
+ updateTotalEntries(currentEntriesRead, lastRecordedEntriesRead, totalEntriesRead);
+ updateTotalEntries(currentEntriesWritten, lastRecordedEntriesWritten, totalEntriesWritten);
+ }
+
+ /**
+ * Updates the total count of entries by adding the difference between the current count and the
+ * last recorded count to the total.
+ *
+ * @param current The current count of entries
+ * @param recorded The last recorded count of entries
+ * @param total The total count to add the difference to
+ */
+ private void updateTotalEntries(AtomicLong current, AtomicLong recorded, LongAdder total) {
+ long currentCount = current.get();
+ long lastRecorded =
+ recorded.getAndUpdate(recordedValue -> Math.max(recordedValue, currentCount));
+ if (lastRecorded < currentCount) {
+ total.add(currentCount - lastRecorded);
+ }
+ }
+
+ /**
+ * @return the total entries written by compactions over the lifetime of this process.
+ */
+ public static long getTotalEntriesWritten() {
+ updateTotalEntries();
+ return totalEntriesWritten.sum();
+ }
+
+ /**
+ * @return the total entries read by compactions over the lifetime of this process.
+ */
+ public static long getTotalEntriesRead() {
+ updateTotalEntries();
+ return totalEntriesRead.sum();
+ }
+
+ /**
+ * Updates total entries read and written for all currently running compactions. Compactions will
+ * update the global stats when they finish. This can be called to update them sooner. This method
+ * is rate limited, so it will not cause issues if called too frequently.
+ */
+ private static void updateTotalEntries() {
+ long currentTime = System.currentTimeMillis();
Review Comment:
Good idea. When this is merged up into main using a `NanoTime` object can be used to further clean things up here too.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2135900901
> This looks good, need to figure out those `type` tags are needed.
I ended up removing the tags. It seems like the other tags that are automatically added should be good enough to not need more tags but I can add them back if anyone thinks otherwise.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2123164947
> https://github.com/apache/accumulo/issues/4553 says to add additional Compactor metrics, but I have to assume that we would want these for internal compactions too, right @ddanielr ?
I experimented with push the metric data all into FileCompactor in 365e26146c42d56c4d2ab66d63d48cc12142b8fb in this [branch](https://github.com/keith-turner/accumulo/tree/addCompactorReadWriteEntriesMetrics). Thinking that if the data collection is pushed there it can easily be used by tablet serer and compactor. One thing I am wondering now is if the metric name should be same for both processes.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1617750404
##########
server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetrics.java:
##########
@@ -36,6 +38,13 @@ public TabletServerMetrics(TabletServer tserver) {
@Override
public void registerMetrics(MeterRegistry registry) {
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "tserver").register(registry);
Review Comment:
In 2115782 I added "... by all compactions that have run on this compactor" or "... by all compactions that have run on this tserver". Let me know what you think of that.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#issuecomment-2135994058
> > I tried merging your branch into this one but I haven't been able to see these metrics. The new IT that I added was picking them up before but I am not seeing them at all now. Still looking into why that might be.
>
> @DomGarguilo just saw this comment, missed it earlier when I reviewed. I can take at a look at this.
In dfec4a1 I made wrapper methods in `Compactor` for `FileCompactor.getTotalEntriesWritten()` and `FileCompactor.getTotalEntriesRead()` so that when setting up the `FunctionCounter`, we can use `this` instead of `null` as the object that is used. This seemed to fix the issue I was seeing where I couldnt see the metrics. Not sure if using `null` as the object caused the issue but thats my best guess currently. The tests passes now.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add metrics for compactor entries read and write [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4572:
URL: https://github.com/apache/accumulo/pull/4572#discussion_r1612384658
##########
server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetrics.java:
##########
@@ -36,6 +38,13 @@ public TabletServerMetrics(TabletServer tserver) {
@Override
public void registerMetrics(MeterRegistry registry) {
+ FunctionCounter
+ .builder(METRICS_COMPACTOR_ENTRIES_READ, null, o -> FileCompactor.getTotalEntriesRead())
+ .description("Number of entries read").tag("type", "tserver").register(registry);
Review Comment:
Could add a bit more to the description.
```suggestion
.description("Number of entries read by all compactions that have run in the process").tag("type", "tserver").register(registry);
```
##########
server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java:
##########
@@ -141,9 +153,61 @@ public synchronized String getCurrentLocalityGroup() {
return currentLocalityGroup;
}
- private void clearStats() {
- entriesRead.set(0);
- entriesWritten.set(0);
+ private void clearCurrentEntryCounts() {
+ currentEntriesRead.set(0);
+ currentEntriesWritten.set(0);
+ }
+
+ private void updateGlobalEntryCounts() {
+ updateTotalEntries(currentEntriesRead, lastRecordedEntriesRead, totalEntriesRead);
+ updateTotalEntries(currentEntriesWritten, lastRecordedEntriesWritten, totalEntriesWritten);
+ }
+
+ /**
+ * Updates the total count of entries by adding the difference between the current count and the
+ * last recorded count to the total.
+ *
+ * @param current The current count of entries
+ * @param recorded The last recorded count of entries
+ * @param total The total count to add the difference to
+ */
+ private void updateTotalEntries(AtomicLong current, AtomicLong recorded, LongAdder total) {
+ long currentCount = current.get();
+ long lastRecorded =
+ recorded.getAndUpdate(recordedValue -> Math.max(recordedValue, currentCount));
+ if (lastRecorded < currentCount) {
+ total.add(currentCount - lastRecorded);
+ }
+ }
+
+ /**
+ * @return the total entries written by compactions over the lifetime of this process.
+ */
+ public static long getTotalEntriesWritten() {
+ updateTotalEntries();
+ return totalEntriesWritten.sum();
+ }
+
+ /**
+ * @return the total entries read by compactions over the lifetime of this process.
+ */
+ public static long getTotalEntriesRead() {
+ updateTotalEntries();
+ return totalEntriesRead.sum();
+ }
+
+ /**
+ * Updates total entries read and written for all currently running compactions. Compactions will
+ * update the global stats when they finish. This can be called to update them sooner. This method
+ * is rate limited, so it will not cause issues if called too frequently.
+ */
+ private static void updateTotalEntries() {
+ long currentTime = System.currentTimeMillis();
Review Comment:
could use nanotime here
##########
core/src/main/java/org/apache/accumulo/core/metrics/MetricsProducer.java:
##########
@@ -583,6 +583,8 @@ public interface MetricsProducer {
String METRICS_COMPACTOR_PREFIX = "accumulo.compactor.";
String METRICS_COMPACTOR_MAJC_STUCK = METRICS_COMPACTOR_PREFIX + "majc.stuck";
+ String METRICS_COMPACTOR_ENTRIES_READ = METRICS_COMPACTOR_PREFIX + "entries.read";
Review Comment:
These are good names for elasticity where there are no longer compaction running in tservers.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org