This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 943ca69fd6 Added Monitor property to optionally show extent information (#5081) 943ca69fd6 is described below commit 943ca69fd6f0dcc18fd8fcb5df6fa474329c7788 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Wed Nov 20 08:21:07 2024 -0500 Added Monitor property to optionally show extent information (#5081) Closes #5078 --- .../src/main/java/org/apache/accumulo/core/conf/Property.java | 10 +++++++++- .../src/main/java/org/apache/accumulo/monitor/Monitor.java | 11 +++++++++++ .../accumulo/monitor/rest/tservers/TabletServerResource.java | 3 ++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java index 0fa037366c..0f1bf8ee33 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java @@ -994,6 +994,14 @@ public enum Property { + " The resources that are used by default can be seen in" + " `accumulo/server/monitor/src/main/resources/templates/default.ftl`.", "2.0.0"), + MONITOR_OBFUSCATE_EXTENTS("monitor.extents.obfuscate", "true", PropertyType.BOOLEAN, + "Obfuscates the table extent information displayed in the Monitor if true. Setting" + + " this to false will expose data in the row of the keys where tablets split. It" + + " is not recommended to set this to false if the Monitor is exposed to entities" + + " that should not see this information. The Monitor process reads this property" + + " from the accumulo.properties file only, not ZooKeeper, so it cannot be" + + " changed at runtime.", + "2.1.4"), @Deprecated(since = "2.1.0") TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of distributed tracing.", "1.3.5"), @@ -1885,7 +1893,7 @@ public enum Property { // others TSERV_NATIVEMAP_ENABLED, TSERV_SCAN_MAX_OPENFILES, MANAGER_RECOVERY_WAL_EXISTENCE_CACHE_TIME, - TSERV_SESSION_MAXIDLE, TSERV_UPDATE_SESSION_MAXIDLE); + TSERV_SESSION_MAXIDLE, TSERV_UPDATE_SESSION_MAXIDLE, MONITOR_OBFUSCATE_EXTENTS); /** * Checks if the given property may be changed via Zookeeper, but not recognized until the restart diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java index 80dd69b8cd..315b107e88 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java @@ -115,6 +115,7 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { private static final int REFRESH_TIME = 5; private final long START_TIME; + private final boolean obfuscateExtents; public static void main(String[] args) throws Exception { try (Monitor monitor = new Monitor(new ServerOpts(), args)) { @@ -125,6 +126,12 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { Monitor(ServerOpts opts, String[] args) { super("monitor", opts, args); START_TIME = System.currentTimeMillis(); + // Using site configuration on purpose. We want to get the value from + // accumulo.properties file local to the Monitor. We don't want to + // enable someone to change this property dynamically and expose + // information. + obfuscateExtents = + getContext().getSiteConfiguration().getBoolean(Property.MONITOR_OBFUSCATE_EXTENTS); } private final AtomicLong lastRecalc = new AtomicLong(0L); @@ -1047,4 +1054,8 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { public int getLivePort() { return livePort; } + + public boolean isObfuscateExtents() { + return obfuscateExtents; + } } diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java index 820f3476d0..0c845b01dc 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java @@ -319,7 +319,8 @@ public class TabletServerResource { KeyExtent extent = KeyExtent.fromThrift(info.extent); TableId tableId = extent.tableId(); - String displayExtent = String.format("[%s]", extent.obscured()); + String displayExtent = String.format("[%s]", + monitor.isObfuscateExtents() ? extent.obscured() : extent.endRow().toString()); String tableName = monitor.getContext().getPrintableTableInfoFromId(tableId);