From 755bb3d91980ac24c9572a060398d1c60a1b5bd7 Mon Sep 17 00:00:00 2001 From: taeyeon-kimm Date: Sun, 23 Apr 2023 20:17:52 +0900 Subject: [PATCH] Polish & Clean up code --- doc/installation.md | 6 +++--- .../scavenger/javaagent/publishing/GrpcClient.java | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index 76622d30..79c08f7a 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -36,7 +36,7 @@ You can override any configuration values with `-D` option. To change the http(default 8080) and grpc(default 8080) ports used by Collector, you can change the settings below. - `-Darmeria.port`: http, grpc uses 8080 by default -To change the default value of 10MB for the max message size of gRPC in Collector, change the setting below. +To change the the max message size of gRPC in Collector, change the setting below. - `-Darmeria.max-message-size`: 10MB by default - Supports `B`, `KB`, `MB`, `GB`, and `TB` units. @@ -178,10 +178,10 @@ packages=com.navercorp - Setting up the agent via `-javaagent:path/to/scavenger-agent.jar` - Specify the config file via `-Dscavenger.configuration=path/to/scavenger.conf` -- To change the default value of 10MB for the max message size of gRPC in agent, change the setting below. +- To change the max message size of gRPC in agent, change the setting below. - `-Dscavenger.max-message-size` - Supports `B`, `KB`, `MB`, `GB`, and `TB` units. -> **We recommend tuning your codeBase configuration before changing `scavenger.max-message-size`.** +> **We recommend tuning your codeBase configuration for minimizing tracing ranges before changing `scavenger.max-message-size`.** ```bash export JAVA_OPTS="$JAVA_OPTS -Dscavenger.configuration=$CATALINA_BASE/conf/scavenger.conf" diff --git a/scavenger-agent-java/src/main/java/com/navercorp/scavenger/javaagent/publishing/GrpcClient.java b/scavenger-agent-java/src/main/java/com/navercorp/scavenger/javaagent/publishing/GrpcClient.java index e1cb51c3..6b009f88 100644 --- a/scavenger-agent-java/src/main/java/com/navercorp/scavenger/javaagent/publishing/GrpcClient.java +++ b/scavenger-agent-java/src/main/java/com/navercorp/scavenger/javaagent/publishing/GrpcClient.java @@ -98,6 +98,10 @@ private ManagedChannel createChannel(int maxMessageSize) { private int maxMessageSize() { String mexMessageSize = System.getProperty(MAX_MESSAGE_SIZE_CONFIG); + if (mexMessageSize == null) { + return DEFAULT_MAX_MESSAGE_SIZE; + } + Matcher matcher = DATA_SIZE_PATTERN.matcher(mexMessageSize); if (!matcher.matches()) { log.log(Level.WARNING, "[scavenger] 'scavenger.max-message-size' is not a valid data size. use the default value of 10MB");