Skip to content

Commit

Permalink
[pinpoint-apm#9063] Added option to operate only metric module
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoo-jung committed Jul 22, 2022
1 parent 9b96675 commit 8d7387e
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.navercorp.pinpoint.common.server.env.ExternalEnvironmentListener;
import com.navercorp.pinpoint.common.server.env.ProfileResolveListener;
import com.navercorp.pinpoint.common.server.util.ServerBootLogger;
import com.navercorp.pinpoint.common.util.ArrayUtils;
import com.navercorp.pinpoint.metric.collector.MetricCollectorApp;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringBootConfiguration;
Expand All @@ -14,6 +15,9 @@
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;

import java.util.Arrays;
import java.util.List;

@SpringBootConfiguration
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, TransactionAutoConfiguration.class})
public class MultiApplication {
Expand All @@ -30,11 +34,20 @@ public static void main(String[] args) {
builder.sources(MultiApplication.class);
builder.listeners(new ProfileResolveListener());

SpringApplicationBuilder collectorAppBuilder = createAppBuilder(builder, BasicCollectorApp.class, 1111);
SpringApplicationBuilder metricAppBuilder = createAppBuilder(builder, MetricCollectorApp.class, 8081);
metricAppBuilder.build().run(args);

if (ArrayUtils.isEmpty(args) == false) {
List<String> argList = Arrays.asList(args);
logger.info("args data : " + argList);
if (argList.contains("onlyMetric")) {
logger.info("args has onlyMetric(string)." );
return;
}
}

SpringApplicationBuilder collectorAppBuilder = createAppBuilder(builder, BasicCollectorApp.class, 1111);
collectorAppBuilder.build().run(args);
metricAppBuilder.build().run(args);
}

private static SpringApplicationBuilder createAppBuilder(SpringApplicationBuilder builder, Class appClass, int port) {
Expand Down

0 comments on commit 8d7387e

Please sign in to comment.