采集频率

This commit is contained in:
kazusa 2025-08-22 14:44:41 +08:00
parent 243b8bfc26
commit fec4124c55
3 changed files with 74 additions and 25 deletions

View File

@ -37,6 +37,7 @@ public class Channels<T> {
bufferChannels = new QueueBuffer[channelSize];
for (int i = 0; i < channelSize; i++) {
if (BufferStrategy.BLOCKING.equals(strategy)) {
// 根据缓存策略选择用CAS结构还是锁结构来缓存数据
bufferChannels[i] = new ArrayBlockingQueueBuffer<>(bufferSize, strategy);
} else {
bufferChannels[i] = new Buffer<>(bufferSize, strategy);

View File

@ -14,6 +14,73 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
# SkyWalking Agent 上报频率配置区域
# =============================================================================
# 以下配置用于控制Agent向OAP后端上报数据的频率和时机
# 数值越小,上报越频繁,链路显示越及时,但会消耗更多资源
# 数值越大,上报越少,资源消耗越少,但链路显示会有延迟
# =============================================================================
# =============================================================================
# 缓冲区配置 - 控制内存中缓存的数据量和刷新频率
# =============================================================================
# 缓冲区通道大小 - 控制并发处理的数据通道数量
# 建议值1-5数值越小刷新越快但并发处理能力越弱
buffer.channel_size=${SW_BUFFER_CHANNEL_SIZE:1}
# 缓冲区大小 - 控制内存中缓存的数据条数
# 建议值50-300数值越小刷新越快但可能丢失数据
buffer.buffer_size=${SW_BUFFER_BUFFER_SIZE:100}
# =============================================================================
# 数据上报频率配置 - 控制各种数据的上报间隔
# =============================================================================
# gRPC连接状态检查间隔- 检查与后端的连接状态
# 建议值5-30秒数值越小检测越及时
collector.grpc_channel_check_interval=${SW_AGENT_COLLECTOR_GRPC_CHANNEL_CHECK_INTERVAL:10}
# Agent心跳上报周期- Agent定期向后端发送心跳
# 建议值5-30秒数值越小后端越及时感知Agent状态
collector.heartbeat_period=${SW_AGENT_COLLECTOR_HEARTBEAT_PERIOD:10}
# 实例属性上报周期因子 - 实例属性上报间隔 = 心跳周期 × 此因子
# 建议值1-10数值越小属性更新越及时
collector.properties_report_period_factor=${SW_AGENT_COLLECTOR_PROPERTIES_REPORT_PERIOD_FACTOR:5}
# gRPC上游超时时间- 发送数据到后端的超时时间
# 建议值3-30秒数值越小失败检测越及时
collector.grpc_upstream_timeout=${SW_AGENT_COLLECTOR_GRPC_UPSTREAM_TIMEOUT:5}
# 获取性能分析任务列表间隔(秒)- 获取新的性能分析任务
# 建议值5-30秒数值越小任务获取越及时
collector.get_profile_task_interval=${SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL:10}
# 获取Agent动态配置间隔- 获取后端下发的动态配置
# 建议值5-30秒数值越小配置更新越及时
collector.get_agent_dynamic_config_interval=${SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL:10}
# =============================================================================
# 指标数据上报配置
# =============================================================================
# JVM指标收集周期- JVM相关指标的上报间隔
# 建议值1-10秒数值越小监控越实时
jvm.metrics_collect_period=${SW_JVM_METRICS_COLLECT_PERIOD:1}
# 指标数据上报间隔(秒)- 各种业务指标的上报间隔
# 建议值3-20秒数值越小指标更新越及时
meter.report_interval=${SW_METER_REPORT_INTERVAL:5}
# =============================================================================
# 后端服务地址配置
# =============================================================================
# OAP后端服务地址 - 数据上报的目标地址
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
# =============================================================================
# 其他配置区域
# =============================================================================
# The service name in UI
# ${service name} = [${group name}::]${logic name}
# The group name is optional only.
@ -86,21 +153,6 @@ agent.enable=${SW_AGENT_ENABLE:true}
# Limit the length of the ipv4 list size.
osinfo.ipv4_list_size=${SW_AGENT_OSINFO_IPV4_LIST_SIZE:10}
# grpc channel status check interval.
collector.grpc_channel_check_interval=${SW_AGENT_COLLECTOR_GRPC_CHANNEL_CHECK_INTERVAL:30}
# Agent heartbeat report period. Unit, second.
collector.heartbeat_period=${SW_AGENT_COLLECTOR_HEARTBEAT_PERIOD:30}
# The agent sends the instance properties to the backend every
# collector.heartbeat_period * collector.properties_report_period_factor seconds
collector.properties_report_period_factor=${SW_AGENT_COLLECTOR_PROPERTIES_REPORT_PERIOD_FACTOR:10}
# Backend service addresses.
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
# How long grpc client will timeout in sending data to upstream. Unit is second.
collector.grpc_upstream_timeout=${SW_AGENT_COLLECTOR_GRPC_UPSTREAM_TIMEOUT:30}
# Sniffer get profile task list interval.
collector.get_profile_task_interval=${SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL:20}
# Sniffer get agent dynamic config interval.
collector.get_agent_dynamic_config_interval=${SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL:20}
# If true, skywalking agent will enable periodically resolving DNS to update receiver service addresses.
collector.is_resolve_dns_periodically=${SW_AGENT_COLLECTOR_IS_RESOLVE_DNS_PERIODICALLY:false}
@ -146,12 +198,6 @@ 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.
buffer.buffer_size=${SW_BUFFER_BUFFER_SIZE:300}
# If true, skywalking agent will enable profile when user create a new profile task. Otherwise disable profile.
profile.active=${SW_AGENT_PROFILE_ACTIVE:true}
# Parallel monitor endpoint thread count
@ -172,8 +218,6 @@ asyncprofiler.max_duration=${SW_AGENT_ASYNC_PROFILER_MAX_DURATION:1200}
asyncprofiler.output_path=${SW_AGENT_ASYNC_PROFILER_OUTPUT_PATH:}
# If true, the agent collects and reports metrics to the backend.
meter.active=${SW_METER_ACTIVE:true}
# Report meters interval. The unit is second
meter.report_interval=${SW_METER_REPORT_INTERVAL:20}
# Max size of the meter pool
meter.max_meter_size=${SW_METER_MAX_METER_SIZE:500}
# The max size of message to send to server.Default is 10 MB

View File

@ -6,8 +6,8 @@ package org.apache.skywalking;
*/
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
public class MetricDemo {
public static void main(String[] args) throws InterruptedException {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
@ -17,5 +17,9 @@ public class Main {
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
}
while (true) {
Thread.sleep(1);
}
}
}