Skip to content

Commit

Permalink
Fixed the jar name for the aspectjweaver (apache#775)
Browse files Browse the repository at this point in the history
* Fixed the jar name for the aspectjweaver

* Use runtime loader
  • Loading branch information
merlimat authored Sep 21, 2017
1 parent 79a7790 commit 696c4a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 0 additions & 7 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,11 @@ elif [ $COMMAND == "bookie" ]; then
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.proto.BookieServer --conf $PULSAR_BOOKKEEPER_CONF $@
elif [ $COMMAND == "zookeeper" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"zookeeper.log"}

# Add instrumentation
WEAVER_JAR=`find $PULSAR_HOME/lib -name 'aspectjweaver-*.jar'`
if [ -n "$WEAVER_JAR" ]; then OPTS="$OPTS -javaagent:$WEAVER_JAR"; fi
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.zookeeper.ZooKeeperStarter $PULSAR_ZK_CONF $@
elif [ $COMMAND == "global-zookeeper" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"global-zookeeper.log"}
# Allow global ZK to turn into read-only mode when it cannot reach the quorum
OPTS="${OPTS} -Dreadonlymode.enabled=true"
# Add instrumentation
WEAVER_JAR=`find $PULSAR_HOME/lib -name 'aspectjweaver-*.jar'`
if [ -n "$WEAVER_JAR" ]; then OPTS="$OPTS -javaagent:$WEAVER_JAR"; fi
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.zookeeper.ZooKeeperStarter $PULSAR_GLOBAL_ZK_CONF $@
elif [ $COMMAND == "discovery" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"discovery.log"}
Expand Down
5 changes: 5 additions & 0 deletions pulsar-zookeeper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>

<dependency>
<groupId>com.ea.agentloader</groupId>
<artifactId>ea-agent-loader</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
import java.net.InetSocketAddress;

import org.apache.zookeeper.server.quorum.QuorumPeerMain;
import org.aspectj.weaver.loadtime.Agent;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ea.agentloader.AgentLoader;

import io.prometheus.client.exporter.MetricsServlet;
import io.prometheus.client.hotspot.DefaultExports;

Expand All @@ -35,6 +38,9 @@ public static void main(String[] args) throws Exception {
// Register basic JVM metrics
DefaultExports.initialize();

// load aspectj-weaver agent for instrumentation
AgentLoader.loadAgentClass(Agent.class.getName(), null);

// Start Jetty to serve stats
int port = Integer.parseInt(System.getProperties().getProperty("stats_server_port", "8080"));

Expand Down

0 comments on commit 696c4a9

Please sign in to comment.