You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2020/09/25 18:52:06 UTC
[tinkerpop] 01/01: TINKERPOP-2364 Hide injected profile() steps in
metrics output
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch TINKERPOP-2364
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 7cc34759983f0b5af981415ea76f5ba0ad2e503a
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri Sep 25 14:51:03 2020 -0400
TINKERPOP-2364 Hide injected profile() steps in metrics output
---
CHANGELOG.asciidoc | 1 +
.../tinkerpop/gremlin/structure/util/StringFactory.java | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 7b524fe..df73db5 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
[[release-3-4-9]]
=== TinkerPop 3.4.9 (Release Date: NOT OFFICIALLY RELEASED YET)
+* Modified the text of `profile()` output to hide step instances injected for purpose of collecting metrics.
* Bumped to Jackson 2.11.x.
* Bumped Netty 4.1.52.
* Established a default read and write timeout for the `TornadoTransport` in Python, allowing it to be configurable.
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
index 814bc09..038853a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
@@ -34,6 +34,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalRing;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -242,7 +244,14 @@ public final class StringFactory {
}
public static String traversalString(final Traversal.Admin<?, ?> traversal) {
- return traversal.getSteps().toString();
+ // generally speaking the need to show the profile steps in a toString() is limited to TinkerPop developers.
+ // most users would be confused by the output to profile as these steps are proliferated about the traversal
+ // and are internal collectors of data not the actual steps the user specified. the traversal profile output
+ // looks cleaner without this cruft and hopefully the lack of it's existence should not confuse TinkerPop
+ // developers trying to debug things. when You, yes, you future Stephen, find this comment....sorry?
+ return traversal.getSteps().stream().filter(
+ s -> !(s instanceof ProfileStep) && !(s instanceof ProfileSideEffectStep)).
+ collect(Collectors.toList()).toString();
}
public static String storageString(final String internalString) {