Permalink
Browse files

Merge with master

  • Loading branch information...
Shachar Anchelovich
Shachar Anchelovich committed Jan 29, 2013
1 parent 57fff87 commit 05af32cb5d1c275fddc6ff9a10c4f96e69e15192
@@ -39,7 +39,7 @@
/**
* Defines a non-capturing group for postgres or edb
*/
- private static final String VENDOR_LIST = JDBC_PREFIX + ":(?:postgres|edb)";
+ private static final String VENDOR_LIST = JDBC_PREFIX + ":(?:postgresql|edb)";
/**
* Defines a group for IPv6, IPv4 IPs and host names<br/>
@@ -26,7 +26,7 @@
public class PostgresSqlParserTest extends SqlParserTestImpl<PostgresSqlParser> {
public PostgresSqlParserTest () {
super(DatabaseType.POSTGRESQL, new PostgresSqlParser(),
- new SqlTestEntry("jdbc:postgres:database",
+ new SqlTestEntry("jdbc:postgresql:database",
JdbcUrlParser.DEFAULT_HOST,
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
@@ -36,7 +36,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
,
- new SqlTestEntry("jdbc:postgres:data123",
+ new SqlTestEntry("jdbc:postgresql:data123",
JdbcUrlParser.DEFAULT_HOST,
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"data123")
@@ -46,7 +46,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"data123")
,
- new SqlTestEntry("jdbc:postgres://[::1]/database",
+ new SqlTestEntry("jdbc:postgresql://[::1]/database",
"::1",
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
@@ -56,7 +56,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
,
- new SqlTestEntry("jdbc:postgres://[2001:0db8:85a3:0042:1000:8a2e:0370:7334]/database",
+ new SqlTestEntry("jdbc:postgresql://[2001:0db8:85a3:0042:1000:8a2e:0370:7334]/database",
"2001:0db8:85a3:0042:1000:8a2e:0370:7334",
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
@@ -71,7 +71,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
,
- new SqlTestEntry("jdbc:postgres://myhost/database",
+ new SqlTestEntry("jdbc:postgresql://myhost/database",
"myhost",
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
@@ -81,7 +81,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
,
- new SqlTestEntry("jdbc:postgres://10.23.197.110/database",
+ new SqlTestEntry("jdbc:postgresql://10.23.197.110/database",
"10.23.197.110",
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
@@ -96,7 +96,7 @@ public PostgresSqlParserTest () {
PostgresSqlParser.DEFAULT_CONNECTION_PORT,
"database")
,
- new SqlTestEntry("jdbc:postgres://[::1]:9090/database",
+ new SqlTestEntry("jdbc:postgresql://[::1]:9090/database",
"::1",
9090,
"database")
@@ -106,7 +106,7 @@ public PostgresSqlParserTest () {
9090,
"database")
,
- new SqlTestEntry("jdbc:postgres://[2001:0db8:85a3:0042:1000:8a2e:0370:7334]:9090/database",
+ new SqlTestEntry("jdbc:postgresql://[2001:0db8:85a3:0042:1000:8a2e:0370:7334]:9090/database",
"2001:0db8:85a3:0042:1000:8a2e:0370:7334",
9090,
"database")
@@ -121,7 +121,7 @@ public PostgresSqlParserTest () {
9090,
"database")
,
- new SqlTestEntry("jdbc:postgres://myhost:8080/database",
+ new SqlTestEntry("jdbc:postgresql://myhost:8080/database",
"myhost",
8080,
"database")
@@ -131,7 +131,7 @@ public PostgresSqlParserTest () {
8080,
"database")
,
- new SqlTestEntry("jdbc:postgres://10.23.197.110:8080/database",
+ new SqlTestEntry("jdbc:postgresql://10.23.197.110:8080/database",
"10.23.197.110",
8080,
"database")
@@ -15,15 +15,10 @@
*/
package com.springsource.insight.plugin.jms;
-import java.util.Collection;
-import java.util.Collections;
-
import com.springsource.insight.intercept.metrics.AbstractExternalResourceMetricsGenerator;
import com.springsource.insight.intercept.metrics.MetricsBag;
-import com.springsource.insight.intercept.resource.ResourceKey;
import com.springsource.insight.intercept.trace.Frame;
import com.springsource.insight.intercept.trace.Trace;
-import com.springsource.insight.util.ListUtil;
public abstract class AbstractJMSMetricsGenerator extends AbstractExternalResourceMetricsGenerator {
private static final String JMS_COUNT_SUFFIX = ":type=counter";
@@ -39,17 +34,7 @@ protected AbstractJMSMetricsGenerator(JMSPluginOperationType type) {
public final JMSPluginOperationType getJMSPluginOperationType () {
return jmsType;
}
-
- @Override
- protected Collection<MetricsBag> addExtraEndPointMetrics(Trace trace, ResourceKey endpointResourceKey, Collection<Frame> externalFrames) {
- if (ListUtil.size(externalFrames) <= 0) {
- return Collections.emptyList();
- }
-
- MetricsBag mb=MetricsBag.create(endpointResourceKey, trace.getRange());
- addCounterMetricToBag(trace, mb, createMetricKey(), externalFrames.size());
- return Collections.singletonList(mb);
- }
+
@Override
protected void addExtraFrameMetrics(Trace trace, Frame opTypeFrame, MetricsBag mb) {
@@ -21,9 +21,7 @@
import java.util.List;
import com.springsource.insight.intercept.color.ColorManager;
-import com.springsource.insight.intercept.endpoint.AbstractSingleTypeEndpointAnalyzer;
import com.springsource.insight.intercept.endpoint.EndPointAnalysis;
-import com.springsource.insight.intercept.endpoint.EndPointName;
import com.springsource.insight.intercept.metrics.AbstractMetricsGenerator;
import com.springsource.insight.intercept.operation.Operation;
import com.springsource.insight.intercept.operation.OperationMap;
@@ -37,7 +35,7 @@
import com.springsource.insight.util.ListUtil;
import com.springsource.insight.util.StringUtil;
-public abstract class AbstractJMSResourceAnalyzer extends AbstractSingleTypeEndpointAnalyzer implements ExternalResourceAnalyzer {
+public abstract class AbstractJMSResourceAnalyzer implements ExternalResourceAnalyzer {
public static final String JMS = "JMS";
/**
* The <U>static</U> score value assigned to endpoints - <B>Note:</B>
@@ -50,37 +48,20 @@
protected final boolean isIncoming;
protected AbstractJMSResourceAnalyzer(JMSPluginOperationType type, boolean incoming) {
- super(type.getOperationType());
this.operationType = type;
this.isIncoming = incoming;
}
-
- public final OperationType getOperationType() {
- return getSingleOperationType();
- }
-
- @Override
- protected int getDefaultScore(int depth) {
- return DEFAULT_SCORE;
- }
-
- @Override
- protected EndPointAnalysis makeEndPoint(Frame frame, int depth) {
- Operation op = frame.getOperation();
- String label = buildLabel(op);
- String endPointLabel = JMS + "-" + label;
- String example = getExample(label);
- EndPointName endPointName = getName(label);
-
- return new EndPointAnalysis(endPointName, endPointLabel, example, getOperationScore(op, depth), op);
- }
+
+ public OperationType getOperationType(){
+ return operationType.getOperationType();
+ }
public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) {
return locateExternalResourceName(trace, locateFrames(trace));
}
public Collection<Frame> locateFrames(Trace trace) {
- return AbstractMetricsGenerator.locateDefaultMetricsFrames(trace, getSingleOperationType());
+ return AbstractMetricsGenerator.locateDefaultMetricsFrames(trace, getOperationType());
}
public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> queueFrames) {
@@ -121,14 +102,6 @@ ExternalResourceDescriptor createExternalResourceDescriptor (ColorManager colorM
color, isIncoming);
}
- private EndPointName getName(String label) {
- return EndPointName.valueOf(label);
- }
-
- private String getExample(String label) {
- return operationType.getEndPointPrefix() + label;
- }
-
public static String buildLabel(Operation op) {
String type = op.get("destinationType", String.class);
String name = op.get("destinationName", String.class);
@@ -25,10 +25,7 @@
public class JmsPluginRuntimeDescriptor extends PluginRuntimeDescriptor {
public static final String PLUGIN_NAME = "jms";
private static final JmsPluginRuntimeDescriptor INSTANCE=new JmsPluginRuntimeDescriptor();
- private static final List<? extends EndPointAnalyzer> epAnalyzers=
- ArrayUtil.asUnmodifiableList(JMSConsumerResourceAnalyzer.getInstance(),
- JMSMessageListenerResourceAnalyzer.getInstance(),
- JMSProducerResourceAnalyzer.getInstance());
+
private JmsPluginRuntimeDescriptor () {
super();
@@ -38,11 +35,6 @@ public static final JmsPluginRuntimeDescriptor getInstance() {
return INSTANCE;
}
- @Override
- public Collection<? extends EndPointAnalyzer> getEndPointAnalyzers() {
- return epAnalyzers;
- }
-
@Override
public String getPluginName() {
return PLUGIN_NAME;
@@ -29,22 +29,10 @@ protected AbstractJMSMetricsGeneratorTest(AbstractJMSMetricsGenerator generator)
@Override
protected void validateMetricsBags(List<MetricsBag> mbs) {
- assertEquals(3, mbs.size());
+ assertEquals(2, mbs.size());
assertExternalResourceMetricBag(mbs.get(0));
assertExternalResourceMetricBag(mbs.get(1));
- List<String> keys;
- List<IDataPoint> points;
- MetricsBag mb = mbs.get(2);
- assertEquals("epName", mb.getResourceKey().getName());
- keys = mb.getMetricKeys();
- assertEquals(1, keys.size());
-
- AbstractJMSMetricsGenerator jmsGenerator=(AbstractJMSMetricsGenerator) gen;
- assertTrue(keys.get(0).equals(jmsGenerator.createMetricKey()));
- points = mb.getPoints(jmsGenerator.createMetricKey());
- assertEquals(1, points.size());
- assertEquals(2d , points.get(0).getValue(), 0);
}
private void assertExternalResourceMetricBag(MetricsBag mb) {
@@ -80,31 +80,6 @@ protected AbstractJMSResourceAnalyzerTest(AbstractJMSResourceAnalyzer analyzerIn
this.isIncoming = analyzerInstance.isIncoming;
}
- @Test
- public void testLocateEndPoint() {
- Trace trace = createValidTrace();
- String label = "Queue#test.queue";
-
- assertEndPoint(trace, label);
- }
-
- @Test
- public void testLocateEndPointTemporaryQueue() {
- Trace trace = createValidTrace(DestinationType.TemporaryQueue);
- String typeLabel = DestinationType.TemporaryQueue.getLabel();
-
- assertEndPoint(trace, typeLabel);
- }
-
- private void assertEndPoint(Trace trace, String typeLabel) {
- EndPointAnalysis analysis = analyzer.locateEndPoint(trace);
- assertNotNull("No analysis located", analysis);
- assertEquals("Mismatched example", operationType.getEndPointPrefix() + typeLabel, analysis.getExample());
- assertEquals("Mismatached endpoint", EndPointName.valueOf(typeLabel), analysis.getEndPointName());
- assertEquals("Mismatched label", "JMS-" + typeLabel, analysis.getResourceLabel());
- assertEquals("Mismatched score", AbstractJMSResourceAnalyzer.DEFAULT_SCORE, analysis.getScore());
- }
-
@Test
public void testLocateExternalResourceName() {
Trace trace = createValidTrace();
@@ -202,7 +177,7 @@ public void generateIntegrationTestsHashes() {
.put("port", INTTEST_PORT);
final Frame TEST_FRAME = new SimpleFrame(FrameId.valueOf("7365"), null, BASE_OP, new TimeRange(1L, 10L), Collections.<Frame> emptyList());
- final Trace TEST_TRACE = new Trace(ServerName.valueOf("7.3.6.5"), INTTEST_APP, new Date(System.currentTimeMillis()), TraceId.valueOf("3777347"), TEST_FRAME);
+ //final Trace TEST_TRACE = new Trace(ServerName.valueOf("7.3.6.5"), INTTEST_APP, new Date(System.currentTimeMillis()), TraceId.valueOf("3777347"), TEST_FRAME);
final ColorManager colorManager = ColorManager.getInstance();
for (DestinationType destType : DestinationType.values()) {
@@ -218,8 +193,8 @@ public void generateIntegrationTestsHashes() {
assertNotNull("No descriptor for " + destType + "[" + destName + "]", desc);
System.out.append('\t').append(destType.name()).append('[').append(destName).append("]: ").println(desc);
- EndPointAnalysis analysis = analyzer.locateEndPoint(TEST_TRACE);
- assertNotNull("No analysis for " + destType + "[" + destName + "]", analysis);
+ //EndPointAnalysis analysis = analyzer.locateEndPoint(TEST_TRACE);
+ //assertNotNull("No analysis for " + destType + "[" + destName + "]", analysis);
}
}
@@ -27,9 +27,9 @@
*
* For a trace to be analyzed, it must be of the following format:
*
- * - HttpOperation
- * ..
- * .. (arbitrary nesting)
+ * - HttpOperation
+ * ..
+ * .. (arbitrary nesting)
* .. ControllerMethodOperation
*/
public class ControllerEndPointAnalyzer extends AbstractSpringWebEndPointAnalyzer {
@@ -43,23 +43,29 @@
* above that of a servlet and/or queue operation
*/
public static final int LEGACY_SCORE=EndPointAnalysis.CEILING_LAYER_SCORE + 1;
+ public static final int DEFAULT_CONTROLLER_SCORE = 0;
private static final ControllerEndPointAnalyzer INSTANCE=new ControllerEndPointAnalyzer();
private ControllerEndPointAnalyzer () {
- super(CONTROLLER_METHOD_TYPE);
+ super(CONTROLLER_METHOD_TYPE);
}
public static final ControllerEndPointAnalyzer getInstance() {
- return INSTANCE;
+ return INSTANCE;
}
@Override
protected int getOperationScore(Operation op, int depth) {
- Boolean legacyFlag=op.get(LEGACY_PROPNAME, Boolean.class);
- if ((legacyFlag != null) && legacyFlag.booleanValue()) {
- return LEGACY_SCORE;
- } else {
- return super.getOperationScore(op, depth);
- }
+ Boolean legacyFlag=op.get(LEGACY_PROPNAME, Boolean.class);
+ if ((legacyFlag != null) && legacyFlag.booleanValue()) {
+ return LEGACY_SCORE;
+ } else {
+ return super.getOperationScore(op, depth);
+ }
+ }
+
+ @Override
+ protected int getDefaultScore(int depth) {
+ return DEFAULT_CONTROLLER_SCORE;
}
}
Oops, something went wrong.

0 comments on commit 05af32c

Please sign in to comment.