@@ -26,10 +26,11 @@ public class ProfilerResult {
2626 private final Map <String , Integer > dataFetcherInvocationCount = new ConcurrentHashMap <>();
2727 private final Map <String , DataFetcherType > dataFetcherTypeMap = new ConcurrentHashMap <>();
2828
29- // the key is the whole result key, not just the query path
3029 private final Map <String , DataFetcherResultType > dataFetcherResultType = new ConcurrentHashMap <>();
3130 private volatile String operationName ;
3231 private volatile String operationType ;
32+ private volatile boolean dataLoaderChainingEnabled ;
33+
3334
3435
3536 public enum DataFetcherType {
@@ -47,6 +48,11 @@ public enum DataFetcherResultType {
4748
4849 // setters are package private to prevent exposure
4950
51+ void setDataLoaderChainingEnabled (boolean dataLoaderChainingEnabled ) {
52+ this .dataLoaderChainingEnabled = dataLoaderChainingEnabled ;
53+ }
54+
55+
5056 void setDataFetcherType (String key , DataFetcherType dataFetcherType ) {
5157 dataFetcherTypeMap .putIfAbsent (key , dataFetcherType );
5258 totalDataFetcherInvocations .incrementAndGet ();
@@ -55,8 +61,8 @@ void setDataFetcherType(String key, DataFetcherType dataFetcherType) {
5561 }
5662 }
5763
58- void setDataFetcherResultType (String resultPath , DataFetcherResultType fetchedType ) {
59- dataFetcherResultType .put ( resultPath , fetchedType );
64+ void setDataFetcherResultType (String key , DataFetcherResultType fetchedType ) {
65+ dataFetcherResultType .putIfAbsent ( key , fetchedType );
6066 }
6167
6268 void incrementDataFetcherInvocationCount (String key ) {
@@ -148,9 +154,7 @@ public Map<String, DataFetcherResultType> getDataFetcherResultType() {
148154 return dataFetcherResultType ;
149155 }
150156
151-
152- @ Override
153- public String toString () {
157+ public String fullSummary () {
154158 return "ProfilerResult{" +
155159 "executionId=" + executionId +
156160 ", operation=" + operationType + ":" + operationName +
@@ -164,6 +168,29 @@ public String toString() {
164168 ", dataFetcherInvocationCount=" + dataFetcherInvocationCount +
165169 ", dataFetcherTypeMap=" + dataFetcherTypeMap +
166170 ", dataFetcherResultType=" + dataFetcherResultType +
171+ ", dataLoaderChainingEnabled=" + dataLoaderChainingEnabled +
167172 '}' ;
168173 }
174+
175+ public String shortSummary () {
176+ return "ProfilerResult{" +
177+ "executionId=" + executionId +
178+ ", operation=" + operationType + ":" + operationName +
179+ ", startTime=" + startTime +
180+ ", endTime=" + endTime +
181+ ", totalRunTime=" + (endTime - startTime ) + "(" + (endTime - startTime ) / 1_000_000 + "ms)" +
182+ ", engineTotalRunningTime=" + engineTotalRunningTime + "(" + engineTotalRunningTime / 1_000_000 + "ms)" +
183+ ", totalDataFetcherInvocations=" + totalDataFetcherInvocations +
184+ ", totalPropertyDataFetcherInvocations=" + totalPropertyDataFetcherInvocations +
185+ ", fieldsFetchedCount=" + fieldsFetched .size () +
186+ ", dataLoaderChainingEnabled=" + dataLoaderChainingEnabled +
187+ '}' ;
188+
189+
190+ }
191+
192+ @ Override
193+ public String toString () {
194+ return shortSummary ();
195+ }
169196}
0 commit comments