You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2023/01/04 03:42:39 UTC
[GitHub] [accumulo] keith-turner commented on a diff in pull request #3124: Allow user to set arbitrary data on Scanner to correlate with server side information
keith-turner commented on code in PR #3124:
URL: https://github.com/apache/accumulo/pull/3124#discussion_r1061106534
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ScanServerSelector.java:
##########
@@ -105,6 +105,12 @@ interface SelectorParameters {
* were set, an empty map is returned.
*/
Map<String,String> getHints();
+
+ /**
+ * @return user data set by a scanner using {@link ScannerBase#setUserData(String)}
+ */
Review Comment:
```suggestion
* @return user data set by a scanner using {@link ScannerBase#setUserData(String)}
*
* @since 3.0.0
*/
```
##########
core/src/main/java/org/apache/accumulo/core/client/ScannerBase.java:
##########
@@ -390,4 +390,21 @@ default Stream<Entry<Key,Value>> stream() {
return StreamSupport.stream(this.spliterator(), false);
}
+ /**
+ * Set user data on the Scanner. This data will be added to server side information and logs for
+ * correlation.
+ *
+ * @param userData meaningful data that can be used to correlate server side information
+ * @since 3.0.0
+ */
+ void setUserData(String userData);
Review Comment:
I like `setCorrelationId(String correlationId)`. Maybe `scan` is not needed in the name since its being set on a scanner.
##########
core/src/main/java/org/apache/accumulo/core/logging/ScanUserDataLogger.java:
##########
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.logging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.event.Level;
+import org.slf4j.helpers.AbstractLogger;
+import org.slf4j.spi.LoggingEventBuilder;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+public class ScanUserDataLogger extends AbstractLogger {
Review Comment:
> I just want to prefix any msg with the userData. I don't see how creating a new method for each and every msg I want to log makes sense.
I think what @ctubbsii suggested could accomplish your goal, but would be out of scope for this PR. It would need to be its own PR, a PR to gather all logging related to the lifecycle (client and server) of scans into one place in the code. The static methods are not the goal in TabletLogger.java, but one way of achieving some goals. That code has the following two goals.
* Use logical names for logging related to functionality instead of class names. For example could use `org.apache.accumulo.scan` for all scan related logging, even if that functionality exist across many classes. Then a user could set org.apache.accumulo.scan to TRACE and redirect it to its own file to gather very detailed trace logging related to scans without overwhelming the general debug logs.
* Gather all the code related to logging for specific functionality that user may interested in to one place in the code. Then a user who wants to parse and search log messages can look at this one package in Accumulo and see what log messages are available to parse.
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ScanInfo.java:
##########
@@ -125,4 +125,11 @@ enum Type {
* @return Hints set by a scanner using {@link ScannerBase#setExecutionHints(Map)}
*/
Map<String,String> getExecutionHints();
+
+ /**
+ * @return user data set by a scanner using {@link ScannerBase#setUserData(String)}
+ */
Review Comment:
```suggestion
* @return user data set by a scanner using {@link ScannerBase#setUserData(String)}
*
* @since 3.0.0
*/
```
--
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