Skip to content

Commit ce8b5ab

Browse files
update docs
1 parent d336fd3 commit ce8b5ab

4 files changed

Lines changed: 83 additions & 60 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Ruby Agent Meter and Log Reporter
2+
3+
The meter reporter feature enables collection and reporting of runtime metrics to the SkyWalking OAP backend.
4+
5+
### Runtime Metrics (Enabled by Default)
6+
7+
The agent automatically collects Ruby runtime metrics when `meter_reporter_active` is enabled (default: true).
8+
9+
#### Collected Runtime Metrics
10+
11+
**CPU Metrics:**
12+
13+
- `instance_ruby_cpu_usage_percent` - Ruby process CPU usage percentage (based on load average)
14+
15+
**Memory Metrics:**
16+
17+
- `instance_ruby_memory_rss_mb` - Ruby process RSS memory usage in MB
18+
19+
**Garbage Collection Metrics:**
20+
21+
- `instance_ruby_gc_count_total` - Total GC execution count
22+
- `instance_ruby_gc_minor_count_total` - Minor GC count (if available)
23+
- `instance_ruby_gc_major_count_total` - Major GC count (if available)
24+
- `instance_ruby_heap_usage_percent` - Heap memory usage percentage
25+
- `instance_ruby_heap_live_slots_count` - Number of live heap slots
26+
- `instance_ruby_heap_allocated_slots_count` - Number of allocated heap slots
27+
28+
**Object System Metrics:**
29+
30+
- `instance_ruby_total_allocated_objects` - Total allocated objects count
31+
32+
**Thread Metrics:**
33+
34+
- `instance_ruby_thread_count_active` - Number of active threads
35+
36+
### Log Integration
37+
38+
When log reporter is enabled, the agent automatically:
39+
40+
- **Intercepts Ruby Standard Logger**: Automatically patches the `Logger` class to collect logs
41+
- **Integrates Trace Context**: Adds trace ID, segment ID, and span ID to log messages when available
42+
43+
#### Supported Logger
44+
45+
Currently, the agent supports:
46+
47+
- **Ruby Standard Logger** (`Logger` class) - Automatically intercepted and collected
48+
49+
#### Log Configuration Options
50+
51+
```ruby
52+
# Configure log reporter level (default: Logger::INFO)
53+
config[:log_reporter_level] = Logger::INFO
54+
55+
# Configure log report period in seconds (default: 5)
56+
config[:log_report_period] = 5
57+
58+
# Configure maximum log queue size (default: 1000)
59+
config[:max_log_queue_size] = 1000
60+
```

docs/en/setup/MeterReporter.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

docs/en/setup/quick-start.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gem build skywalking.gemspec
3333

3434
If successful, the following will be displayed:
3535

36-
```ruby
36+
```shell
3737
Successfully built RubyGem
3838
Name: skywalking
3939
Version: <version>
@@ -84,27 +84,39 @@ The following is an example of configuration at start:
8484
Skywalking.start(
8585
service_name: 'sw-srv',
8686
instance_name: 'sw-inst',
87-
collector_backend_services: 'oap:11800'
87+
collector_backend_services: 'oap:11800',
88+
meter_reporter_active: true,
89+
log_reporter_active: true,
90+
meter_report_period: 30,
91+
log_report_period: 10
8892
)
8993
~~~
9094

9195
The following is an example of a configuration file:
96+
9297
~~~yaml
9398
common: &defaults
9499
service_name: Ruby-Agent-Common
95100
log_level: debug
101+
meter_reporter_active: true
102+
log_reporter_active: true
103+
meter_report_period: 20
104+
log_report_period: 5
96105

97106
development:
98107
<<: *defaults
99108
service_name: Ruby-Agent-Development
109+
log_reporter_level: 0 # DEBUG
100110

101111
test:
102112
<<: *defaults
103113
service_name: Ruby-Agent-Test
114+
log_reporter_level: 1 # INFO
104115

105116
production:
106117
<<: *defaults
107118
service_name: Ruby-Agent-Production
119+
log_reporter_level: 2 # WARN
108120
~~~
109121

110122
The following lists all the configuration options:
@@ -127,3 +139,10 @@ The following lists all the configuration options:
127139
| collector_heartbeat_period | SW_AGENT_COLLECTOR_HEARTBEAT_PERIOD | 30 | he agent will send heartbeat to OAP every `collector_heartbeat_period` seconds. |
128140
| properties_report_period_factor | SW_AGENT_PROPERTIES_REPORT_PERIOD_FACTOR | 10 | The agent will report service instance properties every `collector_heartbeat_period * properties_report_period_factor` seconds. |
129141
| max_queue_size | SW_AGENT_MAX_QUEUE_SIZE | 10000 | The maximum queue size for reporting data. |
142+
| meter_reporter_active | SW_AGENT_METER_REPORTER_ACTIVE | true | Enable/disable meter reporter for runtime metrics collection. |
143+
| meter_report_period | SW_AGENT_METER_REPORT_PERIOD | 20 | Meter report period in seconds. |
144+
| max_meter_queue_size | SW_AGENT_MAX_METER_QUEUE_SIZE | 1000 | Maximum meter queue size for buffering metrics data. |
145+
| log_reporter_active | SW_AGENT_LOG_REPORTER_ACTIVE | true | Enable/disable log reporter for log collection. |
146+
| log_reporter_level | SW_AGENT_LOG_REPORTER_LEVEL | 1 (INFO) | Minimum log level to report (Logger::DEBUG=0, INFO=1, WARN=2, ERROR=3, FATAL=4). |
147+
| log_report_period | SW_AGENT_LOG_REPORT_PERIOD | 5 | Log report period in seconds. |
148+
| max_log_queue_size | SW_AGENT_MAX_LOG_QUEUE_SIZE | 1000 | Maximum log queue size for buffering log data. |

docs/menu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ catalog:
2323
catalog:
2424
- name: Supported Plugins
2525
path: /en/agent/plugins
26+
- name: Meter and Log Report
27+
path: /en/agent/meter-and-log-report
2628
- name: Development and Contribution
2729
catalog:
2830
- name: How to Release

0 commit comments

Comments
 (0)