-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #771 from scouter-project/develop
Develop
- Loading branch information
Showing
25 changed files
with
170 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,17 +19,19 @@ | |
package reactor.core.publisher; | ||
|
||
import scouter.agent.Logger; | ||
import scouter.agent.util.Tuple; | ||
|
||
/** | ||
* @author Gun Lee ([email protected]) on 2020/08/08 | ||
*/ | ||
public class ScouterOptimizableOperatorProxy { | ||
|
||
public static final String EMPTY = ""; | ||
public static final Tuple.StringLongPair EMPTYOBJ = new Tuple.StringLongPair("", 0); | ||
public static boolean accessible = false; | ||
public static boolean first = true; | ||
|
||
public static String nameOnCheckpoint(Object candidate) { | ||
public static Tuple.StringLongPair nameOnCheckpoint(Object candidate, int maxScanDepth) { | ||
try { | ||
if (!accessible && first) { | ||
try { | ||
|
@@ -42,34 +44,47 @@ public static String nameOnCheckpoint(Object candidate) { | |
first = false; | ||
} | ||
if (!accessible) { | ||
return EMPTY; | ||
return EMPTYOBJ; | ||
} | ||
|
||
if (candidate instanceof OptimizableOperator) { | ||
OptimizableOperator<?, ?> operator = ((OptimizableOperator<?, ?>) candidate).nextOptimizableSource(); | ||
if (operator == null) { | ||
return EMPTY; | ||
OptimizableOperator<?, ?> closeAssembly = findCloseAssembly((OptimizableOperator<?, ?>) candidate, maxScanDepth); | ||
if (closeAssembly == null) { | ||
return EMPTYOBJ; | ||
} | ||
if (operator instanceof MonoOnAssembly) { | ||
FluxOnAssembly.AssemblySnapshot snapshot = ((MonoOnAssembly) operator).stacktrace; | ||
if (closeAssembly instanceof MonoOnAssembly) { | ||
FluxOnAssembly.AssemblySnapshot snapshot = ((MonoOnAssembly) closeAssembly).stacktrace; | ||
if (snapshot != null && snapshot.checkpointed) { | ||
return snapshot.cached; | ||
return new Tuple.StringLongPair(snapshot.cached, snapshot.hashCode()); | ||
} | ||
} else if (operator instanceof FluxOnAssembly) { | ||
FluxOnAssembly.AssemblySnapshot snapshot = ((FluxOnAssembly) operator).snapshotStack; | ||
} else if (closeAssembly instanceof FluxOnAssembly) { | ||
FluxOnAssembly.AssemblySnapshot snapshot = ((FluxOnAssembly) closeAssembly).snapshotStack; | ||
if (snapshot != null && snapshot.checkpointed) { | ||
return snapshot.cached; | ||
return new Tuple.StringLongPair(snapshot.cached, snapshot.hashCode()); | ||
} | ||
} | ||
} | ||
return EMPTY; | ||
return EMPTYOBJ; | ||
} catch (Throwable e) { | ||
|
||
return EMPTY; | ||
return EMPTYOBJ; | ||
} | ||
} | ||
|
||
public static void appendSources4Dump(Object candidate, StringBuilder builder) { | ||
public static OptimizableOperator<?, ?> findCloseAssembly(OptimizableOperator<?, ?> candidate, int maxScanDepth) { | ||
OptimizableOperator<?, ?> operator = candidate; | ||
for (int i = 0; i < maxScanDepth; i++) { | ||
operator = operator.nextOptimizableSource(); | ||
if (operator == null) { | ||
return null; | ||
} else if (operator instanceof MonoOnAssembly || operator instanceof FluxOnAssembly) { | ||
return operator; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public static void appendSources4Dump(Object candidate, StringBuilder builder, int maxScanDepth) { | ||
try { | ||
if (!accessible && first) { | ||
try { | ||
|
@@ -86,14 +101,14 @@ public static void appendSources4Dump(Object candidate, StringBuilder builder) { | |
} | ||
|
||
if (candidate instanceof OptimizableOperator) { | ||
OptimizableOperator<?, ?> operator = ((OptimizableOperator<?, ?>) candidate).nextOptimizableSource(); | ||
if (operator == null) { | ||
OptimizableOperator<?, ?> closeAssembly = findCloseAssembly((OptimizableOperator<?, ?>) candidate, maxScanDepth); | ||
if (closeAssembly == null) { | ||
return; | ||
} | ||
String p1 = operator.toString(); | ||
String p1 = closeAssembly.toString(); | ||
builder.append(" (<-) ").append(p1); | ||
if (p1.startsWith("checkpoint")) { | ||
OptimizableOperator<?, ?> operator2 = operator.nextOptimizableSource(); | ||
OptimizableOperator<?, ?> operator2 = closeAssembly.nextOptimizableSource(); | ||
if (operator2 != null) { | ||
builder.append(" (<-) ").append(operator2.toString()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
scouter.agent.java/src/main/java/scouter/agent/util/Tuple.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package scouter.agent.util; | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* Licensed 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 | ||
* | ||
* http://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. | ||
*/ | ||
|
||
/** | ||
* Created by Gun Lee([email protected]) on 2020/10/15 | ||
*/ | ||
public class Tuple { | ||
|
||
public static class StringLongPair { | ||
public String aString; | ||
public long aLong; | ||
|
||
public StringLongPair(String aString, long aLong) { | ||
this.aString = aString; | ||
this.aLong = aLong; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.