diff --git a/Jenkinsfile b/Jenkinsfile
index 621ddbe..f5ac4f2 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,7 +36,7 @@ podRetention: never()) {
container('maven') {
sh """
cd sematext-agent-java
- mvn --batch-mode clean install -DskipTests
+ mvn --batch-mode clean install -DskipTests -e
"""
}
}
diff --git a/pom.xml b/pom.xml
index 808be3a..99ddca9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,13 +10,13 @@
UTF-8
- 1.6
- 1.6
- 1.6
- 1.6
+ 1.8
+ 1.8
+ 1.8
+ 1.8
1.1.1
4.13.1
- 2.17.1
+ 2.17.2
1.4.7
checkstyle.xml
@@ -118,9 +118,6 @@
spm-transfer
spm-monitor-redis
spm-monitor-storm
- spm-tracing-agent
- spm-tracing-testing
- spm-tracing-agent-impl
spm-monitor-haproxy
@@ -135,7 +132,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.1
+ 2.17.2
compile
diff --git a/spm-client-common-libs-parent/pom.xml b/spm-client-common-libs-parent/pom.xml
index 3ccaa12..237de5d 100644
--- a/spm-client-common-libs-parent/pom.xml
+++ b/spm-client-common-libs-parent/pom.xml
@@ -10,8 +10,6 @@
provided
- compile
- compile
compile
@@ -35,26 +33,6 @@
-
- com.sematext.spm
- spm-tracing-agent
- ${project.version}
- ${tracing.agent.lib.scope}
-
-
-
- com.sematext.spm
- spm-tracing-agent-impl
- ${project.version}
- ${tracing.agent.impl.lib.scope}
-
-
- com.sematext.spm
- spm-thrift-data
-
-
-
-
com.sematext.spm
spm-monitor-utils
@@ -314,7 +292,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-client-common-libs/pom.xml b/spm-client-common-libs/pom.xml
index ce451a6..6f3449b 100644
--- a/spm-client-common-libs/pom.xml
+++ b/spm-client-common-libs/pom.xml
@@ -11,8 +11,6 @@
compile
- provided
- provided
provided
@@ -25,7 +23,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-generic/pom.xml b/spm-monitor-generic/pom.xml
index 8918483..c28b375 100644
--- a/spm-monitor-generic/pom.xml
+++ b/spm-monitor-generic/pom.xml
@@ -63,7 +63,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-generic/src/main/java/com/sematext/spm/client/GenericStatsCollectorsFactory.java b/spm-monitor-generic/src/main/java/com/sematext/spm/client/GenericStatsCollectorsFactory.java
index 0647edd..c685331 100644
--- a/spm-monitor-generic/src/main/java/com/sematext/spm/client/GenericStatsCollectorsFactory.java
+++ b/spm-monitor-generic/src/main/java/com/sematext/spm/client/GenericStatsCollectorsFactory.java
@@ -74,19 +74,17 @@
import com.sematext.spm.client.jvm.JvmNotifBasedGcStatsCollector;
import com.sematext.spm.client.observation.AttributeObservation;
import com.sematext.spm.client.observation.ObservationBean;
-import com.sematext.spm.client.tracing.TracingMonitorConfigurator;
import com.sematext.spm.client.util.CollectionUtils.FunctionT;
import com.sematext.spm.client.yaml.YamlConfigLoader;
public class GenericStatsCollectorsFactory extends StatsCollectorsFactory> {
private static final Log LOG = LogFactory.getLog(GenericStatsCollectorsFactory.class);
- private final TracingMonitorConfigurator tracingConf = new TracingMonitorConfigurator();
public static final Cache> EXISTING_COLLECTORS_MAP = CacheBuilder.newBuilder()
.maximumSize(300000)
.expireAfterAccess(30, TimeUnit.MINUTES)
.build();
-
+
private static final int MAX_PCTLS_DEFINITIONS = 10;
private static int CURRENT_COUNT_PCTLS_DEFINITIONS = 0;
@@ -126,23 +124,6 @@ public Collection extends StatsCollector>> create(Properties monitorProperti
.getProperty("SPM_MONITOR_SEND_JVM_NAME", "false")
.trim()).trim()));
- if (MonitorUtil.MONITOR_RUNTIME_SETUP_JAVAAGENT.get()) {
- boolean tracingEnabled = "true".equalsIgnoreCase(MonitorUtil.stripQuotes(monitorProperties
- .getProperty("SPM_MONITOR_TRACING_ENABLED", "false")
- .trim()).trim());
-
- if (tracingEnabled) {
- try {
- // always configure, it collects only if right settings are present though (handles it internally)
- tracingConf
- .configure(monitorConfig, currentCollectors, collectors, Serializer.INFLUX, appToken, subType, jvmName);
- } catch (Throwable thr) {
- // don't propagate, just continue
- LOG.error("Error while configuring tracing conf", thr);
- }
- }
- }
-
CURRENT_COUNT_PCTLS_DEFINITIONS = 0;
LOG.info("Loading configs for collectors: " + types);
@@ -167,7 +148,7 @@ public JvmNotifBasedGcStatsCollector apply(String id) {
}
collectors = groupCollectorsByTags(collectors, monitorConfig);
-
+
// as last collector add HeartbeatCollector
updateCollector(currentCollectors, collectors, HeartbeatStatsCollector.class, jvmName,
new FunctionT() {
@@ -176,7 +157,7 @@ public HeartbeatStatsCollector apply(String id) {
return new HeartbeatStatsCollector(Serializer.INFLUX, appToken, jvmName, subType);
}
});
-
+
int collectorsCount = StatsCollector.getCollectorsCount(collectors);
if (collectorsCount < 50) {
LOG.info("Created " + collectors.size() + " collectors : " + collectors);
@@ -657,7 +638,7 @@ private StatsExtractorConfig> getStatsExtractorConfig(File configFile, String
// replace all monitor properties placeholders with real values from properties file
// NOTE: assumption is that it is ok if behavior will be undefined when two props have the same variants (ST_PROP
- // and SPM_PROP) because order of execution would affect the end result
+ // and SPM_PROP) because order of execution would affect the end result
for (Object property : monitorProperties.keySet()) {
String propertyValue = MonitorUtil.stripQuotes(monitorProperties.getProperty(String.valueOf(property), "").trim())
.trim();
@@ -791,7 +772,7 @@ private List> groupCollectorsByTags(List> co
}
}
- // check if everything resolved too
+ // check if everything resolved too
if (!col.getGenericExtractor().isAllConfigTagsResolved()) {
nonGroupableCollectors.add(sc);
} else {
diff --git a/spm-monitor-haproxy/pom.xml b/spm-monitor-haproxy/pom.xml
index bd49f84..278de72 100644
--- a/spm-monitor-haproxy/pom.xml
+++ b/spm-monitor-haproxy/pom.xml
@@ -43,7 +43,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-parent/pom.xml b/spm-monitor-parent/pom.xml
index d7867ae..d911cdc 100644
--- a/spm-monitor-parent/pom.xml
+++ b/spm-monitor-parent/pom.xml
@@ -29,7 +29,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
@@ -59,7 +59,6 @@
com.sematext.spm:spm-monitor-utils
- com.sematext.spm:spm-tracing-agent
com.sematext.spm:spm-monitor-starter
org.javassist:javassist
org.eclipse.collections:eclipse-collections-api
@@ -86,14 +85,13 @@
com.sematext.spm:spm-monitor-utils
- com.sematext.spm:spm-tracing-agent
com.sematext.spm:spm-monitor-starter
org.javassist:javassist
org.eclipse.collections:eclipse-collections-api
org.eclipse.collections:eclipse-collections
- com.sematext.spm:${artifactId}
+ com.sematext.spm:${project.artifactId}
org.apache.thrift:libthrift
org.slf4j:slf4j-api
org.slf4j:slf4j-log4j12
@@ -102,15 +100,6 @@
-
- com.sematext.spm:spm-tracing-agent
-
- org/**
- com/sematext/spm/client/tracing/thrift/**
- com/sematext/spm/client/monitor/thrift/**
- com/sematext/spm/client/snap/**
-
-
com.sematext.spm:spm-monitor-utils
@@ -134,6 +123,21 @@
org.apache.maven.plugins
maven-assembly-plugin
2.4
+
+
+ /../spm-monitor-parent/src/main/assembly/dist.xml
+
+
+
+ com.sematext.spm.client.MonitorAgentWrapper
+ true
+
+ ${project.version}
+ development
+ ${project.url}
+
+
+
create-distro
@@ -141,22 +145,6 @@
single
-
-
- /../spm-monitor-parent/src/main/assembly/monitor-with-tracing-agent-dist.xml
-
-
-
- com.sematext.spm.client.MonitorAgentWrapper
- true
-
-
- ${project.version}
- development
- ${project.url}
-
-
-
diff --git a/spm-monitor-parent/src/main/assembly/dist.xml b/spm-monitor-parent/src/main/assembly/dist.xml
index 8c292e1..08aaaf4 100644
--- a/spm-monitor-parent/src/main/assembly/dist.xml
+++ b/spm-monitor-parent/src/main/assembly/dist.xml
@@ -30,7 +30,7 @@
monitor-libs
- com.sematext.spm:${artifactId}
+ com.sematext.spm:${project.artifactId}
diff --git a/spm-monitor-parent/src/main/assembly/monitor-with-tracing-agent-dist.xml b/spm-monitor-parent/src/main/assembly/monitor-with-tracing-agent-dist.xml
deleted file mode 100644
index 29fd5ee..0000000
--- a/spm-monitor-parent/src/main/assembly/monitor-with-tracing-agent-dist.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
- withdeps
-
- jar
-
-
-
-
- true
- true
- true
- true
- runtime
- 0755
- 0755
- /
-
-
- com.sematext.spm:${artifactId}:jar:shaded-bootstrap:*
-
-
-
-
- true
- true
- false
- true
-
- false
- runtime
- 0644
- 0755
- monitor-libs
-
-
- com.sematext.spm:${artifactId}:jar:shaded-impl:*
-
-
-
-
- /
-
\ No newline at end of file
diff --git a/spm-monitor-redis/pom.xml b/spm-monitor-redis/pom.xml
index 34c69da..1100598 100644
--- a/spm-monitor-redis/pom.xml
+++ b/spm-monitor-redis/pom.xml
@@ -58,7 +58,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-starter/pom.xml b/spm-monitor-starter/pom.xml
index 771bdff..3592fcc 100644
--- a/spm-monitor-starter/pom.xml
+++ b/spm-monitor-starter/pom.xml
@@ -23,7 +23,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-storm/pom.xml b/spm-monitor-storm/pom.xml
index e02c511..d59848b 100644
--- a/spm-monitor-storm/pom.xml
+++ b/spm-monitor-storm/pom.xml
@@ -86,7 +86,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
@@ -116,8 +116,6 @@
com.sematext.spm:spm-monitor-utils
- com.sematext.spm:spm-tracing-agent
- com.sematext.spm:spm-tracing-agent-impl
com.sematext.spm:spm-monitor-starter
org.javassist:javassist
org.eclipse.collections:eclipse-collections-api
diff --git a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormNimbusStatsCollectorsFactory.java b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormNimbusStatsCollectorsFactory.java
index cc315d2..e44bb09 100644
--- a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormNimbusStatsCollectorsFactory.java
+++ b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormNimbusStatsCollectorsFactory.java
@@ -36,14 +36,12 @@
import com.sematext.spm.client.StatsCollectorBadConfigurationException;
import com.sematext.spm.client.StatsCollectorsFactory;
import com.sematext.spm.client.jmx.configurator.JvmJmxBasedMonitorConfigurator;
-import com.sematext.spm.client.tracing.TracingMonitorConfigurator;
import com.sematext.spm.client.util.CollectionUtils.FunctionT;
public class StormNimbusStatsCollectorsFactory extends StatsCollectorsFactory> {
private static final Log LOG = LogFactory.getLog(StormNimbusStatsCollectorsFactory.class);
private final JvmJmxBasedMonitorConfigurator jvmJmxConf = new JvmJmxBasedMonitorConfigurator();
- private final TracingMonitorConfigurator tracingConf = new TracingMonitorConfigurator();
@Override
public Collection extends StatsCollector>> create(Properties monitorProperties,
@@ -60,23 +58,6 @@ public Collection extends StatsCollector>> create(Properties monitorProperti
try {
jvmJmxConf.configure(Collections.EMPTY_MAP, monitorConfig, currentCollectors, collectors);
- if (MonitorUtil.MONITOR_RUNTIME_SETUP_JAVAAGENT.get()) {
- boolean tracingEnabled = "true".equalsIgnoreCase(MonitorUtil.stripQuotes(monitorProperties
- .getProperty("SPM_MONITOR_TRACING_ENABLED", "false")
- .trim()).trim());
-
- if (tracingEnabled) {
- try {
- // always configure, it collects only if right settings are present though (handles it internally)
- tracingConf
- .configure(monitorConfig, currentCollectors, collectors, Serializer.INFLUX, appToken, subType, jvmName);
- } catch (Throwable thr) {
- // don't propagate, just continue
- LOG.error("Error while configuring tracing conf", thr);
- }
- }
- }
-
// as last collector add HeartbeatCollector
updateCollector(currentCollectors, collectors, HeartbeatStatsCollector.class, jvmName,
new FunctionT() {
diff --git a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormSupervisorStatsCollectorsFactory.java b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormSupervisorStatsCollectorsFactory.java
index 2eeb772..2a08bc2 100644
--- a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormSupervisorStatsCollectorsFactory.java
+++ b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormSupervisorStatsCollectorsFactory.java
@@ -36,13 +36,11 @@
import com.sematext.spm.client.StatsCollectorBadConfigurationException;
import com.sematext.spm.client.StatsCollectorsFactory;
import com.sematext.spm.client.jmx.configurator.JvmJmxBasedMonitorConfigurator;
-import com.sematext.spm.client.tracing.TracingMonitorConfigurator;
import com.sematext.spm.client.util.CollectionUtils.FunctionT;
public class StormSupervisorStatsCollectorsFactory extends StatsCollectorsFactory> {
private static final Log LOG = LogFactory.getLog(StormSupervisorStatsCollectorsFactory.class);
private final JvmJmxBasedMonitorConfigurator jvmJmxConf = new JvmJmxBasedMonitorConfigurator();
- private final TracingMonitorConfigurator tracingConf = new TracingMonitorConfigurator();
public Collection extends StatsCollector>> create(Properties monitorProperties,
List extends StatsCollector>> currentCollectors,
@@ -58,23 +56,6 @@ public Collection extends StatsCollector>> create(Properties monitorProperti
// first read available JVM data from Jmx
jvmJmxConf.configure(Collections.EMPTY_MAP, monitorConfig, currentCollectors, collectors);
- if (MonitorUtil.MONITOR_RUNTIME_SETUP_JAVAAGENT.get()) {
- boolean tracingEnabled = "true".equalsIgnoreCase(MonitorUtil.stripQuotes(monitorProperties
- .getProperty("SPM_MONITOR_TRACING_ENABLED", "false")
- .trim()).trim());
-
- if (tracingEnabled) {
- try {
- // always configure, it collects only if right settings are present though (handles it internally)
- tracingConf
- .configure(monitorConfig, currentCollectors, collectors, Serializer.INFLUX, appToken, subType, jvmName);
- } catch (Throwable thr) {
- // don't propagate, just continue
- LOG.error("Error while configuring tracing conf", thr);
- }
- }
- }
-
// as last collector add HeartbeatCollector
updateCollector(currentCollectors, collectors, HeartbeatStatsCollector.class, jvmName,
new FunctionT() {
diff --git a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormWorkerStatsCollectorsFactory.java b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormWorkerStatsCollectorsFactory.java
index 7a227c7..b62ac1d 100644
--- a/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormWorkerStatsCollectorsFactory.java
+++ b/spm-monitor-storm/src/main/java/com/sematext/spm/client/storm/StormWorkerStatsCollectorsFactory.java
@@ -36,13 +36,11 @@
import com.sematext.spm.client.StatsCollectorBadConfigurationException;
import com.sematext.spm.client.StatsCollectorsFactory;
import com.sematext.spm.client.jmx.configurator.JvmJmxBasedMonitorConfigurator;
-import com.sematext.spm.client.tracing.TracingMonitorConfigurator;
import com.sematext.spm.client.util.CollectionUtils.FunctionT;
public class StormWorkerStatsCollectorsFactory extends StatsCollectorsFactory> {
private static final Log LOG = LogFactory.getLog(StormWorkerStatsCollectorsFactory.class);
private final JvmJmxBasedMonitorConfigurator jvmJmxConf = new JvmJmxBasedMonitorConfigurator();
- private final TracingMonitorConfigurator tracingConf = new TracingMonitorConfigurator();
public Collection extends StatsCollector>> create(Properties monitorProperties,
List extends StatsCollector>> currentCollectors,
@@ -58,23 +56,6 @@ public Collection extends StatsCollector>> create(Properties monitorProperti
// first read available JVM data from Jmx
jvmJmxConf.configure(Collections.EMPTY_MAP, monitorConfig, currentCollectors, collectors);
- if (MonitorUtil.MONITOR_RUNTIME_SETUP_JAVAAGENT.get()) {
- boolean tracingEnabled = "true".equalsIgnoreCase(MonitorUtil.stripQuotes(monitorProperties
- .getProperty("SPM_MONITOR_TRACING_ENABLED", "false")
- .trim()).trim());
-
- if (tracingEnabled) {
- try {
- // always configure, it collects only if right settings are present though (handles it internally)
- tracingConf
- .configure(monitorConfig, currentCollectors, collectors, Serializer.INFLUX, appToken, subType, jvmName);
- } catch (Throwable thr) {
- // don't propagate, just continue
- LOG.error("Error while configuring tracing conf", thr);
- }
- }
- }
-
// as last collector add HeartbeatCollector
updateCollector(currentCollectors, collectors, HeartbeatStatsCollector.class, jvmName,
new FunctionT() {
diff --git a/spm-monitor-utils/pom.xml b/spm-monitor-utils/pom.xml
index 9fbc491..645d494 100644
--- a/spm-monitor-utils/pom.xml
+++ b/spm-monitor-utils/pom.xml
@@ -225,7 +225,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor-utils/src/main/java/com/sematext/spm/client/monitor/SourceConfigProperties.java b/spm-monitor-utils/src/main/java/com/sematext/spm/client/monitor/SourceConfigProperties.java
index c69f833..32e7867 100644
--- a/spm-monitor-utils/src/main/java/com/sematext/spm/client/monitor/SourceConfigProperties.java
+++ b/spm-monitor-utils/src/main/java/com/sematext/spm/client/monitor/SourceConfigProperties.java
@@ -23,6 +23,5 @@ public final class SourceConfigProperties {
private SourceConfigProperties() {
}
- public static final String SPM_MONITOR_TRACING_ENABLED = "SPM_MONITOR_TRACING_ENABLED";
public static final String SPM_MONITOR_PROFILER_DISABLED = "SPM_MONITOR_PROFILER_DISABLED";
}
diff --git a/spm-monitor-utils/src/main/java/com/sematext/spm/client/util/ThriftUtils.java b/spm-monitor-utils/src/main/java/com/sematext/spm/client/util/ThriftUtils.java
new file mode 100644
index 0000000..35cd727
--- /dev/null
+++ b/spm-monitor-utils/src/main/java/com/sematext/spm/client/util/ThriftUtils.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to Sematext Group, Inc
+ *
+ * See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Sematext Group, Inc 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
+ *
+ * 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.
+ */
+
+package com.sematext.spm.client.util;
+
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.transport.TTransportException;
+
+public final class ThriftUtils {
+ private ThriftUtils() {
+ }
+
+ private static final ThreadLocal BINARY_PROTOCOL_SERIALIZER = new ThreadLocal() {
+ @Override
+ protected TSerializer initialValue() {
+ try {
+ return new TSerializer(new TBinaryProtocol.Factory());
+ } catch (Exception tte) {
+ throw new RuntimeException(tte);
+ }
+ }
+ };
+
+ public static TSerializer binaryProtocolSerializer() {
+ return BINARY_PROTOCOL_SERIALIZER.get();
+ }
+
+ private static final ThreadLocal THRIFT_DESERIALIZER = new ThreadLocal() {
+ @Override
+ protected TDeserializer initialValue() {
+ try {
+ return new TDeserializer(new TBinaryProtocol.Factory());
+ } catch (Exception tte) {
+ throw new RuntimeException(tte);
+ }
+ }
+ };
+
+ public static TDeserializer binaryProtocolDeserializer() {
+ return THRIFT_DESERIALIZER.get();
+ }
+
+}
diff --git a/spm-monitor/pom.xml b/spm-monitor/pom.xml
index 93f0a2f..0584687 100644
--- a/spm-monitor/pom.xml
+++ b/spm-monitor/pom.xml
@@ -55,7 +55,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/MonitorAgent.java b/spm-monitor/src/main/java/com/sematext/spm/client/MonitorAgent.java
index 29ed873..1ae4690 100644
--- a/spm-monitor/src/main/java/com/sematext/spm/client/MonitorAgent.java
+++ b/spm-monitor/src/main/java/com/sematext/spm/client/MonitorAgent.java
@@ -32,7 +32,6 @@
import com.sematext.spm.client.jmx.JmxServiceContext;
import com.sematext.spm.client.monitor.SourceConfigProperties;
import com.sematext.spm.client.sender.SenderUtil;
-import com.sematext.spm.client.tracing.agent.impl.AgentInitializer;
import com.sematext.spm.client.util.PropertiesReader;
/**
@@ -208,24 +207,6 @@ public static void startMonitoring(String agentArgs, Instrumentation inst) throw
Sender.initialize(monitorArgs.getToken(), monitorArgs.getJvmName(), monitorArgs
.getSubType(), MonitorType.APPLICATION);
- try {
- boolean tracingEnabled = "true".equalsIgnoreCase(props.get(SourceConfigProperties.SPM_MONITOR_TRACING_ENABLED));
- if (tracingEnabled) {
- log.info("Tracing enabled for " + propsFile.getName());
- } else {
- log.info("Tracing disabled for " + propsFile.getName());
- }
-
- // can't initialize tracing for any kind of standalone monitor
- if (inst == null) {
- log.info("Tracing permanently disabled for standalone monitor for " + propsFile.getName());
- } else {
- AgentInitializer.init(agentArgs, inst, tracingEnabled, false);
- }
- } catch (Exception e) {
- throw new ConfigurationFailedException("Can't initialize tracing agent for " + propsFile.getName(), e);
- }
-
final MonitorConfig metricsConfig = getMonitorConfig(null, monitorArgs, inst, DataFormat.PLAIN_TEXT, processOrdinal);
if (metricsConfig == null) {
return;
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/BasicCommandPollingSetup.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/BasicCommandPollingSetup.java
index ee8485d..455ecb9 100644
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/BasicCommandPollingSetup.java
+++ b/spm-monitor/src/main/java/com/sematext/spm/client/command/BasicCommandPollingSetup.java
@@ -188,9 +188,6 @@ private void setupInternal(String agentArgs, MonitorConfig monitorConfig) {
.addHandler(TCommandType.PING, new PingCommandHandler())
.addHandler(TCommandType.PROFILE, new ProfileCommandHandler(ctx))
.addHandler(TCommandType.GET_INSTRUMENTED_METHODS, new GetInstrumentedMethodsHandler())
- .addHandler(TCommandType.ENABLE_TRACING, new EnableTracingHandler())
- .addHandler(TCommandType.DISABLE_TRACING, new DisableTracingHandler())
- .addHandler(TCommandType.IS_TRACING_ENABLED, new IsTracingEnabledHandler())
.addHandler(TCommandType.UPDATE_INSTRUMENTATION_SETTINGS, new UpdateInstrumentationSettingsHandler())
.proxy(senderConfig.proxyHost, senderConfig.proxyPort, senderConfig.proxyUsername, senderConfig.proxyPassword)
.build();
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/CancellableCommandHandler.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/CancellableCommandHandler.java
index bb0b7ed..cc558b6 100644
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/CancellableCommandHandler.java
+++ b/spm-monitor/src/main/java/com/sematext/spm/client/command/CancellableCommandHandler.java
@@ -19,6 +19,7 @@
*/
package com.sematext.spm.client.command;
+import com.sematext.spm.client.util.ThriftUtils;
import org.apache.thrift.TException;
import java.util.Map;
@@ -31,7 +32,6 @@
import com.sematext.spm.client.monitor.thrift.TCommandResponse;
import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
import com.sematext.spm.client.monitor.thrift.TCommandType;
-import com.sematext.spm.client.tracing.agent.impl.ThriftUtils;
import com.sematext.spm.client.util.Preconditions;
public final class CancellableCommandHandler {
@@ -69,12 +69,12 @@ public void handle(final TCommand command) {
if (command.getType() == TCommandType.CANCEL) {
final TCancelRequest request = new TCancelRequest();
+
try {
ThriftUtils.binaryProtocolDeserializer().deserialize(request, command.getRequest());
} catch (TException e) {
throw new IllegalStateException("Can't deserialize cancel command.", e);
}
-
LOG.info("Got cancel request for command " + request.getId() + ".");
final Cancellable cancellable = cancellableHandlers.get(request.getId());
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/DisableTracingHandler.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/DisableTracingHandler.java
deleted file mode 100644
index 73e9b41..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/DisableTracingHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.command;
-
-import com.sematext.spm.client.monitor.thrift.TCommand;
-import com.sematext.spm.client.monitor.thrift.TCommandResponse;
-import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-
-public class DisableTracingHandler implements CommandHandler {
- @Override
- public Cancellable handle(TCommand command, ResponseCallback callback) {
- final TCommandResponseStatus status = ServiceLocator.getTracingAgentControl().disable() ?
- TCommandResponseStatus.SUCCESS
- :
- TCommandResponseStatus.FAILURE;
-
- callback.respond(new TCommandResponse(status, command.getId()));
-
- return null;
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/EnableTracingHandler.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/EnableTracingHandler.java
deleted file mode 100644
index f3aa664..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/EnableTracingHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.command;
-
-import com.sematext.spm.client.monitor.thrift.TCommand;
-import com.sematext.spm.client.monitor.thrift.TCommandResponse;
-import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-
-public class EnableTracingHandler implements CommandHandler {
- @Override
- public Cancellable handle(TCommand command, ResponseCallback callback) {
- final TCommandResponseStatus status = ServiceLocator.getTracingAgentControl().enable() ?
- TCommandResponseStatus.SUCCESS
- :
- TCommandResponseStatus.FAILURE;
-
- callback.respond(new TCommandResponse(status, command.getId()));
- return null;
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/IsTracingEnabledHandler.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/IsTracingEnabledHandler.java
deleted file mode 100644
index 35bab35..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/IsTracingEnabledHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.command;
-
-import org.apache.thrift.TException;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.monitor.thrift.TCommand;
-import com.sematext.spm.client.monitor.thrift.TCommandResponse;
-import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
-import com.sematext.spm.client.monitor.thrift.TIsTracingEnabledResponse;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.impl.ThriftUtils;
-
-public final class IsTracingEnabledHandler implements CommandHandler {
-
- private final Log log = LogFactory.getLog(IsTracingEnabledHandler.class);
-
- @Override
- public Cancellable handle(TCommand command, ResponseCallback callback) {
- try {
- final TIsTracingEnabledResponse isEnabledResp = new TIsTracingEnabledResponse(ServiceLocator
- .getTracingAgentControl()
- .isEnabled());
- byte[] serializedIsEnabledResp = ThriftUtils.binaryProtocolSerializer().serialize(isEnabledResp);
- final TCommandResponse resp = new TCommandResponse(TCommandResponseStatus.SUCCESS, command.getId());
- resp.setResponse(serializedIsEnabledResp);
- callback.respond(resp);
- } catch (TException e) {
- log.error("Can't serialize response.", e);
- final TCommandResponse resp = new TCommandResponse(TCommandResponseStatus.SUCCESS, command.getId());
- resp.setFailureReason("Can't serialize response");
- callback.respond(resp);
- }
- return null;
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/command/UpdateInstrumentationSettingsHandler.java b/spm-monitor/src/main/java/com/sematext/spm/client/command/UpdateInstrumentationSettingsHandler.java
index 72028fc..0cf985e 100644
--- a/spm-monitor/src/main/java/com/sematext/spm/client/command/UpdateInstrumentationSettingsHandler.java
+++ b/spm-monitor/src/main/java/com/sematext/spm/client/command/UpdateInstrumentationSettingsHandler.java
@@ -19,6 +19,7 @@
*/
package com.sematext.spm.client.command;
+import com.sematext.spm.client.util.ThriftUtils;
import org.apache.thrift.TException;
import java.util.HashMap;
@@ -31,9 +32,6 @@
import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
import com.sematext.spm.client.monitor.thrift.TInstrumentedMethodState;
import com.sematext.spm.client.monitor.thrift.TUpdateInstrumentationSettings;
-import com.sematext.spm.client.tracing.agent.TracingAgentControl;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.impl.ThriftUtils;
import com.sematext.spm.client.unlogger.dynamic.BehaviorDescription;
import com.sematext.spm.client.unlogger.dynamic.BehaviorState;
@@ -53,7 +51,6 @@ public Cancellable handle(TCommand command, ResponseCallback callback) {
callback.respond(response);
return null;
}
-
final Map state = new HashMap();
try {
@@ -64,24 +61,13 @@ public Cancellable handle(TCommand command, ResponseCallback callback) {
state.put(behDescription, behState);
}
- final TracingAgentControl agentControl = ServiceLocator.getTracingAgentControl();
-
- agentControl.getInstrumentationSettings().update(state);
- final boolean isStateApplied = agentControl.applyInstrumentationSettings();
-
- log.info(
- "Instrumentation settings " + (isStateApplied ? "Successfully applied" : "Not applied - tracing disabled"));
+ log.info("Instrumentation settings Not applied - tracing disabled");
final TCommandResponse response = new TCommandResponse();
- if (isStateApplied) {
- response.setStatus(TCommandResponseStatus.SUCCESS);
- response.setId(command.getId());
- } else {
- response.setStatus(TCommandResponseStatus.FAILURE);
- response.setId(command.getId());
- response.setFailureReason("Tracing is disabled");
- }
+ response.setStatus(TCommandResponseStatus.FAILURE);
+ response.setId(command.getId());
+ response.setFailureReason("Tracing is disabled");
callback.respond(response);
return null;
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingCrossAppCallStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingCrossAppCallStatsCollector.java
deleted file mode 100644
index 2d60c07..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingCrossAppCallStatsCollector.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.tracing.agent.stats.CrossAppCall;
-
-public class TracingCrossAppCallStatsCollector extends MultipleStatsCollector {
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- public TracingCrossAppCallStatsCollector(Serializer serializer, String appToken, String jvmName, String subType) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().crossAppCalls();
- }
-
- @Override
- protected void appendStats(CrossAppCall call, StatValues statValues) {
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("cross.app.call.src.duration", call.srcDuration());
- statValues.getMetrics().put("cross.app.call.dst.duration", call.dstDuration());
- statValues.getMetrics().put("cross.app.calls.count", call.callsCount());
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.cross.app.call.dst.token", call.dstToken());
- statValues.getTags().put("tracing.cross.app.call.dst.host", call.dstHostname());
- statValues.getTags().put("tracing.cross.app.call.tag", call.tag());
- statValues.getTags().put("tracing.cross.app.call.request", call.request());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
- }
-
- @Override
- public String getName() {
- return "tracing-cross-app-call";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return TracingCrossAppCallStatsCollector.class.getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingDatabaseOperationStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingDatabaseOperationStatsCollector.java
deleted file mode 100644
index 8884fd6..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingDatabaseOperationStatsCollector.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.tracing.agent.stats.DatabaseOperationMetric;
-
-public class TracingDatabaseOperationStatsCollector extends MultipleStatsCollector {
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- public TracingDatabaseOperationStatsCollector(Serializer serializer, String appToken, String jvmName,
- String subType) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().databaseOperationMetrics();
- }
-
- @Override
- protected void appendStats(DatabaseOperationMetric s, StatValues statValues) {
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("database.ops", s.count());
- statValues.getMetrics().put("database.ops.time", s.duration());
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.db.operation.db", s.getId().getDatabase());
- statValues.getTags().put("tracing.db.operation.operation", s.getId().getOperation());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
- }
-
- @Override
- public String getName() {
- return "tracing-database-operation";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return TracingDatabaseOperationStatsCollector.class.getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingExternalCallStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingExternalCallStatsCollector.java
deleted file mode 100644
index fef9642..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingExternalCallStatsCollector.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.tracing.agent.stats.ExternalCall;
-
-public class TracingExternalCallStatsCollector extends MultipleStatsCollector {
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- public TracingExternalCallStatsCollector(Serializer serializer, String appToken, String jvmName, String subType) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().externalCalls();
- }
-
- @Override
- protected void appendStats(ExternalCall call, StatValues statValues) {
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("external.call.duration", call.duration());
- statValues.getMetrics().put("external.calls.count", call.callsCount());
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.external.call.destination", call.dstHostname());
- statValues.getTags().put("tracing.external.call.tag", call.tag());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
- }
-
- @Override
- public String getName() {
- return "tracing-external-call";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return TracingExternalCallStatsCollector.class.getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingMonitorConfigurator.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingMonitorConfigurator.java
deleted file mode 100644
index 823bfa2..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingMonitorConfigurator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import java.util.List;
-
-import com.sematext.spm.client.MonitorConfig;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatsCollector;
-import com.sematext.spm.client.StatsCollectorBadConfigurationException;
-import com.sematext.spm.client.StatsCollectorsFactory;
-import com.sematext.spm.client.util.CollectionUtils.FunctionT;
-
-public final class TracingMonitorConfigurator {
- public void configure(final MonitorConfig monitorConfig, final List extends StatsCollector>> currentCollectors,
- final List> collectors,
- final Serializer serializer, final String appToken, final String subType, final String jvmName)
- throws StatsCollectorBadConfigurationException {
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingReqCompStatsCollector.class,
- TracingReqCompStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingReqCompStatsCollector apply(String id) {
- return new TracingReqCompStatsCollector(serializer, appToken, jvmName, subType);
- }
- });
-
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingReqStatsCollector.class,
- TracingReqStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingReqStatsCollector apply(String id) {
- return new TracingReqStatsCollector(serializer, appToken, jvmName, subType, monitorConfig);
- }
- });
-
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingCrossAppCallStatsCollector.class,
- TracingCrossAppCallStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingCrossAppCallStatsCollector apply(String id) {
- return new TracingCrossAppCallStatsCollector(serializer, appToken, jvmName, subType);
- }
- });
-
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingExternalCallStatsCollector.class,
- TracingExternalCallStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingExternalCallStatsCollector apply(String id) {
- return new TracingExternalCallStatsCollector(serializer, appToken, jvmName, subType);
- }
- });
-
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingReqErrorsStatsCollector.class,
- TracingReqErrorsStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingReqErrorsStatsCollector apply(String id) {
- return new TracingReqErrorsStatsCollector(serializer, appToken, jvmName, subType);
- }
- });
-
- StatsCollectorsFactory.updateCollector(currentCollectors, collectors, TracingDatabaseOperationStatsCollector.class,
- TracingDatabaseOperationStatsCollector.class.getName(),
- new FunctionT() {
- @Override
- public TracingDatabaseOperationStatsCollector apply(String id) {
- return new TracingDatabaseOperationStatsCollector(serializer, appToken, jvmName, subType);
- }
- });
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqCompStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqCompStatsCollector.java
deleted file mode 100644
index f658792..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqCompStatsCollector.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.tracing.agent.stats.RequestComponentMetric;
-
-public class TracingReqCompStatsCollector extends MultipleStatsCollector {
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- public TracingReqCompStatsCollector(Serializer serializer, String appToken, String jvmName, String subType) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().requestComponentMetrics();
- }
-
- @Override
- protected void appendStats(RequestComponentMetric s, StatValues statValues) {
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("component.requests", s.getCount());
- statValues.getMetrics().put("component.requests.time", s.getDuration());
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.request", s.getId().getRequest());
- statValues.getTags().put("tracing.component", s.getId().getComponent());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
- }
-
- @Override
- public String getName() {
- return "tracing-req-comp";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return getClass().getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqErrorsStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqErrorsStatsCollector.java
deleted file mode 100644
index 5b99436..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqErrorsStatsCollector.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.tracing.agent.stats.RequestErrorsMetric;
-
-public class TracingReqErrorsStatsCollector extends MultipleStatsCollector {
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- public TracingReqErrorsStatsCollector(Serializer serializer, String appToken, String jvmName, String subType) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().requestErrorMetrics();
- }
-
- @Override
- protected void appendStats(RequestErrorsMetric metric, StatValues statValues) {
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("requests.troubles", metric.getErrorsCount());
- statValues.getMetrics().put("requests.exceptions", metric.getExceptionsCount());
- statValues.getMetrics().put("requests.errors.4xx", metric.getResponseCode4xxCount());
- statValues.getMetrics().put("requests.errors.5xx", metric.getResponseCode5xxCount());
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.request", metric.getId());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
- }
-
- @Override
- public String getName() {
- return "tracing-req-errors";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return getClass().getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqStatsCollector.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqStatsCollector.java
deleted file mode 100644
index 1dda113..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingReqStatsCollector.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import org.eclipse.collections.impl.map.mutable.UnifiedMap;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import com.sematext.spm.client.GenericExtractor;
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.MonitorConfig;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.MultipleStatsCollector;
-import com.sematext.spm.client.Serializer;
-import com.sematext.spm.client.StatValues;
-import com.sematext.spm.client.StatValuesHelper;
-import com.sematext.spm.client.attributes.MetricType;
-import com.sematext.spm.client.metrics.DecideFlushMetricsProcessor;
-import com.sematext.spm.client.metrics.MetricsProcessorContext;
-import com.sematext.spm.client.metrics.PercentilesMetricsProcessor;
-import com.sematext.spm.client.observation.PercentilesDefinition;
-import com.sematext.spm.client.tracing.agent.stats.RequestMetric;
-
-public class TracingReqStatsCollector extends MultipleStatsCollector {
- private static final Log LOG = LogFactory.getLog(TracingReqStatsCollector.class);
-
- private final String appToken;
- private final String jvmName;
- private final String subType;
- private final File propsFile;
- private final String finalJvmName;
-
- private final MetricsProcessorContext context;
- private final DecideFlushMetricsProcessor decideFlushProcessor;
- private final PercentilesMetricsProcessor pctlsProcessor;
-
- public TracingReqStatsCollector(Serializer serializer, String appToken, String jvmName, String subType,
- MonitorConfig monitorConfig) {
- super(serializer);
- this.appToken = appToken;
- this.jvmName = jvmName;
- this.subType = subType;
- if (subType == null || subType.trim().equals("")) {
- this.finalJvmName = jvmName;
- } else {
- this.finalJvmName = jvmName + "-" + subType;
- }
-
- this.propsFile = MonitorUtil.fetchSpmMonitorPropertiesFileObject(appToken, jvmName, subType);
-
- this.decideFlushProcessor = new DecideFlushMetricsProcessor(monitorConfig.getMonitorCollectInterval());
- this.pctlsProcessor = new PercentilesMetricsProcessor();
-
- context = new MetricsProcessorContext();
- context.collectorName = getCollectorIdentifier();
- context.knownMetricTypes = new UnifiedMap(2);
- context.knownMetricTypes.put("requests.count", MetricType.COUNTER);
- context.knownMetricTypes.put("requests.time", MetricType.COUNTER);
- context.percentilesDefinitions = new UnifiedMap();
- PercentilesDefinition latencyPctl = new PercentilesDefinition("99, 95, 50", "requests.latency.avg");
- context.percentilesDefinitions.put("requests.latency.avg", latencyPctl);
- }
-
- @Override
- protected Collection getSlice(Map outerMetrics) {
- return TracingStatsExtractors.callStatisticsView().requestMetrics();
- }
-
- @Override
- protected void appendStats(RequestMetric s, StatValues statValues) {
- Long count = s.getCount();
- Long duration = s.getDuration();
-
- statValues.setMetrics(new UnifiedMap());
- statValues.getMetrics().put("requests.count", count);
- statValues.getMetrics().put("requests.time", duration);
- statValues.setTags(new UnifiedMap());
- statValues.getTags().put(GenericExtractor.JVM_NAME_TAG, finalJvmName);
- statValues.getTags().put("tracing.request", s.getId());
-
- StatValuesHelper.fillEnvTags(statValues, propsFile);
- StatValuesHelper.fillConfigTags(statValues, MonitorUtil.loadMonitorProperties(propsFile));
- statValues.setTimestamp(System.currentTimeMillis());
- statValues.setAppToken(appToken);
- statValues.setMetricNamespace("tracing");
-
- context.reset();
- context.statValues = statValues;
- if (count != null && duration != null) {
- if (count > 0) {
- statValues.getMetrics().put("requests.latency.avg", (duration.doubleValue()) / count);
- }
- }
- decideFlushProcessor.process(context);
- pctlsProcessor.process(context);
- }
-
- @Override
- public String getName() {
- return "tracing-req";
- }
-
- @Override
- public String getCollectorIdentifier() {
- return getClass().getName();
- }
-}
diff --git a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingStatsExtractors.java b/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingStatsExtractors.java
deleted file mode 100644
index e9acb1d..0000000
--- a/spm-monitor/src/main/java/com/sematext/spm/client/tracing/TracingStatsExtractors.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.sematext.spm.client.attributes.RealCounterValueHolder;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.stats.DiffCounterVar;
-import com.sematext.spm.client.tracing.agent.stats.MutableVarProvider;
-import com.sematext.spm.client.tracing.agent.stats.StatisticsView;
-import com.sematext.spm.client.tracing.agent.stats.TracingStatistics;
-
-public final class TracingStatsExtractors {
-
- private static TracingStatistics getTracingStatistics() {
- return ServiceLocator.getTracingStatistics();
- }
-
- private static volatile TracingStatistics TRACING_STATISTICS = null;
- private static volatile StatisticsView CALL_STATISTICS_VIEW = null;
-
- private static class CounterValueHolderVar implements DiffCounterVar {
- private final RealCounterValueHolder holder = new RealCounterValueHolder();
- private final AtomicLong accumulated = new AtomicLong(0L);
-
- public CounterValueHolderVar() {
- holder.getValue(0L);
- }
-
- @Override
- public Long increment(Long diff) {
- return accumulated.addAndGet(diff);
- }
-
- @Override
- public Long get() {
- return holder.getValue(accumulated.get());
- }
- }
-
- private static MutableVarProvider MUTABLE_VAR_PROVIDER = new MutableVarProvider() {
- @Override
- @SuppressWarnings("unchecked")
- public > DiffCounterVar newCounter(C klass) {
- if (Long.class.equals(klass)) {
- return (DiffCounterVar) new CounterValueHolderVar();
- }
- throw new IllegalArgumentException("Counter of type '" + klass + "' is not implemented.");
- }
- };
-
- public static StatisticsView callStatisticsView() {
- if (getTracingStatistics() != TRACING_STATISTICS) {
- synchronized (TracingStatsExtractors.class) {
- TracingStatistics current = getTracingStatistics();
- if (current != TRACING_STATISTICS) {
- CALL_STATISTICS_VIEW = current.newCallStatisticsView(MUTABLE_VAR_PROVIDER);
- TRACING_STATISTICS = current;
- }
- }
- }
- return CALL_STATISTICS_VIEW;
- }
-}
diff --git a/spm-monitor/src/test/java/com/sematext/spm/client/command/CommandPollingTest.java b/spm-monitor/src/test/java/com/sematext/spm/client/command/CommandPollingTest.java
index 869dc35..438d1e2 100644
--- a/spm-monitor/src/test/java/com/sematext/spm/client/command/CommandPollingTest.java
+++ b/spm-monitor/src/test/java/com/sematext/spm/client/command/CommandPollingTest.java
@@ -24,6 +24,7 @@
import static junit.framework.Assert.assertNull;
import static junit.framework.TestCase.assertNotNull;
+import com.sematext.spm.client.util.ThriftUtils;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
@@ -54,7 +55,6 @@
import com.sematext.spm.client.monitor.thrift.TCommandResponseStatus;
import com.sematext.spm.client.monitor.thrift.TCommandType;
import com.sematext.spm.client.snap.serializer.TBinaryProto;
-import com.sematext.spm.client.tracing.agent.impl.ThriftUtils;
@RunWith(DataProviderRunner.class)
public class CommandPollingTest {
diff --git a/spm-sender/pom.xml b/spm-sender/pom.xml
index cc93e78..d72d9f1 100644
--- a/spm-sender/pom.xml
+++ b/spm-sender/pom.xml
@@ -299,7 +299,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-thrift-data/pom.xml b/spm-thrift-data/pom.xml
index 328dd42..7ffcdc3 100644
--- a/spm-thrift-data/pom.xml
+++ b/spm-thrift-data/pom.xml
@@ -44,6 +44,7 @@
org.codehaus.mojo
build-helper-maven-plugin
+ 3.3.0
generate-sources
@@ -66,7 +67,7 @@
org.apache.thrift
libthrift
- 0.14.0
+ 0.16.0
org.apache.httpcomponents
@@ -114,7 +115,7 @@
org.apache.logging.log4j
log4j-core
- 2.17.0
+ 2.17.2
compile
diff --git a/spm-tracing-agent-impl/pom.xml b/spm-tracing-agent-impl/pom.xml
deleted file mode 100644
index d77537d..0000000
--- a/spm-tracing-agent-impl/pom.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-
- 4.0.0
-
-
- com.sematext.spm
- spm-client-parent
- 3.0.0
-
-
- spm-tracing-agent-impl
- jar
- SPM Tracing Agent Implementation
- SPM system monitoring tool
- http://maven.apache.org
-
-
-
- com.sematext.spm
- spm-tracing-agent
- ${project.version}
- provided
-
-
- com.sematext.spm
- spm-sender
- ${project.version}
- provided
-
-
- com.sematext.spm
- spm-thrift-data
- ${project.version}
-
-
-
-
-
-
-
- com.lmax
- disruptor
- 3.3.0
-
-
- junit
- junit
- ${junit.version}
- test
-
-
- org.apache.logging.log4j
- log4j-core
- 2.17.0
- compile
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.4
-
-
- dist-classic
- package
-
- single
-
-
- ${project.artifactId}-${project.version}-withdeps
- false
-
- jar-with-dependencies
-
-
-
- com.sematext.spm.tracing.agent.impl.AgentInitializer
- true
-
-
-
-
-
-
-
-
-
-
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/config/DefaultServiceConfigurer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/config/DefaultServiceConfigurer.java
deleted file mode 100644
index f948da2..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/config/DefaultServiceConfigurer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.config;
-
-import java.lang.instrument.Instrumentation;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import com.sematext.spm.client.tracing.agent.MuxSink;
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.TracingAgentControl;
-import com.sematext.spm.client.tracing.agent.errors.TracingError;
-import com.sematext.spm.client.tracing.agent.impl.DisruptorThriftEventSink;
-import com.sematext.spm.client.tracing.agent.impl.TracingAgentControlImpl;
-import com.sematext.spm.client.tracing.agent.impl.TracingStatisticsImpl;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.sampling.FixedRateSampler;
-import com.sematext.spm.client.tracing.agent.sampling.Sampler;
-import com.sematext.spm.client.tracing.agent.sampling.TracingErrorFixedRateSampler;
-import com.sematext.spm.client.tracing.agent.sampling.WeightedFixedRateSampler;
-import com.sematext.spm.client.tracing.agent.stats.TracingStatistics;
-import com.sematext.spm.client.util.StorageUnit;
-
-public class DefaultServiceConfigurer implements ServiceConfigurer {
- private Config config;
- private Sampler transactionSampler;
- private Sampler tracingErrorSampler;
- private List> transactionSinks;
- private List> errorSinks;
- private TracingStatistics tracingStatistics;
- private TracingAgentControl tracingAgentControl;
-
- private DefaultServiceConfigurer() {
- }
-
- @Override
- public Config getConfig() {
- return config;
- }
-
- @Override
- public Sampler getTransactionSampler() {
- return transactionSampler;
- }
-
- @Override
- public Sampler getTracingErrorSampler() {
- return tracingErrorSampler;
- }
-
- @Override
- public List> getTransactionSinks() {
- return transactionSinks;
- }
-
- @Override
- public List> getErrorSinks() {
- return errorSinks;
- }
-
- @Override
- public TracingStatistics getTracingStatistics() {
- return tracingStatistics;
- }
-
- @Override
- public TracingAgentControl getTracingAgentControl() {
- return tracingAgentControl;
- }
-
- @SuppressWarnings("unchecked")
- public static DefaultServiceConfigurer embeddedAgentConfigurer(final String args, Instrumentation instrumentation,
- boolean tracingEnabled, ClassLoader loader) {
- final DefaultServiceConfigurer configurer = new DefaultServiceConfigurer();
-
- configurer.config = Config.embeddedAgentConfig(args);
- configurer.transactionSampler = new FixedRateSampler(1, TimeUnit.MINUTES, 10000);
-
- final DisruptorThriftEventSink eventSink = DisruptorThriftEventSink
- .create(configurer.config.getLogPath(), (int) StorageUnit.MEGABYTES.toBytes(100), 3);
- configurer.transactionSinks = Arrays.>asList(new MuxSink(eventSink));
- configurer.errorSinks = Arrays.>asList(new MuxSink(eventSink));
-
- configurer.transactionSampler = new WeightedFixedRateSampler(1, 1, 1, TimeUnit.SECONDS);
- configurer.tracingErrorSampler = new TracingErrorFixedRateSampler(100, 1, TimeUnit.MINUTES);
- configurer.tracingStatistics = new TracingStatisticsImpl();
- configurer.tracingAgentControl = TracingAgentControlImpl
- .create(tracingEnabled, instrumentation, loader, configurer.config);
- return configurer;
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AgentInitializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AgentInitializer.java
deleted file mode 100644
index 5141e88..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AgentInitializer.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.io.File;
-import java.lang.instrument.Instrumentation;
-import java.util.concurrent.TimeUnit;
-
-import com.sematext.spm.client.DataFormat;
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.MonitorUtil;
-import com.sematext.spm.client.sender.SenderUtil;
-import com.sematext.spm.client.tracing.agent.config.DefaultServiceConfigurer;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.sampling.Stats;
-import com.sematext.spm.client.tracing.agent.sampling.StatsReporter;
-import com.sematext.spm.client.unlogger.dynamic.BehaviorDescription;
-import com.sematext.spm.client.unlogger.dynamic.BehaviorState;
-import com.sematext.spm.client.util.FifoInterface;
-
-public class AgentInitializer {
- private static final Log LOG = LogFactory.getLog(AgentInitializer.class);
-
- public static void premain(String args, Instrumentation instrumentation) throws Exception {
- init(args, instrumentation, true, true);
- }
-
- private static void startFifo() {
- final String fifoPath = System.getProperty("spm.tracing.agent.fifo");
- if (fifoPath != null && new File(fifoPath).exists()) {
- final TracingAgentControlImpl ctl = (TracingAgentControlImpl) ServiceLocator.getTracingAgentControl();
- LOG.info("Starting FIFO debug interface for " + fifoPath);
-
- FifoInterface.create()
- .addHandler("enableTracing", new FifoInterface.Handler() {
- @Override
- public void handle(String... args) {
- LOG.info("Got enable tracing command. Tracing enabled: " + ctl.enable());
- }
- })
- .addHandler("disableTracing", new FifoInterface.Handler() {
- @Override
- public void handle(String... args) {
- LOG.info("Got disable tracing command. Tracing disabled: " + ctl.disable());
- }
- })
- .addHandler("statistics", new FifoInterface.Handler() {
- @Override
- public void handle(String... args) {
- LOG.info(ctl.getStatistics());
- }
- })
- .addHandler("getWeavedClasses", new FifoInterface.Handler() {
- @Override
- public void handle(String[] arguments) {
- LOG.info(ctl.getWeavedClasses());
- }
- })
- .addHandler("instrumentMethod", new FifoInterface.Handler() {
- @Override
- public void handle(String[] args) {
- if (args.length == 1) {
- String signature = args[0];
-
- ctl.getInstrumentationSettings()
- .updateBehaviorState(new BehaviorDescription(signature), new BehaviorState(true, true));
- LOG.info("Got updateBehaviorState command: " + ctl.applyInstrumentationSettings());
- }
- }
- })
- .addHandler("uninstrumentMethod", new FifoInterface.Handler() {
- @Override
- public void handle(String[] args) {
- if (args.length == 1) {
- String signature = args[0];
-
- ctl.getInstrumentationSettings()
- .updateBehaviorState(new BehaviorDescription(signature), new BehaviorState(false, false));
- LOG.info("Got uninstrumentMethod command: " + ctl.applyInstrumentationSettings());
- }
- }
- })
- .start(fifoPath);
- }
- }
-
- public static void init(String args, Instrumentation instrumentation, boolean tracingEnabled, boolean initLogging)
- throws Exception {
- ServiceLocator.configure(DefaultServiceConfigurer
- .embeddedAgentConfigurer(args, instrumentation, tracingEnabled, AgentInitializer.class
- .getClassLoader()));
-
- // createRuntimeConfig();
-
- if (initLogging) {
- MonitorUtil.MonitorArgs monitorArgs = MonitorUtil.extractMonitorArgs(args);
- Integer processOrdinal = MonitorUtil
- .obtainMonitorLock(monitorArgs.getToken(), monitorArgs.getJvmName(), monitorArgs.getSubType());
-
- if (SenderUtil.isInContainer() || SenderUtil.isInKubernetes()) {
- LogFactory.initStdoutLogger(System.getProperty("spm.tracing.loglevel", "INFO"), DataFormat.PLAIN_TEXT);
- } else {
- LogFactory.initFileLogger(ServiceLocator.getConfig().getLogPath(), 1024 * 1024 * 100, 10,
- System.getProperty("spm.tracing.loglevel", "INFO"), DataFormat.PLAIN_TEXT,
- processOrdinal);
- }
- }
-
- startFifo();
-
- LOG.info("SPM Tracing Agent Initialized.");
-
- if (Boolean.getBoolean("spm.tracing.sampler.stats")) {
- StatsReporter.start(Stats.INSTANCE, Long.getLong("spm.tracing.sampler.interval", 500), TimeUnit.MILLISECONDS);
- }
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncFileCallSink.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncFileCallSink.java
deleted file mode 100644
index 84dbc03..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncFileCallSink.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.tracing.BinarySequentialLog;
-import com.sematext.spm.client.tracing.BinarySequentialSender;
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-
-public final class AsyncFileCallSink implements Sink {
- private static final Log LOG = LogFactory.getLog(AsyncFileCallSink.class);
-
- private final ArrayBlockingQueue calls = new ArrayBlockingQueue(1000);
- private volatile boolean running = true;
- private final BinarySequentialSender binaryLog;
-
- private AsyncFileCallSink(BinarySequentialSender binaryLog) {
- this.binaryLog = binaryLog;
- }
-
- private Thread sinkThread = new Thread() {
- @Override
- public void run() {
- while (running) {
- try {
- final byte[] call = calls.poll(10, TimeUnit.MILLISECONDS);
- if (call != null) {
- binaryLog.write(call);
- }
- } catch (InterruptedException e) {
- LOG.warn("Sink thread was interrupted.", e);
- }
- }
- if (LOG.isTraceEnabled()) {
- LOG.trace("Sink thread exited.");
- }
- }
- };
-
- @Override
- public void sink(PartialTransaction transaction) {
- try {
- if (!calls.offer(ThriftPartialTransactionSerializer.serialize(transaction), 10, TimeUnit.MILLISECONDS)) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Queue is full, can't offer new call.");
- }
- }
- } catch (Throwable e) {
- LOG.warn("Call offer was interrupted.", e);
- }
- }
-
- public static AsyncFileCallSink create(String basedir, int maxFileSize, int retentionCount) {
- final AsyncFileCallSink sink = new AsyncFileCallSink(
- new BinarySequentialSender(BinarySequentialLog
- .create(basedir, "tracing", ".bin", maxFileSize, retentionCount)));
- sink.sinkThread.setDaemon(true);
- sink.sinkThread.setName("spm-tracing-sink-thread");
- sink.sinkThread.start();
- return sink;
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncLockFreeCallSink.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncLockFreeCallSink.java
deleted file mode 100644
index 534a235..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/AsyncLockFreeCallSink.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-//import com.sematext.spm.client.tracing.BinarySequentialSender;
-
-public class AsyncLockFreeCallSink /*implements Sink*/ {
-//
-// private static final Log LOG = LogFactory.getLog(AsyncFileCallSink.class);
-//
-// private final ConcurrentLinkedQueue calls = new ConcurrentLinkedQueue();
-// private final BinarySequentialSender binaryLog;
-// private volatile boolean running = true;
-// private Thread sinkThread = new Thread() {
-// @Override
-// public void run() {
-// while (running) {
-// final Call call = calls.poll();
-// if (call != null) {
-// binaryLog.write(ThriftCallSerializer.serialize(call));
-// }
-// }
-// if (LOG.isTraceEnabled()) {
-// LOG.trace("Sink thread exited.");
-// }
-// }
-// };
-//
-// private AsyncLockFreeCallSink(BinarySequentialSender binaryLog) {
-// this.binaryLog = binaryLog;
-// }
-//
-// public static AsyncLockFreeCallSink create(String basedir, int maxFileSize, int retentionCount) {
-// final AsyncLockFreeCallSink sink = new AsyncLockFreeCallSink(
-// new BinarySequentialSender(BinarySequentialLog.create(basedir, "tracing", ".bin", maxFileSize, retentionCount)));
-// sink.sinkThread.setDaemon(true);
-// sink.sinkThread.setName("spm-tracing-sink-thread");
-// sink.sinkThread.start();
-// return sink;
-// }
-//
-// @Override
-// public void sink(PartialTransaction transaction) {
-// throw new IllegalStateException("not implemented.");
-// }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorFileCallSink.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorFileCallSink.java
deleted file mode 100644
index 5cee2ae..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorFileCallSink.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import com.lmax.disruptor.EventFactory;
-import com.lmax.disruptor.EventHandler;
-import com.lmax.disruptor.RingBuffer;
-import com.lmax.disruptor.dsl.Disruptor;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import com.sematext.spm.client.tracing.BinarySequentialLog;
-import com.sematext.spm.client.tracing.BinarySequentialSender;
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.sampling.SamplerStatistics;
-
-public final class DisruptorFileCallSink implements Sink {
- private static final EventFactory NEW_PARTIAL_TRANSACTION = new EventFactory() {
- @Override
- public PartialTransaction newInstance() {
- return new PartialTransaction();
- }
- };
- private static final ThreadFactory DAEMON_THREAD_FACTORY = new ThreadFactory() {
- @Override
- public Thread newThread(final Runnable r) {
- final Thread t = new Thread(r, "disruptor-file-call-sink");
- t.setDaemon(true);
- return t;
- }
- };
-
- private final BinarySequentialSender binaryLog;
- private final EventHandler eventHandler = new EventHandler() {
- @Override
- public void onEvent(PartialTransaction transaction, long sequence, boolean endOfBatch) throws Exception {
- long t = System.nanoTime();
- binaryLog.write(ThriftPartialTransactionSerializer.serialize(transaction));
- SamplerStatistics.INSTANCE.update(System.nanoTime() - t);
- }
- };
-
- private final Disruptor disruptor;
-
- private DisruptorFileCallSink(BinarySequentialSender binaryLog) {
- this.binaryLog = binaryLog;
- this.disruptor = new Disruptor(NEW_PARTIAL_TRANSACTION, 1024,
- Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY));
- }
-
- public static Sink create(String basedir, int maxFileSize, int retentionCount) {
- BinarySequentialSender log = new BinarySequentialSender(BinarySequentialLog
- .create(basedir, "tracing", ".bin", maxFileSize, retentionCount));
- final DisruptorFileCallSink sink = new DisruptorFileCallSink(log);
- sink.start();
- return sink;
- }
-
- @SuppressWarnings("unchecked")
- private void start() {
- this.disruptor.handleEventsWith(eventHandler);
- this.disruptor.start();
- }
-
- @Override
- public void sink(PartialTransaction transaction) {
- final RingBuffer buffer = this.disruptor.getRingBuffer();
- long seq = buffer.next();
- try {
- final PartialTransaction event = buffer.get(seq);
- transaction.copy(event);
- } finally {
- buffer.publish(seq);
- }
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorThriftEventSink.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorThriftEventSink.java
deleted file mode 100644
index e698032..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/DisruptorThriftEventSink.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import com.lmax.disruptor.EventFactory;
-import com.lmax.disruptor.EventHandler;
-import com.lmax.disruptor.RingBuffer;
-import com.lmax.disruptor.dsl.Disruptor;
-
-import org.apache.thrift.TException;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.tracing.BinarySequentialLog;
-import com.sematext.spm.client.tracing.BinarySequentialSender;
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.SinkEvent;
-import com.sematext.spm.client.tracing.agent.errors.TracingError;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.thrift.TTracingEvent;
-import com.sematext.spm.client.tracing.thrift.TTracingEventType;
-import com.sematext.spm.client.util.Preconditions;
-
-public final class DisruptorThriftEventSink implements Sink {
-
- private static final Log LOG = LogFactory.getLog(DisruptorThriftEventSink.class);
-
- private static class Event {
- private EventDescriptor descriptor;
- private final PartialTransaction partialTransaction = new PartialTransaction();
- private final TracingError tracingError = new TracingError();
-
- public EventDescriptor getDescriptor() {
- return descriptor;
- }
-
- public PartialTransaction getPartialTransaction() {
- return partialTransaction;
- }
-
- public TracingError getTracingError() {
- return tracingError;
- }
- }
-
- private static enum EventDescriptor {
- PARTIAL_TRANSACTION(PartialTransaction.class) {
- @Override
- void copy(Object from, Event event) {
- ((PartialTransaction) from).copy(event.getPartialTransaction());
- event.descriptor = this;
- }
-
- @Override
- byte[] toThrift(Event event) throws TException {
- final TTracingEvent thriftEvent = new TTracingEvent(TTracingEventType.PARTIAL_TRANSACTION);
- thriftEvent.setPartialTransaction(ThriftPartialTransactionSerializer.toThrift(event.getPartialTransaction()));
- return ThriftUtils.binaryProtocolSerializer().serialize(thriftEvent);
- }
- },
- TRACING_ERROR(TracingError.class) {
- @Override
- void copy(Object from, Event event) {
- ((TracingError) from).copy(event.getTracingError());
- event.descriptor = this;
- }
-
- @Override
- byte[] toThrift(Event event) throws TException {
- final TTracingEvent thriftEvent = new TTracingEvent(TTracingEventType.TRACING_ERROR);
- thriftEvent.setTracingError(ThriftTracingErrorSerializer.toThrift(event.getTracingError()));
- return ThriftUtils.binaryProtocolSerializer().serialize(thriftEvent);
- }
- };
-
- final Class> klass;
-
- abstract void copy(Object from, Event event);
-
- abstract byte[] toThrift(Event event) throws TException;
-
- EventDescriptor(Class> klass) {
- this.klass = klass;
- }
-
- static EventDescriptor get(Class> klass) {
- for (EventDescriptor descriptor : values()) {
- if (descriptor.klass.equals(klass)) {
- return descriptor;
- }
- }
- throw new IllegalArgumentException("Unknown event type: " + klass);
- }
- }
-
- private final EventFactory eventFactory = new EventFactory() {
- @Override
- public Event newInstance() {
- return new Event();
- }
- };
-
- private static final ThreadFactory DAEMON_THREAD_FACTORY = new ThreadFactory() {
- @Override
- public Thread newThread(final Runnable r) {
- final Thread t = new Thread(r, "disruptor-thrift-event-sink");
- t.setDaemon(true);
- return t;
- }
- };
-
- private final EventHandler eventHandler = new EventHandler() {
- @Override
- public void onEvent(Event event, long sequence, boolean endOfBatch) throws Exception {
- try {
- binaryLog.write(event.getDescriptor().toThrift(event));
- } catch (Exception e) {
- LOG.error("Can't write event to binary log. Event = " + event + ".", e);
- }
- }
- };
-
- private final BinarySequentialSender binaryLog;
- private final Disruptor disruptor;
-
- private DisruptorThriftEventSink(BinarySequentialSender binaryLog) {
- this.binaryLog = binaryLog;
- this.disruptor = new Disruptor(eventFactory, 1024, Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY));
- }
-
- private void start() {
- this.disruptor.handleEventsWith(eventHandler);
- this.disruptor.start();
- }
-
- public static DisruptorThriftEventSink create(String basedir, int maxFileSize, int retentionCount) {
- return create(basedir, "tracing", ".bin", maxFileSize, retentionCount);
- }
-
- public static DisruptorThriftEventSink create(String basedir, String prefix, String suffix, int maxFileSize,
- int retentionCount) {
- BinarySequentialSender log = new BinarySequentialSender(BinarySequentialLog
- .create(basedir, prefix, suffix, maxFileSize, retentionCount));
- final DisruptorThriftEventSink sink = new DisruptorThriftEventSink(log);
- sink.start();
- return sink;
- }
-
- @Override
- public void sink(SinkEvent sinkEvent) {
- Preconditions.checkNotNull(sinkEvent);
-
- final Object obj = sinkEvent.getObj();
- final EventDescriptor descriptor = EventDescriptor.get(obj.getClass());
- final RingBuffer ringBuffer = this.disruptor.getRingBuffer();
- final long seq = ringBuffer.next();
- try {
- descriptor.copy(obj, ringBuffer.get(seq));
- } finally {
- ringBuffer.publish(seq);
- }
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/HasTransfomedClasses.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/HasTransfomedClasses.java
deleted file mode 100644
index b93e203..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/HasTransfomedClasses.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.util.Set;
-
-public interface HasTransfomedClasses {
- Set getTransformedClasses();
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftAnnotationSerializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftAnnotationSerializer.java
deleted file mode 100644
index 0cc0002..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftAnnotationSerializer.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TException;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.ESAction;
-import com.sematext.spm.client.tracing.agent.model.InetAddress;
-import com.sematext.spm.client.tracing.agent.model.SolrAnnotation;
-import com.sematext.spm.client.tracing.agent.model.annotation.ESAnnotation;
-import com.sematext.spm.client.tracing.agent.model.annotation.HTTPRequestAnnotation;
-import com.sematext.spm.client.tracing.agent.model.annotation.JPAAnnotation;
-import com.sematext.spm.client.tracing.agent.model.annotation.JSPAnnotation;
-import com.sematext.spm.client.tracing.agent.model.annotation.SQLAnnotation;
-import com.sematext.spm.client.tracing.thrift.*;
-
-public final class ThriftAnnotationSerializer {
- private static interface Ser {
- byte[] serialize(T annotation) throws TException;
- }
-
- private static class SQLAnnotationSer implements Ser {
- @Override
- public byte[] serialize(SQLAnnotation annotation) throws TException {
- TSQLAnnotation thrift = new TSQLAnnotation();
- thrift.setType(annotation.getType());
- if (annotation.getSql() != null) {
- thrift.setSql(annotation.getSql());
- } else {
- thrift.setSqlIsSet(false);
- }
- if (annotation.getUrl() != null) {
- thrift.setUrl(annotation.getUrl());
- } else {
- thrift.setUrlIsSet(false);
- }
- thrift.setCount(annotation.getCount());
- thrift.setTable(annotation.getTable());
- if (annotation.getOperation() != null) {
- thrift.setOperation(TSqlStatementOperation.valueOf(annotation.getOperation().name()));
- }
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static class JPAAnnotationSer implements Ser {
- @Override
- public byte[] serialize(JPAAnnotation annotation) throws TException {
- TJPAAnnotation thrift = new TJPAAnnotation();
- thrift.setType(annotation.getType());
- if (annotation.getQuery() != null) {
- thrift.setQuery(annotation.getQuery());
- } else {
- thrift.setQueryIsSet(false);
- }
- if (annotation.getObject() != null) {
- thrift.setObject(annotation.getObject());
- } else {
- thrift.setObjectIsSet(false);
- }
- thrift.setCount(annotation.getCount());
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static class JSPAnnotationSer implements Ser {
- @Override
- public byte[] serialize(JSPAnnotation annotation) throws TException {
- TJSPAnnotation thrift = new TJSPAnnotation();
- if (annotation.getPath() != null) {
- thrift.setPath(annotation.getPath());
- } else {
- thrift.setPathIsSet(false);
- }
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static class HTTPRequestAnnotationSer implements Ser {
- @Override
- public byte[] serialize(HTTPRequestAnnotation annotation) throws TException {
- THTTPRequestAnnotation thrift = new THTTPRequestAnnotation();
- if (annotation.getUrl() != null) {
- thrift.setUrl(annotation.getUrl());
- } else {
- thrift.setUrlIsSet(false);
- }
- if (annotation.getMethod() != null) {
- thrift.setMethod(annotation.getMethod());
- } else {
- thrift.setMethodIsSet(false);
- }
- thrift.setResponseCode(annotation.getResponseCode());
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static class ESAnnotationSer implements Ser {
- @Override
- public byte[] serialize(ESAnnotation annotation) throws TException {
- TESAnnotation thrift = new TESAnnotation();
- final List inetAddresses = new ArrayList();
- for (InetAddress address : annotation.getAddresses()) {
- inetAddresses.add(new TInetAddress(address.getHost(), address.getPort()));
- }
- thrift.setAddresses(inetAddresses);
- if (annotation.getActions() != null) {
- List thriftActions = new ArrayList();
- for (ESAction action : annotation.getActions()) {
- final TESAction thriftAction = new TESAction();
- thriftAction.setOperationType(TESOperationType.valueOf(action.getOperationType().name()));
- thriftAction.setType(action.getType());
- thriftAction.setIndex(action.getIndex());
- thriftAction.setQuery(action.getQuery());
- thriftAction.setCount(action.getCount());
-
- thriftActions.add(thriftAction);
- }
- thrift.setActions(thriftActions);
- } else {
- thrift.setActions(Collections.EMPTY_LIST);
- }
- thrift.setIndex(annotation.getIndex());
- thrift.setRequestType(TESRequestType.valueOf(annotation.getRequestType().name()));
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static class SolrAnnotationSer implements Ser {
- @Override
- public byte[] serialize(SolrAnnotation annotation) throws TException {
- final TSolrAnnotation thrift = new TSolrAnnotation();
- thrift.setUrl(annotation.getUrl());
- thrift.setParams(new HashMap(annotation.getParams()));
- thrift.setCollection(annotation.getCollection());
- thrift.setResponseStatus((short) annotation.getResponseStatus());
- thrift.setSucceed(annotation.isSucceed());
- thrift.setRequestType(TSolrRequestType.valueOf(annotation.getRequestType().name()));
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static enum Serializers {
- SQL(Call.CallTag.SQL_QUERY, new SQLAnnotationSer()),
- JPA(Call.CallTag.JPA, new JPAAnnotationSer()),
- JSP(Call.CallTag.JSP, new JSPAnnotationSer()),
- HTTP_REQUEST(Call.CallTag.HTTP_REQUEST, new HTTPRequestAnnotationSer()),
- ES(Call.CallTag.ES, new ESAnnotationSer()),
- SOLR(Call.CallTag.SOLR, new SolrAnnotationSer());
-
- private final Call.CallTag tag;
- private final Ser ser;
-
- Serializers(Call.CallTag tag, Ser ser) {
- this.tag = tag;
- this.ser = ser;
- }
-
- public static Ser find(Call.CallTag tag) {
- for (Serializers ser : Serializers.values()) {
- if (ser.tag == tag) {
- return ser.ser;
- }
- }
- return null;
- }
- }
-
- public static byte[] serialize(Call.CallTag tag, Object annotation) throws TException {
- Ser ser = Serializers.find(tag);
- if (ser != null) {
- return ser.serialize(annotation);
- }
- return null;
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftCallSerializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftCallSerializer.java
deleted file mode 100644
index 3d30ce9..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftCallSerializer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TException;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.thrift.TCall;
-import com.sematext.spm.client.tracing.thrift.TCallTag;
-
-public final class ThriftCallSerializer {
- private ThriftCallSerializer() {
- }
-
- public static TCall toThrift(Call call) throws TException {
- TCall thriftCall = new TCall();
-
- thriftCall.setCallId(call.getCallId());
- thriftCall.setParentCallId(call.getParentCallId());
- thriftCall.setLevel(call.getLevel());
- thriftCall.setStartTimestamp(call.getStartTimestamp());
- thriftCall.setEndTimestamp(call.getEndTimestamp());
- thriftCall.setDuration(call.getDuration());
- thriftCall.setSelfDuration(call.getSelfDuration());
- thriftCall.setSignature(call.getSignature());
- if (call.getFailed() != null) {
- thriftCall.setFailed(call.getFailed());
- } else {
- thriftCall.setFailedIsSet(false);
- }
- if (call.getExternal() != null) {
- thriftCall.setExternal(call.getExternal());
- } else {
- thriftCall.setExternalIsSet(false);
- }
- if (call.getCallTag() != null) {
- thriftCall.setTag(TCallTag.valueOf(call.getCallTag().name()));
- } else {
- thriftCall.setTagIsSet(false);
- }
- thriftCall.setEntryPoint(call.isEntryPoint());
- thriftCall.setCrossAppToken(call.getCrossAppToken());
- if (call.getCrossAppCallId() != null) {
- thriftCall.setCrossAppCallId(call.getCrossAppCallId());
- } else {
- thriftCall.setCrossAppCallIdIsSet(false);
- }
- if (call.getCrossAppParentCallId() != null) {
- thriftCall.setCrossAppParentCallId(call.getCrossAppParentCallId());
- } else {
- thriftCall.setCrossAppParentCallIdIsSet(false);
- }
- if (call.getCrossAppDuration() != null) {
- thriftCall.setCrossAppDuration(call.getCrossAppDuration());
- } else {
- thriftCall.setCrossAppDurationIsSet(false);
- }
-
- thriftCall.setCrossAppSampled(call.isCrossAppSampled());
-
- if (call.getAnnotation() != null) {
- byte[] ser = ThriftAnnotationSerializer.serialize(call.getCallTag(), call.getAnnotation());
- if (ser != null) {
- thriftCall.setAnnotation(ser);
- }
- }
-
- thriftCall.setParameters(call.getParameters());
-
- return thriftCall;
- }
-
- public static byte[] serialize(Call call) {
- try {
- TCall thriftCall = toThrift(call);
- return ThriftUtils.binaryProtocolSerializer().serialize(thriftCall);
- } catch (TException e) {
- throw new RuntimeException("Can't serialize call.", e);
- }
- }
-
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftPartialTransactionSerializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftPartialTransactionSerializer.java
deleted file mode 100644
index c5d7026..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftPartialTransactionSerializer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.thrift.TCall;
-import com.sematext.spm.client.tracing.thrift.TEndpoint;
-import com.sematext.spm.client.tracing.thrift.TFailureType;
-import com.sematext.spm.client.tracing.thrift.TPartialTransaction;
-import com.sematext.spm.client.tracing.thrift.TTransactionType;
-
-public class ThriftPartialTransactionSerializer {
- public static TPartialTransaction toThrift(PartialTransaction transaction) throws TException {
- TPartialTransaction thrift = new TPartialTransaction();
- thrift.setCallId(transaction.getCallId());
- thrift.setParentCallId(transaction.getParentCallId());
- thrift.setTraceId(transaction.getTraceId());
- thrift.setRequest(transaction.getRequest());
- thrift.setStartTimestamp(transaction.getStartTimestamp());
- thrift.setEndTimestamp(transaction.getEndTimestamp());
- thrift.setDuration(transaction.getDuration());
- thrift.setToken(transaction.getToken());
- thrift.setFailed(transaction.isFailed());
- thrift.setEntryPoint(transaction.isEntryPoint());
- thrift.setAsynchronous(transaction.isAsynchronous());
- thrift.setTransactionType(TTransactionType.valueOf(transaction.getTransactionType().name()));
-
- if (transaction.getTransactionSummary() != null) {
- byte[] summary = ThriftTransactionSummarySerializer.serialize(transaction.getTransactionType(),
- transaction.getTransactionSummary());
- thrift.setTransactionSummary(summary);
- }
-
- if (transaction.getEndpoint() != null) {
- TEndpoint endpoint = new TEndpoint();
- endpoint.setHostname(transaction.getEndpoint().getHostname());
- endpoint.setAddress(transaction.getEndpoint().getAddress());
- thrift.setEndpoint(endpoint);
- }
-
- final List thriftCalls = new ArrayList();
-
- for (Call call : transaction.getCalls()) {
- TCall thriftCall = ThriftCallSerializer.toThrift(call);
- thriftCalls.add(thriftCall);
- }
-
- thrift.setCalls(thriftCalls);
-
- if (transaction.getExceptionStackTrace() != null) {
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(os);
- transaction.getExceptionStackTrace().printStackTrace(writer);
- writer.flush();
-
- thrift.setExceptionStackTrace(os.toByteArray());
- }
-
- if (transaction.getFailureType() != null) {
- final TFailureType type = TFailureType.valueOf(transaction.getFailureType().name());
- thrift.setFailureType(type);
- }
-
- thrift.setParameters(transaction.getParameters());
-
- return thrift;
- }
-
- public static byte[] serialize(PartialTransaction transaction) throws TException {
- return ThriftUtils.binaryProtocolSerializer().serialize(toThrift(transaction));
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTracingErrorSerializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTracingErrorSerializer.java
deleted file mode 100644
index 318bce4..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTracingErrorSerializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TException;
-
-import java.util.HashMap;
-
-import com.sematext.spm.client.tracing.agent.errors.TracingError;
-import com.sematext.spm.client.tracing.thrift.TTracingError;
-
-public class ThriftTracingErrorSerializer {
- public static TTracingError toThrift(TracingError tracingError) {
- TTracingError thrift = new TTracingError();
- thrift.setToken(tracingError.getToken());
- thrift.setTraceId(tracingError.getTraceId());
- thrift.setParentCallId(tracingError.getParentCallId());
- thrift.setCallId(tracingError.getCallId());
- thrift.setTimestamp(tracingError.getTimestamp());
- thrift.setSampled(tracingError.isSampled());
- thrift.setParameters(new HashMap(tracingError.getParameters()));
- return thrift;
- }
-
- public static byte[] serialize(TracingError tracingError) throws TException {
- return ThriftUtils.binaryProtocolSerializer().serialize(toThrift(tracingError));
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTransactionSummarySerializer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTransactionSummarySerializer.java
deleted file mode 100644
index 9178fd6..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftTransactionSummarySerializer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TException;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.WebTransactionSummary;
-import com.sematext.spm.client.tracing.thrift.TWebTransactionSummary;
-
-public final class ThriftTransactionSummarySerializer {
- private ThriftTransactionSummarySerializer() {
- }
-
- private static interface Ser {
- byte[] serialize(T summary) throws TException;
- }
-
- private static class WebTransactionSummarySer implements Ser {
- @Override
- public byte[] serialize(WebTransactionSummary summary) throws TException {
- TWebTransactionSummary thrift = new TWebTransactionSummary();
- thrift.setRequest(summary.getRequest());
- thrift.setQueryString(summary.getQueryString());
- thrift.setRequestMethod(summary.getRequestMethod());
- thrift.setResponseCode(summary.getResponseCode());
- return ThriftUtils.binaryProtocolSerializer().serialize(thrift);
- }
- }
-
- private static enum Serializers {
- WEB(Call.TransactionType.WEB, new WebTransactionSummarySer());
-
- private final Call.TransactionType type;
- private final Ser ser;
-
- Serializers(Call.TransactionType type, Ser ser) {
- this.type = type;
- this.ser = ser;
- }
-
- public static Ser find(Call.TransactionType type) {
- for (Serializers ser : Serializers.values()) {
- if (ser.type == type) {
- return ser.ser;
- }
- }
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- public static byte[] serialize(Call.TransactionType type, Object summary) throws TException {
- Ser ser = Serializers.find(type);
- if (ser != null) {
- return ser.serialize(summary);
- }
- return null;
- }
-
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftUtils.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftUtils.java
deleted file mode 100644
index 98672f3..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/ThriftUtils.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import org.apache.thrift.TDeserializer;
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.transport.TTransportException;
-
-public final class ThriftUtils {
- private ThriftUtils() {
- }
-
- private static final ThreadLocal BINARY_PROTOCOL_SERIALIZER = new ThreadLocal() {
- @Override
- protected TSerializer initialValue() {
- try {
- return new TSerializer(new TBinaryProtocol.Factory());
- } catch (TTransportException tte) {
- throw new RuntimeException(tte);
- }
- }
- };
-
- public static TSerializer binaryProtocolSerializer() {
- return BINARY_PROTOCOL_SERIALIZER.get();
- }
-
- private static final ThreadLocal THRIFT_DESERIALIZER = new ThreadLocal() {
- @Override
- protected TDeserializer initialValue() {
- try {
- return new TDeserializer(new TBinaryProtocol.Factory());
- } catch (TTransportException tte) {
- throw new RuntimeException(tte);
- }
- }
- };
-
- public static TDeserializer binaryProtocolDeserializer() {
- return THRIFT_DESERIALIZER.get();
- }
-
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingAgentControlImpl.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingAgentControlImpl.java
deleted file mode 100644
index 94462b9..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingAgentControlImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.lang.instrument.Instrumentation;
-import java.util.Set;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.tracing.agent.TracingAgentControl;
-import com.sematext.spm.client.tracing.agent.config.Config;
-import com.sematext.spm.client.unlogger.dynamic.AgentStatistics;
-import com.sematext.spm.client.unlogger.dynamic.DynamicInstrumentation;
-import com.sematext.spm.client.unlogger.dynamic.InstrumentationSettings;
-
-public final class TracingAgentControlImpl implements TracingAgentControl {
- private final Log log = LogFactory.getLog(TracingAgentControlImpl.class);
-
- private final DynamicInstrumentation dynamicInstrumentation;
- private final InstrumentationSettings instrumentationSettings = new InstrumentationSettings();
- private final AgentStatistics statistics = new AgentStatistics();
-
- public TracingAgentControlImpl(boolean tracingEnabled, Instrumentation instrumentation, TracingArtifacts artifacts) {
- dynamicInstrumentation = new DynamicInstrumentation(instrumentationSettings, statistics, artifacts
- .getDynamicTransformers(),
- artifacts
- .getClassesToBeRetransformed(), instrumentation, tracingEnabled, artifacts
- .getUserTracedMethodEntryPointDispatchId(),
- artifacts.getUserTracedMethodNonEntryPointDispatchId());
- }
-
- private void initialize() {
- dynamicInstrumentation.init();
- }
-
- @Override
- public boolean enable() {
- return dynamicInstrumentation.enable();
- }
-
- @Override
- public boolean disable() {
- return dynamicInstrumentation.disable();
- }
-
- @Override
- public boolean isEnabled() {
- return dynamicInstrumentation.isEnabled();
- }
-
- public AgentStatistics getStatistics() {
- return statistics;
- }
-
- public Set getWeavedClasses() {
- return dynamicInstrumentation.getWeavedClasses();
- }
-
- @Override
- public InstrumentationSettings getInstrumentationSettings() {
- return instrumentationSettings;
- }
-
- @Override
- public boolean applyInstrumentationSettings() {
- return dynamicInstrumentation.applyTransformationSettings();
- }
-
- public static TracingAgentControlImpl create(boolean tracingEnabled, Instrumentation instrumentation,
- ClassLoader loader, Config config) {
- final TracingAgentControlImpl control = new TracingAgentControlImpl(tracingEnabled, instrumentation, TracingArtifacts
- .create(loader, config));
- control.initialize();
- return control;
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingArtifacts.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingArtifacts.java
deleted file mode 100644
index 4569aef..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingArtifacts.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import static com.sematext.spm.client.unlogger.dispatch.DispatchUnit.registerDispatchUnit;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.AbstractExecutorService;
-import java.util.concurrent.ThreadPoolExecutor;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.tracing.agent.config.Config;
-import com.sematext.spm.client.tracing.agent.pointcuts.custom.ExtensionPointcut;
-import com.sematext.spm.client.tracing.agent.tracer.Tracer;
-import com.sematext.spm.client.tracing.agent.tracer.Tracers;
-import com.sematext.spm.client.tracing.agent.transformation.TracingClassDynamicTransformer;
-import com.sematext.spm.client.tracing.agent.transformation.TracingTransform;
-import com.sematext.spm.client.unlogger.Logspect;
-import com.sematext.spm.client.unlogger.Pointcut;
-import com.sematext.spm.client.unlogger.UnloggableLogger;
-import com.sematext.spm.client.unlogger.dispatch.AdviceDispatcher;
-import com.sematext.spm.client.unlogger.dispatch.LastInchOfTrampoline;
-import com.sematext.spm.client.unlogger.dynamic.DynamicTransformer;
-import com.sematext.spm.client.unlogger.dynamic.UnloggerDynamicTransformer;
-import com.sematext.spm.client.unlogger.dynamic.WeavingClassTrackerDynamicTransformer;
-import com.sematext.spm.client.unlogger.xml.CustomPointcutOptions;
-import com.sematext.spm.client.unlogger.xml.InstrumentationLoaderException;
-import com.sematext.spm.client.unlogger.xml.XMLInstrumentationDescriptorLoader;
-import com.sematext.spm.client.util.ReflectionUtils;
-
-/**
- * 'Artifacts' needed for tracing:
- * - creates predefined logspects
- * - creates user defined logspects (from .xml)
- * - creates 'DynamicTransformer' instances for logspects
- */
-public final class TracingArtifacts {
-
- private final Log log = LogFactory.getLog(TracingArtifacts.class);
-
- private final ClassLoader loader;
- private final Config config;
- private final List dynamicTransformers = new ArrayList();
- private int userTracedMethodEntryPointDispatchId;
- private int userTracedMethodNonEntryPointDispatchId;
-
- private TracingArtifacts(ClassLoader loader, Config config) {
- this.loader = loader;
- this.config = config;
- }
-
- private List loadExtensionLogspects(File file) throws IOException, InstrumentationLoaderException {
- FileInputStream is = null;
- try {
- is = new FileInputStream(file);
- final XMLInstrumentationDescriptorLoader loader = new XMLInstrumentationDescriptorLoader(ExtensionPointcut.class);
- return loader.load(is).getLogspects();
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- private List loadExtensionLogspects() {
- final List logspects = new ArrayList();
- final File extensionsDir = new File(config.getExtensionsPath());
- if (!extensionsDir.exists()) {
- log.info("Extensions dir '" + extensionsDir + "' not exists skipping loading extensions.");
- } else {
- File[] files = extensionsDir.listFiles();
- if (files != null) {
- for (File file : files) {
- if (file.getName().endsWith(".xml")) {
- try {
- logspects.addAll(loadExtensionLogspects(file));
- log.info("Loaded extension '" + file + "'.");
- } catch (Exception e) {
- log.error("Can't load extension '" + file + "'.", e);
- }
- }
- }
- }
- }
- return logspects;
- }
-
- private Map registerLoggers(Collection extends Logspect> loggers) {
- final Map pointcutToDispatchId = new HashMap();
- for (Logspect logger : loggers) {
- processLoggerClass(logger, pointcutToDispatchId);
- }
-
- return pointcutToDispatchId;
- }
-
- private static void processLoggerClass(Logspect logspect, Map toWeave) {
- final UnloggableLogger logger = logspect.createUnlogger();
-
- for (Pointcut pointcut : logspect.getPointcuts()) {
- int dispatchId = registerDispatchUnit(logspect.getName(), pointcut, logger);
- toWeave.put(pointcut, dispatchId);
- }
- }
-
- private static Integer registerUserTracedMethodLogspect(boolean entryPoint) {
- final CustomPointcutOptions options = new CustomPointcutOptions(entryPoint, null);
- final Logspect logspect = new Logspect(
- "UserTracedMethodLogspectEntryPoint" + entryPoint, ExtensionPointcut.class, Collections.emptyList(),
- ReflectionUtils.ClassValue.cv(CustomPointcutOptions.class, options));
- return registerDispatchUnit(logspect.getName(), null, logspect.createUnlogger());
- }
-
- private void initialize() {
- final List structuralTransforms = new ArrayList();
- final List logspects = new ArrayList();
-
- for (Tracers value : Tracers.values()) {
- Tracer tracer = value.getTracer();
- if (tracer.enabled(config) && !Boolean.getBoolean("spm.tracer.disable." + tracer.getName())) {
- logspects.addAll(tracer.createLogspects(loader));
- structuralTransforms.addAll(Arrays.asList(tracer.getStructuralTransforms()));
- } else {
- log.info("Skipping " + tracer.getName() + " tracer.");
- }
- }
-
- logspects.addAll(loadExtensionLogspects());
-
- LastInchOfTrampoline.switchTo(AdviceDispatcher.Type.DEFAULT);
-
- final Set pointcuts = new HashSet();
-
- for (Logspect logspect : logspects) {
- pointcuts.addAll(logspect.getPointcuts());
- }
-
- /**
- * Register special logspects which should be used to dynamically instrument
- * custom methods.
- */
- userTracedMethodEntryPointDispatchId = registerUserTracedMethodLogspect(true);
- userTracedMethodNonEntryPointDispatchId = registerUserTracedMethodLogspect(false);
-
- final Map pointcutToDispatchId = registerLoggers(logspects);
-
- if (!Boolean.getBoolean("spm.disableTracingClassTransformer")) {
- dynamicTransformers.add(new TracingClassDynamicTransformer(structuralTransforms));
- } else {
- log.warn("Disabled TracingClassDynamicTransformer");
- }
- if (!Boolean.getBoolean("spm.disableUnloggerTransformer")) {
- dynamicTransformers.add(new UnloggerDynamicTransformer(pointcutToDispatchId));
- } else {
- log.warn("Disabled UnloggerDynamicTransformer");
- }
- if (!Boolean.getBoolean("spm.disableWeavingTransformer")) {
- dynamicTransformers.add(new WeavingClassTrackerDynamicTransformer(pointcuts));
- } else {
- log.warn("Disabled WeavingClassTrackerDynamicTransformer");
- }
- }
-
- public int getUserTracedMethodEntryPointDispatchId() {
- return userTracedMethodEntryPointDispatchId;
- }
-
- public int getUserTracedMethodNonEntryPointDispatchId() {
- return userTracedMethodNonEntryPointDispatchId;
- }
-
- public List getDynamicTransformers() {
- return dynamicTransformers;
- }
-
- public List> getClassesToBeRetransformed() {
- return Arrays.asList(Runnable.class, Thread.class, AbstractExecutorService.class, ThreadPoolExecutor.class);
- }
-
- public static TracingArtifacts create(ClassLoader loader, Config config) {
- final TracingArtifacts artifacts = new TracingArtifacts(loader, config);
- artifacts.initialize();
- return artifacts;
- }
-
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingStatisticsImpl.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingStatisticsImpl.java
deleted file mode 100644
index 113e740..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/TracingStatisticsImpl.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.stats.*;
-
-public final class TracingStatisticsImpl implements TracingStatistics {
-
- private static class StatisticsViewImpl implements StatisticsView {
- private final CrossAppCallStatistics crossAppCallStatistics;
- private final ExternalCallStatistics externalCallStatistics;
- private final RequestComponentStatistics requestComponentStatistics;
- private final RequestStatistics requestStatistics;
- private final RequestErrorsStatistics requestErrorsStatistics;
- private final DatabaseOperationStatistics databaseOperationStatistics;
- private final List processors;
-
- private StatisticsViewImpl(MutableVarProvider varProvider) {
- this.crossAppCallStatistics = new CrossAppCallStatistics(varProvider);
- this.externalCallStatistics = new ExternalCallStatistics(varProvider);
- this.requestComponentStatistics = new RequestComponentStatistics(varProvider);
- this.requestStatistics = new RequestStatistics(varProvider);
- this.requestErrorsStatistics = new RequestErrorsStatistics(varProvider);
- this.databaseOperationStatistics = new DatabaseOperationStatistics(varProvider);
- this.processors = Arrays.asList(
- crossAppCallStatistics,
- externalCallStatistics,
- requestComponentStatistics,
- requestStatistics,
- requestErrorsStatistics,
- databaseOperationStatistics
- );
- }
-
- @Override
- public Collection crossAppCalls() {
- return crossAppCallStatistics.getCrossAppCalls();
- }
-
- @Override
- public Collection externalCalls() {
- return externalCallStatistics.getExternalCalls();
- }
-
- @Override
- public Collection requestMetrics() {
- return requestStatistics.values();
- }
-
- @Override
- public Collection requestErrorMetrics() {
- return requestErrorsStatistics.values();
- }
-
- @Override
- public Collection requestComponentMetrics() {
- return requestComponentStatistics.values();
- }
-
- @Override
- public Collection databaseOperationMetrics() {
- return databaseOperationStatistics.values();
- }
-
- private void update(PartialTransaction transaction) {
- for (StatisticsProcessor processor : processors) {
- processor.process(transaction);
- }
- }
- }
-
- private final List callStatisticsViews = new CopyOnWriteArrayList();
-
- @Override
- public void record(PartialTransaction transaction) {
- for (StatisticsViewImpl view : callStatisticsViews) {
- view.update(transaction);
- }
- }
-
- @Override
- public StatisticsView newCallStatisticsView(MutableVarProvider varProvider) {
- final StatisticsViewImpl view = new StatisticsViewImpl(varProvider);
- callStatisticsViews.add(view);
- return view;
- }
-}
diff --git a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/WeavingTrackingTransformer.java b/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/WeavingTrackingTransformer.java
deleted file mode 100644
index b730718..0000000
--- a/spm-tracing-agent-impl/src/main/java/com/sematext/spm/client/tracing/agent/impl/WeavingTrackingTransformer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.impl;
-
-import java.io.ByteArrayInputStream;
-import java.lang.instrument.ClassFileTransformer;
-import java.lang.instrument.IllegalClassFormatException;
-import java.security.ProtectionDomain;
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.unlogger.Pointcut;
-import com.sematext.spm.client.unlogger.WeaverUtils;
-import com.sematext.spm.client.util.ClassPools;
-
-import javassist.CtClass;
-
-public final class WeavingTrackingTransformer implements ClassFileTransformer, HasTransfomedClasses {
-
- private final Log log = LogFactory.getLog(WeavingTrackingTransformer.class);
-
- private final Set pointcuts;
- private final Set transformedClasses = Collections.newSetFromMap(new ConcurrentHashMap());
- private volatile boolean enabled = false;
-
- public WeavingTrackingTransformer(Set pointcuts) {
- this.pointcuts = pointcuts;
- }
-
- @Override
- public Set getTransformedClasses() {
- return transformedClasses;
- }
-
- public void enable() {
- enabled = true;
- }
-
- public void disable() {
- enabled = false;
- }
-
- @Override
- public byte[] transform(ClassLoader loader, String className, Class> classBeingRedefined,
- ProtectionDomain protectionDomain, byte[] classfileBuffer)
- throws IllegalClassFormatException {
- if (enabled) {
- try {
- final CtClass klass = new ClassPools().getClassPool(loader)
- .makeClass(new ByteArrayInputStream(classfileBuffer));
- if (!WeaverUtils.computeAffectedBehaviours(pointcuts, klass).isEmpty()) {
- transformedClasses.add(className.replace('/', '.'));
- }
- } catch (Exception e) {
- log.error("Can't compute affected behaviours.", e);
- }
- }
- return null;
- }
-}
diff --git a/spm-tracing-agent/pom.xml b/spm-tracing-agent/pom.xml
deleted file mode 100644
index 5d9b80c..0000000
--- a/spm-tracing-agent/pom.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-
- 4.0.0
-
-
- com.sematext.spm
- spm-client-parent
- 3.0.0
-
-
- spm-tracing-agent
- jar
- SPM Tracing Agent
- SPM system monitoring tool
- http://maven.apache.org
-
-
- 2.3.2
-
-
-
-
-
-
-
-
- com.sematext.spm
- spm-monitor-utils
- ${project.version}
-
-
-
-
-
- com.tngtech.java
- junit-dataprovider
- 1.10.0
- test
-
-
-
- com.h2database
- h2
- 1.4.181
- test
-
-
-
- org.hsqldb
- hsqldb
- 2.3.2
- test
-
-
-
- com.mchange
- c3p0
- [0.9.5.5,)
- test
-
-
-
- org.hibernate
- hibernate-entitymanager
- 4.3.6.Final
- test
-
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
-
-
- com.google.guava
- guava
- 18.0
- test
-
-
-
- commons-httpclient
- commons-httpclient
- 3.1
- test
-
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.13
- test
-
-
-
- solr-solrj
- org.apache.solr
- 5.3.0
- jar
- test
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-log4j12
-
-
-
-
- org.apache.logging.log4j
- log4j-core
- 2.17.0
- compile
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.0
-
- ${maven.compile.source}
- ${maven.compile.target}
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.4
-
-
- dist-classic
- package
-
- single
-
-
- ${project.artifactId}-${project.version}-withdeps
- false
-
- jar-with-dependencies
-
-
-
- com.sematext.spm.tracing.TracingAgentBootstrap
- true
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallArray.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallArray.java
deleted file mode 100644
index 25e8e34..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallArray.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-
-public final class CallArray {
- private Call[] array;
- private int n = 0;
-
- public CallArray(int initialSize) {
- array = new Call[initialSize];
-
- for (int i = 0; i < initialSize; i++) {
- array[i] = new Call();
- }
- }
-
- public Call add() {
- resizeIfNeed();
- return array[n++];
- }
-
- private void resizeIfNeed() {
- if (n == array.length) {
- final Call[] resized = new Call[array.length * 2];
- System.arraycopy(array, 0, resized, 0, array.length);
- for (int i = array.length; i < resized.length; i++) {
- resized[i] = new Call();
- }
-
- array = resized;
- }
- }
-
- public void clean() {
- n = 0;
- }
-
- public int size() {
- return n;
- }
-
- public Call get(int i) {
- if (i < 0 || i >= n) {
- throw new IllegalArgumentException("index should be >= 0 and < " + n + ".");
- }
- return array[i];
- }
-
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallSinks.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallSinks.java
deleted file mode 100644
index 4c08ce9..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallSinks.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-
-public final class CallSinks {
- private CallSinks() {
- }
-
- private static final Sink BLACKHOLE_SINK = new Sink() {
- @Override
- public void sink(PartialTransaction transaction) {
- }
- };
-
- public static Sink blackholeSink() {
- return BLACKHOLE_SINK;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallStack.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallStack.java
deleted file mode 100644
index 8b11398..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CallStack.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-
-public final class CallStack {
- private Call[] calls;
- private int n = 0;
-
- public CallStack(int size) {
- this.calls = new Call[size];
- for (int i = 0; i < size; i++) {
- this.calls[i] = new Call();
- }
- }
-
- public Call push() {
- if (n == calls.length) {
- return null;
- }
- return calls[n++];
- }
-
- public Call pop() {
- if (n == 0) {
- return null;
- }
- return calls[--n];
- }
-
- public Call peek() {
- if (n == 0) {
- return null;
- }
- return calls[n - 1];
- }
-
- public void clear() {
- n = 0;
- }
-
- public int size() {
- return n;
- }
-
- public boolean isEmpty() {
- return n == 0;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CrossAppOutInfo.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CrossAppOutInfo.java
deleted file mode 100644
index 38ac0ea..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/CrossAppOutInfo.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-public final class CrossAppOutInfo {
- private final long traceId;
- private final long callId;
- private final long parentCallId;
- private final long startTs;
-
- private CrossAppOutInfo(long traceId, long callId, long parentCallId, long startTs) {
- this.traceId = traceId;
- this.callId = callId;
- this.parentCallId = parentCallId;
- this.startTs = startTs;
- }
-
- public long getTraceId() {
- return traceId;
- }
-
- public long getCallId() {
- return callId;
- }
-
- public long getParentCallId() {
- return parentCallId;
- }
-
- public long getStartTs() {
- return startTs;
- }
-
- public static CrossAppOutInfo create(Trace trace) {
- return new CrossAppOutInfo(trace.getTraceId(), trace.getCallId(), trace.getParentCallId(), System
- .currentTimeMillis());
- }
-
- @Override
- public String toString() {
- return "CrossAppOutInfo{" +
- "traceId=" + traceId +
- ", callId=" + callId +
- ", parentCallId=" + parentCallId +
- ", startTs=" + startTs +
- '}';
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/EventsSink.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/EventsSink.java
deleted file mode 100644
index 5f176b4..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/EventsSink.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-public interface EventsSink> extends Sink {
-
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/MuxSink.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/MuxSink.java
deleted file mode 100644
index e0b327c..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/MuxSink.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-public final class MuxSink implements Sink {
- private final Sink centralSink;
-
- public MuxSink(Sink centralSink) {
- this.centralSink = centralSink;
- }
-
- @Override
- public void sink(T t) {
- centralSink.sink(new SinkEvent(t));
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/NoTrace.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/NoTrace.java
deleted file mode 100644
index f036ba9..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/NoTrace.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.FailureType;
-import com.sematext.spm.client.tracing.agent.model.HttpHeaders;
-import com.sematext.spm.client.unlogger.JoinPoint;
-
-public final class NoTrace implements Trace {
- private static final NoTrace INSTANCE = new NoTrace();
-
- private NoTrace() {
- }
-
- public static NoTrace instance() {
- return INSTANCE;
- }
-
- @Override
- public Boolean isSampled() {
- return true;
- }
-
- @Override
- public long getTraceId() {
- return 0;
- }
-
- @Override
- public long getCallId() {
- return 0;
- }
-
- @Override
- public long getParentCallId() {
- return 0;
- }
-
- @Override
- public Call getCurrentCall() {
- return null;
- }
-
- @Override
- public void setResponseHeaders(ResponseHeaders metadata) {
-
- }
-
- @Override
- public void sendCrossAppOutHeaders() {
-
- }
-
- @Override
- public void newCall(JoinPoint joinPoint) {
-
- }
-
- @Override
- public void newCall(String signature, long startTimestamp) {
-
- }
-
- @Override
- public void setStartTimestamp(long startTimestamp) {
-
- }
-
- @Override
- public void setFailed(Boolean failed) {
-
- }
-
- @Override
- public void setFailureType(FailureType type) {
-
- }
-
- @Override
- public void setException(Throwable t) {
-
- }
-
- @Override
- public void setTransactionParameter(String key, String value) {
-
- }
-
- @Override
- public Map getTransactionParameters() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map getMethodParameters() {
- return Collections.emptyMap();
- }
-
- @Override
- public void setMethodParameter(String key, String value) {
-
- }
-
- @Override
- public void setExternal(Boolean external) {
-
- }
-
- @Override
- public void setSkipExternalTracingStatistics(boolean skip) {
-
- }
-
- @Override
- public void setTag(Call.CallTag tag) {
-
- }
-
- @Override
- public void setEntryPoint(boolean entryPoint) {
-
- }
-
- @Override
- public void endCall() {
-
- }
-
- @Override
- public void endCall(long endTimestamp) {
-
- }
-
- @Override
- public void ignore() {
-
- }
-
- @Override
- public void setCrossAppInHeader(HttpHeaders.CrossAppCallHeader header) {
-
- }
-
- @Override
- public boolean callStackEmpty() {
- return true;
- }
-
- @Override
- public boolean isLastCall() {
- return false;
- }
-
- @Override
- public NoTrace fork() {
- return INSTANCE;
- }
-
- @Override
- public void setCrossAppOutInfo(CrossAppOutInfo crossAppOutInfo) {
-
- }
-
- @Override
- public void setAsync(boolean async) {
-
- }
-
- @Override
- public void setAnnotation(Object annotation) {
-
- }
-
- @Override
- public A getAnnotation() {
- return null;
- }
-
- @Override
- public void setTransactionSummary(Object summary) {
-
- }
-
- @Override
- public Object getTransactionSummary() {
- return null;
- }
-
- private static final TransactionNamer NAMER = new TransactionNamer();
-
- @Override
- public TransactionNamer getNamer() {
- return NAMER;
- }
-
- @Override
- public void forceEnd(boolean failed) {
-
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/ResponseHeaders.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/ResponseHeaders.java
deleted file mode 100644
index 0c74b46..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/ResponseHeaders.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-public interface ResponseHeaders {
- void addHeader(String name, String value);
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Sink.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Sink.java
deleted file mode 100644
index 34b04d9..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Sink.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-public interface Sink {
- void sink(T t);
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/SinkEvent.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/SinkEvent.java
deleted file mode 100644
index e6621f4..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/SinkEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.util.Preconditions;
-
-public final class SinkEvent {
- private final T obj;
-
- public SinkEvent(T obj) {
- Preconditions.checkNotNull(obj);
-
- this.obj = obj;
- }
-
- public T getObj() {
- return obj;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Trace.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Trace.java
deleted file mode 100644
index ec450a2..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Trace.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import java.util.Map;
-
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.FailureType;
-import com.sematext.spm.client.tracing.agent.model.HttpHeaders;
-import com.sematext.spm.client.unlogger.JoinPoint;
-
-public interface Trace {
- long getTraceId();
-
- long getCallId();
-
- long getParentCallId();
-
- Call getCurrentCall();
-
- void setResponseHeaders(ResponseHeaders headers);
-
- void sendCrossAppOutHeaders();
-
- void newCall(JoinPoint joinPoint);
-
- void newCall(String signature, long startTimestamp);
-
- void setStartTimestamp(long startTimestamp);
-
- void setFailed(Boolean failed);
-
- void setFailureType(FailureType type);
-
- void setException(Throwable t);
-
- void setTransactionParameter(String key, String value);
-
- Map getTransactionParameters();
-
- void setMethodParameter(String key, String value);
-
- Map getMethodParameters();
-
- void setExternal(Boolean external);
-
- void setSkipExternalTracingStatistics(boolean skip);
-
- void setTag(Call.CallTag tag);
-
- void setEntryPoint(boolean entryPoint);
-
- void endCall();
-
- void endCall(long endTimestamp);
-
- void ignore();
-
- void setCrossAppInHeader(HttpHeaders.CrossAppCallHeader header);
-
- void setAsync(boolean async);
-
- void setAnnotation(Object annotation);
-
- A getAnnotation();
-
- void setTransactionSummary(Object summary);
-
- Object getTransactionSummary();
-
- boolean callStackEmpty();
-
- boolean isLastCall();
-
- T fork();
-
- Boolean isSampled();
-
- void setCrossAppOutInfo(CrossAppOutInfo crossAppOutInfo);
-
- TransactionNamer getNamer();
-
- void forceEnd(boolean failed);
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Tracing.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Tracing.java
deleted file mode 100644
index 26f5225..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/Tracing.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.model.Call;
-import com.sematext.spm.client.tracing.agent.model.Call.TransactionType;
-import com.sematext.spm.client.tracing.agent.model.Endpoint;
-import com.sematext.spm.client.tracing.agent.model.FailureType;
-import com.sematext.spm.client.tracing.agent.model.HttpHeaders;
-import com.sematext.spm.client.tracing.agent.model.HttpHeaders.CrossAppCallHeader;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.util.AsyncContext;
-import com.sematext.spm.client.tracing.agent.util.Hostname;
-import com.sematext.spm.client.unlogger.JoinPoint;
-
-public final class Tracing {
-
- private static final Log LOG = LogFactory.getLog(Tracing.class);
-
- private static final ThreadLocal RANDOM = new ThreadLocal() {
- @Override
- protected Random initialValue() {
- return new Random();
- }
- };
-
- private static final ThreadLocal CONTEXT = new ThreadLocal() {
- @Override
- protected Trace initialValue() {
- return NoTrace.instance();
- }
- };
-
- private static final ThreadLocal CALL_STACK_POOL = new ThreadLocal() {
- @Override
- protected CallStack initialValue() {
- return new CallStack(ServiceLocator.getConfig().getStackSizeThreshold());
- }
- };
-
- private static final ThreadLocal CALL_ARRAY_POOL = new ThreadLocal() {
- @Override
- protected CallArray initialValue() {
- return new CallArray(100);
- }
- };
-
- private static final Endpoint LOCAL_ENDPOINT = Hostname.getLocalEndpoint();
-
- public static Trace newTrace(String request, TransactionType type) {
- return newTrace(request, type, RANDOM.get().nextLong(), Call.ROOT_CALL_ID);
- }
-
- public static Trace newTrace(String request, TransactionType type, long traceId, long parentCallId) {
- return newTrace(request, type, traceId, parentCallId, ServiceLocator.getTransactionSampler().sample(request));
- }
-
- public static Trace newTrace(String request, TransactionType type, long traceId, long parentCallId, boolean sample) {
- return newTrace(request, type, traceId, parentCallId, sample, false);
- }
-
- public static Trace newTrace(String request, TransactionType type, long traceId, long parentCallId, boolean sample,
- boolean forked) {
- final ActiveTrace trace = new ActiveTrace(request, type, traceId, parentCallId, sample, forked);
- CONTEXT.set(trace);
- return trace;
- }
-
- public static AsyncContext registerAsyncTrace(Object worker) {
- // TODO mark root call for async trace (call.async = true), so in frontend timing can be recalculated
- final Trace trace = Tracing.current();
- if (trace != NoTrace.instance()) {
- final long parentCallId;
- if (trace.getCurrentCall() == null) {
- parentCallId = trace.getParentCallId();
- } else {
- parentCallId = trace.getCallId();
- }
- return AsyncContext.create(worker, trace.getTraceId(), parentCallId, trace.isSampled());
- }
- return null;
- }
-
- public static void setTrace(Trace trace) {
- CONTEXT.set(trace);
- }
-
- public static void endTrace() {
- CONTEXT.remove();
- }
-
- public static Trace extends Trace>> current() {
- return CONTEXT.get();
- }
-
- public static class ActiveTrace implements Trace {
- private final long traceId;
- private final long parentCallId;
- private final CallStack stack;
- private final String request;
- private final boolean sampled;
- private final CallArray sunkCalls;
- private final boolean forked;
- private final TransactionType type;
- private ResponseHeaders responseHeaders;
- private CrossAppOutInfo crossAppOutInfo;
- private Object transactionSummary;
- private final TransactionNamer namer = new TransactionNamer();
- private boolean async;
- private FailureType failureType;
- private Throwable exception;
- private boolean ignore;
- private final Map parameters = new HashMap();
-
- public ActiveTrace(String request, TransactionType type, long traceId, long parentCallId, boolean sampled,
- boolean forked) {
- this.traceId = traceId;
- this.parentCallId = parentCallId;
- this.stack = CALL_STACK_POOL.get();
- this.stack.clear();
- this.request = request;
- this.type = type;
- this.sampled = sampled;
- this.forked = forked;
- this.sunkCalls = CALL_ARRAY_POOL.get();
- this.sunkCalls.clean();
- this.async = false;
- this.failureType = null;
- this.exception = null;
- this.ignore = false;
- }
-
- @Override
- public Boolean isSampled() {
- return sampled;
- }
-
- @Override
- public long getTraceId() {
- return traceId;
- }
-
- @Override
- public long getCallId() {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- return currentCall.getCallId();
- }
- return Call.ROOT_CALL_ID;
- }
-
- @Override
- public long getParentCallId() {
- return parentCallId;
- }
-
- @Override
- public Call getCurrentCall() {
- return stack.peek();
- }
-
- @Override
- public void setCrossAppOutInfo(CrossAppOutInfo crossAppOutInfo) {
- this.crossAppOutInfo = crossAppOutInfo;
- }
-
- @Override
- public void setResponseHeaders(ResponseHeaders metadata) {
- this.responseHeaders = metadata;
- }
-
- @Override
- public void sendCrossAppOutHeaders() {
- if (this.responseHeaders != null && this.crossAppOutInfo != null) {
- long duration = System.currentTimeMillis() - crossAppOutInfo.getStartTs();
- boolean sampled = duration >= ServiceLocator.getConfig().getDurationThresholdMillis();
- final String header = HttpHeaders.encodeCrossAppCallHeader(
- crossAppOutInfo.getCallId(),
- crossAppOutInfo.getParentCallId(),
- crossAppOutInfo.getTraceId(),
- duration,
- ServiceLocator.getConfig().getToken(),
- request,
- LOCAL_ENDPOINT,
- sampled
- );
- this.responseHeaders.addHeader(HttpHeaders.SPM_TRACING_CROSS_APP_CALL, header);
- }
- }
-
- @Override
- public void newCall(JoinPoint jp) {
- newCall(String.format("%s#%s()", jp.getType(), jp.getShortName()), System.currentTimeMillis());
- }
-
- @Override
- public void newCall(String signature, long startTime) {
- final Call currentCall = getCurrentCall();
-
- if (stack.size() >= ServiceLocator.getConfig().getStackSizeThreshold()) {
- LOG.warn(String.format("Call stack threshold [%s] exceeded for token %s", ServiceLocator.getConfig()
- .getStackSizeThreshold(), ServiceLocator.getConfig().getToken()));
- return;
- }
-
- final Call call = stack.push();
- call.setChildDuration(0);
- call.setSignature(signature);
- call.setStartTimestamp(startTime);
- call.setLevel(stack.size());
- call.setCallId(RANDOM.get().nextLong());
- call.setCallTag(Call.CallTag.REGULAR);
- call.setParent(null);
- call.setEntryPoint(false);
- call.setCrossAppToken(null);
- call.setCrossAppCallId(null);
- call.setCrossAppParentCallId(null);
- call.setCrossAppDuration(null);
- call.setAnnotation(null);
- call.setFailed(false);
- call.setSkipExternalTracingStatistics(false);
- call.getParameters().clear();
-
- if (currentCall != null) {
- call.setParentCallId(currentCall.getCallId());
- call.setParent(currentCall);
- } else {
- call.setParentCallId(parentCallId);
- }
- }
-
- @Override
- public void setStartTimestamp(long startTimestamp) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setStartTimestamp(startTimestamp);
- }
- }
-
- @Override
- public void setFailed(Boolean failed) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setFailed(failed);
- }
- }
-
- @Override
- public void setFailureType(FailureType type) {
- this.failureType = type;
- }
-
- @Override
- public void setException(Throwable t) {
- this.exception = t;
- }
-
- @Override
- public void setTransactionParameter(String key, String value) {
- this.parameters.put(key, value);
- }
-
- @Override
- public Map getTransactionParameters() {
- return this.parameters;
- }
-
- @Override
- public void setMethodParameter(String key, String value) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.getParameters().put(key, value);
- }
- }
-
- @Override
- public Map getMethodParameters() {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- return currentCall.getParameters();
- }
- return Collections.emptyMap();
- }
-
- @Override
- public void setExternal(Boolean external) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setExternal(external);
- }
- }
-
- @Override
- public void setSkipExternalTracingStatistics(boolean skip) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setSkipExternalTracingStatistics(skip);
- }
- }
-
- @Override
- public void setTag(Call.CallTag tag) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setCallTag(tag);
- }
- }
-
- @Override
- public void setEntryPoint(boolean entryPoint) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setEntryPoint(entryPoint);
- }
- }
-
- @Override
- public void setCrossAppInHeader(final CrossAppCallHeader header) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null && header != null) {
- currentCall.setCrossAppToken(header.getToken());
- currentCall.setCrossAppCallId(header.getCallId());
- currentCall.setCrossAppParentCallId(header.getParentCallId());
- currentCall.setCrossAppDuration(header.getDuration());
- currentCall.setCrossAppEndpoint(header.getEndpoint());
- currentCall.setCrossAppRequest(header.getRequest());
- currentCall.setCrossAppSampled(header.isSampled());
- }
- }
-
- @Override
- public void setAsync(boolean async) {
- this.async = async;
- }
-
- @Override
- public void setAnnotation(Object annotation) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setAnnotation(annotation);
- }
- }
-
- @Override
- public A getAnnotation() {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- return (A) currentCall.getAnnotation();
- }
- return null;
- }
-
- @Override
- public void setTransactionSummary(Object summary) {
- this.transactionSummary = summary;
- }
-
- @Override
- public Object getTransactionSummary() {
- return transactionSummary;
- }
-
- @Override
- public void endCall() {
- endCall(System.currentTimeMillis());
- }
-
- @Override
- public void ignore() {
- this.ignore = true;
- }
-
- @Override
- public TransactionNamer getNamer() {
- return namer;
- }
-
- private PartialTransaction createTransaction() {
- final PartialTransaction transaction = new PartialTransaction();
- final Call rootCall = sunkCalls.get(sunkCalls.size() - 1);
- transaction.setCallId(rootCall.getCallId());
- transaction.setParentCallId(rootCall.getParentCallId());
- transaction.setTraceId(traceId);
- transaction.setEndpoint(LOCAL_ENDPOINT);
- transaction.setAsynchronous(async);
- transaction.setTransactionType(type);
- transaction.setTransactionSummary(transactionSummary);
- transaction.setStartTimestamp(rootCall.getStartTimestamp());
- transaction.setEndTimestamp(rootCall.getEndTimestamp());
- transaction.setDuration(rootCall.getDuration());
- transaction.setFailed(rootCall.getFailed());
- if (forked) {
- transaction.setRequest(request);
- } else {
- transaction.setRequest(namer.getName());
- }
- transaction.setToken(ServiceLocator.getConfig().getToken());
- transaction.setEntryPoint(rootCall.isEntryPoint());
- transaction.setExceptionStackTrace(exception);
- transaction.setFailureType(failureType);
- transaction.setParameters(parameters);
-
- final List calls = new ArrayList();
- for (int i = 0; i < sunkCalls.size(); i++) {
- final Call call = new Call();
- sunkCalls.get(i).copy(call);
- calls.add(call);
- }
-
- transaction.setCalls(calls);
-
- return transaction;
- }
-
- @Override
- public void endCall(long endTimestamp) {
- final Call currentCall = getCurrentCall();
- if (currentCall != null) {
- currentCall.setEndTimestamp(endTimestamp);
- final long duration = endTimestamp - currentCall.getStartTimestamp();
- currentCall.setDuration(duration);
- currentCall.setSelfDuration(duration - currentCall.getChildDuration());
- if (currentCall.getParent() != null) {
- long childDuration = currentCall.getParent().getChildDuration();
-
- currentCall.getParent().setChildDuration(childDuration + duration);
- currentCall.setParent(null);
- }
-
- currentCall.copy(sunkCalls.add());
- }
- stack.pop();
-
- if (stack.isEmpty()) {
- if (!ignore) {
- final PartialTransaction transaction = createTransaction();
- ServiceLocator.getTracingStatistics().record(transaction);
-
- if (currentCall != null && (forked || currentCall.getDuration() >= ServiceLocator.getConfig()
- .getDurationThresholdMillis())) {
- sinkTransaction(transaction);
- }
-
- if (currentCall == null && LOG.isDebugEnabled()) {
- LOG.debug(
- "Transaction will not be sinked because current call is null, endpoint: " + transaction.getEndpoint());
- }
-
- if (currentCall != null && LOG.isDebugEnabled()) {
- LOG.debug("Transaction will not be sinked because it is under threshold, duration is: " + currentCall
- .getDuration() + ", endpoint is: " + transaction.getEndpoint());
- }
- }
-
- sunkCalls.clean();
- }
-
- }
-
- private void sinkTransaction(PartialTransaction transaction) {
- if (sampled) {
- for (Sink sink : ServiceLocator.getTransactionSinks()) {
- try {
- sink.sink(transaction);
- } catch (Throwable e) {
- LOG.warn("Can't sink transaction", e);
- }
- }
- }
- }
-
- @Override
- public boolean callStackEmpty() {
- return stack.isEmpty();
- }
-
- @Override
- public boolean isLastCall() {
- return stack.size() == 1;
- }
-
- @Override
- public ActiveTrace fork() {
- return new ActiveTrace(request, type, getTraceId(), getCallId(), sampled, true);
- }
-
- @Override
- public void forceEnd(boolean failed) {
- while (stack.size() > 1) {
- endCall();
- }
- if (!stack.isEmpty()) {
- stack.peek().setFailed(failed);
- endCall();
- }
- }
-
- @Override
- public String toString() {
- return "ActiveTrace{" +
- "traceId=" + traceId +
- ", parentCallId=" + parentCallId +
- ", request='" + request + '\'' +
- ", sampled=" + sampled +
- ", forked=§" + forked +
- ", type=" + type +
- ", responseHeaders=" + responseHeaders +
- ", crossAppOutInfo=" + crossAppOutInfo +
- ", async=" + async +
- ", failureType=" + failureType +
- '}';
- }
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TracingAgentControl.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TracingAgentControl.java
deleted file mode 100644
index 265289d..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TracingAgentControl.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.unlogger.dynamic.InstrumentationSettings;
-
-public interface TracingAgentControl {
- boolean enable();
-
- boolean disable();
-
- boolean isEnabled();
-
- InstrumentationSettings getInstrumentationSettings();
-
- boolean applyInstrumentationSettings();
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionNamer.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionNamer.java
deleted file mode 100644
index 47a2e05..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionNamer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.unlogger.JoinPoint;
-
-public final class TransactionNamer {
- private String servlet;
- private String framework;
- private String customName;
-
- public static String format(JoinPoint jp) {
- return String.format("%s#%s", jp.getType(), jp.getShortName());
- }
-
- public void asServlet(JoinPoint jp) {
- this.servlet = format(jp);
- }
-
- public void asFramework(JoinPoint jp) {
- this.framework = format(jp);
- }
-
- public void redefined(String customName) {
- this.customName = customName;
- }
-
- public String getName() {
- if (customName != null) {
- return customName;
- }
- if (framework != null) {
- return framework;
- }
- return servlet;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionSink.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionSink.java
deleted file mode 100644
index 34ce2b1..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/TransactionSink.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent;
-
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-
-public interface TransactionSink extends Sink {
-
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/api/TransactionAccess.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/api/TransactionAccess.java
deleted file mode 100644
index 1e6676e..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/api/TransactionAccess.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.api;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.sematext.spm.client.tracing.TracingParameters;
-import com.sematext.spm.client.tracing.agent.Tracing;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.errors.ErrorsTracker;
-import com.sematext.spm.client.tracing.agent.model.FailureType;
-import com.sematext.spm.client.util.Preconditions;
-
-public final class TransactionAccess {
-
- private TransactionAccess() {
- }
-
- public static void setName(String name) {
- Preconditions.checkNotNull(name);
-
- Tracing.current().getNamer().redefined(name);
- }
-
- public static void ignore() {
- Tracing.current().ignore();
- }
-
- private static void forceTransactionEnd(FailureType type, Throwable throwable, String message) {
- Tracing.current().setFailureType(type);
-
- if (throwable != null) {
- Tracing.current().setException(throwable);
- }
-
- if (message != null) {
- Tracing.current().setTransactionParameter(TracingParameters.ERROR_MESSAGE.getKey(), message);
- }
-
- Tracing.current().forceEnd(true);
- Tracing.endTrace();
- }
-
- public static void noticeError(Throwable th) {
- Preconditions.checkNotNull(th);
-
- ErrorsTracker.track(th, null);
- forceTransactionEnd(FailureType.EXCEPTION, th, null);
- }
-
- public static void noticeError(String message) {
- Preconditions.checkNotNull(message);
-
- ErrorsTracker.track(null, message);
- forceTransactionEnd(FailureType.CUSTOM, null, message);
- }
-
- public static void setTransactionParameter(String key, String value) {
- Preconditions.checkNotNull(key);
- Preconditions.checkNotNull(value);
- Preconditions.check(key.length() > 0 && key.length() <= ServiceLocator.getConfig().getMaxCustomParameterKeyLength(),
- "Key length should be > 0 and <= " + ServiceLocator.getConfig()
- .getMaxCustomParameterKeyLength());
- Preconditions
- .check(value.length() > 0 && value.length() <= ServiceLocator.getConfig().getMaxCustomParameterValueLength(),
- "Value length should be > 0 and <= " + ServiceLocator.getConfig().getMaxCustomParameterValueLength());
-
- Preconditions.check(Tracing.current().getTransactionParameters().size() < ServiceLocator.getConfig()
- .getMaxCustomTransactionParametersCount(),
- "Parameters count should be <= " + ServiceLocator.getConfig()
- .getMaxCustomTransactionParametersCount());
- Tracing.current().setTransactionParameter(key, value);
- }
-
- public static Map getTransactionParameters() {
- return Collections.unmodifiableMap(Tracing.current().getTransactionParameters());
- }
-
- public static void setMethodParameter(String key, String value) {
- Preconditions.checkNotNull(key);
- Preconditions.checkNotNull(value);
- Preconditions.check(key.length() > 0 && key.length() <= ServiceLocator.getConfig().getMaxCustomParameterKeyLength(),
- "Key length should be > 0 and <= " + ServiceLocator.getConfig()
- .getMaxCustomParameterKeyLength());
- Preconditions
- .check(value.length() > 0 && value.length() <= ServiceLocator.getConfig().getMaxCustomParameterValueLength(),
- "Value length should be > 0 and <= " + ServiceLocator.getConfig().getMaxCustomParameterValueLength());
-
- Preconditions.check(Tracing.current().getTransactionParameters().size() < ServiceLocator.getConfig()
- .getMaxCustomMethodParametersCount(),
- "Parameters count should be <= " + ServiceLocator.getConfig()
- .getMaxCustomMethodParametersCount());
- Tracing.current().setMethodParameter(key, value);
- }
-
- public static Map getMethodParameters() {
- return Collections.unmodifiableMap(Tracing.current().getMethodParameters());
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/Config.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/Config.java
deleted file mode 100644
index fe81cb0..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/Config.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.config;
-
-import java.io.File;
-import java.util.Map;
-
-import com.sematext.spm.client.Log;
-import com.sematext.spm.client.LogFactory;
-import com.sematext.spm.client.monitor.MonitorFileNames;
-import com.sematext.spm.client.util.AgentArgsParser;
-import com.sematext.spm.client.util.FileUtil;
-import com.sematext.spm.client.util.PropertiesReader;
-
-public class Config {
- private static final Log LOG = LogFactory.getLog(Config.class);
-
- private static final int MAX_CUSTOM_PARAMETERS_COUNT = 10;
- private static final int MAX_CUSTOM_PARAMETER_LENGTH = 256;
-
- private static final long THRESHOLD_LOWER_BOUND = 0;
- private static final int STACK_THRESHOLD_LOWER_BOUND = 1000;
- private static final String THRESHOLD_KEY = "MIN_TRANSACTION_DURATION_RECORD_THRESHOLD";
- private static final String STACK_SIZE_THRESHOLD_KEY = "CALL_STACK_SIZE_THRESHOLD";
- private static final String THREAD_INSTRUMENTATION_ENABLED_KEY = "THREAD_INSTRUMENTATION_ENABLED";
-
- private long durationThresholdMillis;
- private int stackSizeThreshold = STACK_THRESHOLD_LOWER_BOUND;
- private String token;
- private String jvm;
- private String subType;
- private String spmMonitorHome;
- private String logPath;
- private String confPath;
- private String extensionsPath;
- private boolean threadInstrumentationEnabled;
- private int maxCustomParameterKeyLength = MAX_CUSTOM_PARAMETER_LENGTH;
- private int maxCustomParameterValueLength = MAX_CUSTOM_PARAMETER_LENGTH;
- private int maxCustomTransactionParametersCount = MAX_CUSTOM_PARAMETERS_COUNT;
- private int maxCustomMethodParametersCount = MAX_CUSTOM_PARAMETERS_COUNT;
-
- public Config() {
- }
-
- public long getDurationThresholdMillis() {
- return durationThresholdMillis;
- }
-
- public int getStackSizeThreshold() {
- return stackSizeThreshold;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getJvm() {
- return jvm;
- }
-
- public void setJvm(String jvm) {
- this.jvm = jvm;
- }
-
- public String getSpmMonitorHome() {
- return spmMonitorHome;
- }
-
- public void setSpmMonitorHome(String spmMonitorHome) {
- this.spmMonitorHome = spmMonitorHome;
- }
-
- public String getLogPath() {
- return logPath;
- }
-
- public void setLogPath(String logPath) {
- this.logPath = logPath;
- }
-
- public String getConfPath() {
- return confPath;
- }
-
- public void setConfPath(String confPath) {
- this.confPath = confPath;
- }
-
- public String getExtensionsPath() {
- return extensionsPath;
- }
-
- public boolean isThreadInstrumentationEnabled() {
- return threadInstrumentationEnabled;
- }
-
- public void setThreadInstrumentationEnabled(boolean threadInstrumentationEnabled) {
- this.threadInstrumentationEnabled = threadInstrumentationEnabled;
- }
-
- public void setDurationThresholdMillis(long durationThresholdMillis) {
- this.durationThresholdMillis = durationThresholdMillis;
- }
-
- public void setStackSizeThreshold(int stackSizeThreshold) {
- this.stackSizeThreshold = stackSizeThreshold;
- }
-
- public void setExtensionsPath(String extensionsPath) {
- this.extensionsPath = extensionsPath;
- }
-
- public int getMaxCustomParameterKeyLength() {
- return maxCustomParameterKeyLength;
- }
-
- public void setMaxCustomParameterKeyLength(int maxCustomParameterKeyLength) {
- this.maxCustomParameterKeyLength = maxCustomParameterKeyLength;
- }
-
- public int getMaxCustomParameterValueLength() {
- return maxCustomParameterValueLength;
- }
-
- public void setMaxCustomParameterValueLength(int maxCustomParameterValueLength) {
- this.maxCustomParameterValueLength = maxCustomParameterValueLength;
- }
-
- public int getMaxCustomTransactionParametersCount() {
- return maxCustomTransactionParametersCount;
- }
-
- public void setMaxCustomTransactionParametersCount(int maxCustomTransactionParametersCount) {
- this.maxCustomTransactionParametersCount = maxCustomTransactionParametersCount;
- }
-
- public int getMaxCustomMethodParametersCount() {
- return maxCustomMethodParametersCount;
- }
-
- public void setMaxCustomMethodParametersCount(int maxCustomMethodParametersCount) {
- this.maxCustomMethodParametersCount = maxCustomMethodParametersCount;
- }
-
- public static Config getConfig(String args) {
- Config config = new Config();
- config.durationThresholdMillis = 0;
- final Map agentArgs = AgentArgsParser.parseColonSeparated(args);
- config.token = agentArgs.get("token");
- config.jvm = agentArgs.get("jvm-name");
- if (config.jvm == null) {
- config.jvm = "default";
- }
- config.spmMonitorHome = FileUtil.path(System.getProperty("spm.home", "/opt/spm"), "spm-monitor");
- if (config.subType != null) {
- config.logPath = FileUtil
- .path(config.spmMonitorHome, "logs", "applications", config.token, config.jvm, config.subType);
- } else {
- config.logPath = FileUtil.path(config.spmMonitorHome, "logs", "applications", config.token, config.jvm);
- }
- config.confPath = FileUtil.path(config.spmMonitorHome, "conf");
- return config;
- }
-
- public static Config embeddedAgentConfig(String args) {
- final Config config = new Config();
- final Map agentArgs = AgentArgsParser.parseColonSeparated(args);
- config.token = agentArgs.get("token");
- config.jvm = agentArgs.get("jvm-name");
- if (config.jvm == null) {
- config.jvm = "default";
- }
- config.subType = agentArgs.get("sub-type");
- config.spmMonitorHome = FileUtil.path(System.getProperty("spm.home", "/opt/spm"), "spm-monitor");
- if (config.subType == null) {
- config.logPath = FileUtil.path(config.spmMonitorHome, "logs", "applications", config.token, config.jvm);
- } else {
- config.logPath = FileUtil
- .path(config.spmMonitorHome, "logs", "applications", config.token, config.jvm, config.subType);
- }
- config.confPath = FileUtil.path(config.spmMonitorHome, "conf");
- config.extensionsPath = FileUtil.path(config.spmMonitorHome, "ext", "tracing");
-
- final String configFilename = MonitorFileNames.config(null, config.token, config.jvm);
- final Map properties = PropertiesReader
- .tryRead(new File(FileUtil.path(config.confPath, configFilename)));
-
- final String durationThresholdMillis = properties.get(THRESHOLD_KEY);
- final String stackSizeThreshold = properties.get(STACK_SIZE_THRESHOLD_KEY);
-
- if (durationThresholdMillis != null) {
- try {
- config.durationThresholdMillis = Integer.parseInt(durationThresholdMillis);
- } catch (NumberFormatException e) {
- /* */
- }
-
- if (config.durationThresholdMillis < THRESHOLD_LOWER_BOUND) {
- LOG.warn(THRESHOLD_KEY + " property has wrong value: " + durationThresholdMillis + ", using default value: "
- + THRESHOLD_LOWER_BOUND + ".");
- config.durationThresholdMillis = THRESHOLD_LOWER_BOUND;
- }
- } else {
- config.durationThresholdMillis = THRESHOLD_LOWER_BOUND;
- LOG.warn(THRESHOLD_KEY + " property is not set, using default value: " + THRESHOLD_LOWER_BOUND + ".");
- }
-
- if (stackSizeThreshold != null) {
- try {
- config.stackSizeThreshold = Integer.parseInt(stackSizeThreshold);
- } catch (NumberFormatException e) {
- /* */
- }
- } else {
- config.stackSizeThreshold = STACK_THRESHOLD_LOWER_BOUND;
- }
-
- final String isThreadInstrumentationEnabled = properties.get(THREAD_INSTRUMENTATION_ENABLED_KEY);
- config.threadInstrumentationEnabled =
- isThreadInstrumentationEnabled == null || Boolean.valueOf(isThreadInstrumentationEnabled);
-
- if (!config.threadInstrumentationEnabled) {
- LOG.info("Thread instrumentation is disabled.");
- }
-
- return config;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceConfigurer.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceConfigurer.java
deleted file mode 100644
index b84a4ce..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceConfigurer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.config;
-
-import java.util.List;
-
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.TracingAgentControl;
-import com.sematext.spm.client.tracing.agent.errors.TracingError;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.sampling.Sampler;
-import com.sematext.spm.client.tracing.agent.stats.TracingStatistics;
-
-public interface ServiceConfigurer {
- Config getConfig();
-
- Sampler getTransactionSampler();
-
- Sampler getTracingErrorSampler();
-
- List> getTransactionSinks();
-
- TracingStatistics getTracingStatistics();
-
- List> getErrorSinks();
-
- TracingAgentControl getTracingAgentControl();
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceLocator.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceLocator.java
deleted file mode 100644
index e2d121b..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/config/ServiceLocator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.config;
-
-import java.util.List;
-
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.TracingAgentControl;
-import com.sematext.spm.client.tracing.agent.errors.TracingError;
-import com.sematext.spm.client.tracing.agent.model.PartialTransaction;
-import com.sematext.spm.client.tracing.agent.sampling.Sampler;
-import com.sematext.spm.client.tracing.agent.stats.NoOpTracingStatistics;
-import com.sematext.spm.client.tracing.agent.stats.TracingStatistics;
-
-public class ServiceLocator {
- private static ServiceConfigurer CONFIGURER;
-
- public static void configure(ServiceConfigurer configurer) {
- CONFIGURER = configurer;
- }
-
- public static Config getConfig() {
- return CONFIGURER.getConfig();
- }
-
- public static Sampler getTransactionSampler() {
- return CONFIGURER.getTransactionSampler();
- }
-
- public static Sampler getTracingErrorSampler() {
- return CONFIGURER.getTracingErrorSampler();
- }
-
- public static List> getTransactionSinks() {
- return CONFIGURER.getTransactionSinks();
- }
-
- public static List> getErrorSinks() {
- return CONFIGURER.getErrorSinks();
- }
-
- public static TracingStatistics getTracingStatistics() {
- if (CONFIGURER == null || CONFIGURER.getTracingStatistics() == null) {
- return NoOpTracingStatistics.noOp();
- }
- return CONFIGURER.getTracingStatistics();
- }
-
- public static TracingAgentControl getTracingAgentControl() {
- return CONFIGURER.getTracingAgentControl();
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorSink.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorSink.java
deleted file mode 100644
index 44ad4c0..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorSink.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.errors;
-
-public interface ErrorSink {
- void sink(TracingError tracingError);
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorsTracker.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorsTracker.java
deleted file mode 100644
index 659ffe8..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/ErrorsTracker.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.errors;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.sematext.spm.client.tracing.TracingParameters;
-import com.sematext.spm.client.tracing.agent.NoTrace;
-import com.sematext.spm.client.tracing.agent.Sink;
-import com.sematext.spm.client.tracing.agent.Trace;
-import com.sematext.spm.client.tracing.agent.Tracing;
-import com.sematext.spm.client.tracing.agent.config.ServiceLocator;
-import com.sematext.spm.client.tracing.agent.util.Hostname;
-
-public class ErrorsTracker {
-
- public static void track(Throwable throwable, String message) {
- final Trace extends Trace>> trace = Tracing.current();
- final String token = ServiceLocator.getConfig().getToken();
-
- final Long traceId = trace == NoTrace.instance() ? null : trace.getTraceId();
- final Long callId = trace == NoTrace.instance() ? null : trace.getCallId();
- final Long parentCallId = trace == NoTrace.instance() ? null : trace.getParentCallId();
- final boolean sampled = trace.isSampled();
- final Map parameters = new HashMap(trace.getTransactionParameters());
- if (message != null) {
- parameters.put(TracingParameters.ERROR_MESSAGE.getKey(), message);
- }
- if (throwable != null) {
- parameters.put(TracingParameters.ERROR_CLASS.getKey(), throwable.getClass().getName());
- }
- parameters.put(TracingParameters.HOST.getKey(), Hostname.getLocalEndpoint().getHostname());
-
- final TracingError error = new TracingError(token, traceId, callId, parentCallId,
- System.currentTimeMillis(), sampled, parameters);
-
- sink(error);
- }
-
- private static void sink(TracingError tracingError) {
- if (ServiceLocator.getErrorSinks() != null) {
- for (Sink sink : ServiceLocator.getErrorSinks()) {
- if (ServiceLocator.getTracingErrorSampler() == null || ServiceLocator.getTracingErrorSampler()
- .sample(tracingError)) {
- sink.sink(tracingError);
- }
- }
- }
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/TracingError.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/TracingError.java
deleted file mode 100644
index dc6b78c..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/errors/TracingError.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.errors;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class TracingError {
- private String token;
- private Long traceId;
- private Long callId;
- private Long parentCallId;
- private long timestamp;
- private boolean sampled;
- private Map parameters;
-
- public TracingError() {
- }
-
- public TracingError(String token, Long traceId, Long callId, Long parentCallId, long timestamp, boolean sampled,
- Map parameters) {
- this.token = token;
- this.traceId = traceId;
- this.callId = callId;
- this.parentCallId = parentCallId;
- this.timestamp = timestamp;
- this.sampled = sampled;
- this.parameters = parameters;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public Long getTraceId() {
- return traceId;
- }
-
- public void setTraceId(Long traceId) {
- this.traceId = traceId;
- }
-
- public Long getCallId() {
- return callId;
- }
-
- public void setCallId(Long callId) {
- this.callId = callId;
- }
-
- public Long getParentCallId() {
- return parentCallId;
- }
-
- public void setParentCallId(Long parentCallId) {
- this.parentCallId = parentCallId;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public boolean isSampled() {
- return sampled;
- }
-
- public void setSampled(boolean sampled) {
- this.sampled = sampled;
- }
-
- public Map getParameters() {
- return parameters;
- }
-
- public void setParameters(Map parameters) {
- this.parameters = parameters;
- }
-
- public void copy(TracingError to) {
- to.token = token;
- to.traceId = traceId;
- to.callId = callId;
- to.parentCallId = parentCallId;
- to.timestamp = timestamp;
- to.sampled = sampled;
- to.parameters = new HashMap(parameters);
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/ESAsyncActions.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/ESAsyncActions.java
deleted file mode 100644
index 39b5c1a..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/ESAsyncActions.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.es.transport;
-
-import com.sematext.spm.client.tracing.agent.model.annotation.ESAnnotation;
-
-public final class ESAsyncActions {
- private final Long traceId;
- private final Long parentCallId;
- private final Long startTs;
- private final boolean sampled;
- private final ESAnnotation annotation;
-
- public ESAsyncActions(ESAnnotation annotation, Long traceId, Long parentCallId, Long startTs, boolean sampled) {
- this.annotation = annotation;
- this.traceId = traceId;
- this.parentCallId = parentCallId;
- this.startTs = startTs;
- this.sampled = sampled;
- }
-
- public ESAnnotation getAnnotation() {
- return annotation;
- }
-
- public Long getTraceId() {
- return traceId;
- }
-
- public Long getParentCallId() {
- return parentCallId;
- }
-
- public Long getStartTs() {
- return startTs;
- }
-
- public boolean isSampled() {
- return sampled;
- }
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmActionRequestBuilderAccess.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmActionRequestBuilderAccess.java
deleted file mode 100644
index 52b715d..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmActionRequestBuilderAccess.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.es.transport;
-
-import com.sematext.spm.client.instrumentation.Delegate;
-import com.sematext.spm.client.instrumentation.Getter;
-import com.sematext.spm.client.instrumentation.Setter;
-
-public interface SpmActionRequestBuilderAccess {
- @Delegate(method = "request")
- Object _$spm_tracing$_getRequest();
-
- @Setter(value = "_$spm_tracing$_client")
- void _$spm_tracing$_setClient(Object client);
-
- @Getter(value = "_$spm_tracing$_client")
- Object _$spm_tracing$_getClient();
-}
diff --git a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmBulkRequestAccess.java b/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmBulkRequestAccess.java
deleted file mode 100644
index 5c0ec9b..0000000
--- a/spm-tracing-agent/src/main/java/com/sematext/spm/client/tracing/agent/es/transport/SpmBulkRequestAccess.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to Sematext Group, Inc
- *
- * See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Sematext Group, Inc 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
- *
- * 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.
- */
-package com.sematext.spm.client.tracing.agent.es.transport;
-
-import java.util.List;
-
-import com.sematext.spm.client.instrumentation.Delegate;
-
-public interface SpmBulkRequestAccess {
- @Delegate(method = "requests")
- List