Support to customize the collect period of JVM relative metrics. (#428)

This commit is contained in:
dylanforest 2022-12-26 22:34:30 +08:00 committed by GitHub
parent cd84ba2167
commit a68b447878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 2 deletions

View File

@ -20,7 +20,8 @@ Release Notes.
* Add tags `mq.message.keys` and `mq.message.tags` for RocketMQ producer span
* Clean the trace context which injected into Pulsar MessageImpl after the instance recycled
* Fix In the higher version of mysql-connector-java 8x, there is an error in the value of db.instance.
* Add support for KafkaClients 3.2.x
* Add support for KafkaClients 3.x.
* Support to customize the collect period of JVM relative metrics.
#### Documentation

View File

@ -273,6 +273,10 @@ public class Config {
* The buffer size of collected JVM info.
*/
public static int BUFFER_SIZE = 60 * 10;
/**
* The period in seconds of JVM metrics collection.
*/
public static int METRICS_COLLECT_PERIOD = 1;
}
public static class Log {

View File

@ -25,6 +25,7 @@ import org.apache.skywalking.apm.agent.core.boot.BootService;
import org.apache.skywalking.apm.agent.core.boot.DefaultImplementor;
import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
import org.apache.skywalking.apm.agent.core.conf.Config;
import org.apache.skywalking.apm.agent.core.jvm.clazz.ClassProvider;
import org.apache.skywalking.apm.agent.core.jvm.cpu.CPUProvider;
import org.apache.skywalking.apm.agent.core.jvm.gc.GCProvider;
@ -66,7 +67,7 @@ public class JVMService implements BootService, Runnable {
LOGGER.error("JVMService produces metrics failure.", t);
}
}
), 0, 1, TimeUnit.SECONDS);
), 0, Config.Jvm.METRICS_COLLECT_PERIOD, TimeUnit.SECONDS);
sendMetricFuture = Executors.newSingleThreadScheduledExecutor(
new DefaultNamedThreadFactory("JVMService-consume"))
.scheduleAtFixedRate(new RunnableWithExceptionProtection(

View File

@ -150,6 +150,8 @@ correlation.value_max_length=${SW_CORRELATION_VALUE_MAX_LENGTH:128}
correlation.auto_tag_keys=${SW_CORRELATION_AUTO_TAG_KEYS:}
# The buffer size of collected JVM info.
jvm.buffer_size=${SW_JVM_BUFFER_SIZE:600}
# The period in seconds of JVM metrics collection. Unit is second.
jvm.metrics_collect_period=${SW_JVM_METRICS_COLLECT_PERIOD:1}
# The buffer channel size.
buffer.channel_size=${SW_BUFFER_CHANNEL_SIZE:5}
# The buffer size.

View File

@ -47,6 +47,7 @@ This is the properties list supported in `agent/config/agent.config`.
| `correlation.value_max_length` | Max value length of each element. | SW_CORRELATION_VALUE_MAX_LENGTH | `128` |
| `correlation.auto_tag_keys` | Tag the span by the key/value in the correlation context, when the keys listed here exist. | SW_CORRELATION_AUTO_TAG_KEYS | `""` |
| `jvm.buffer_size` | The buffer size of collected JVM info. | SW_JVM_BUFFER_SIZE | `60 * 10` |
| `jvm.metrics_collect_period` | The period in seconds of JVM metrics collection. Unit is second. | SW_JVM_METRICS_COLLECT_PERIOD | `1` |
| `buffer.channel_size` | The buffer channel size. | SW_BUFFER_CHANNEL_SIZE | `5` |
| `buffer.buffer_size` | The buffer size. | SW_BUFFER_BUFFER_SIZE | `300` |
| `profile.active` | If true, skywalking agent will enable profile when user create a new profile task. Otherwise disable profile. | SW_AGENT_PROFILE_ACTIVE | `true` |