Using SkyWalking to Achieve Correlated Analysis of RUM, APM, and Logs Based on Guance¶
Use Cases¶
In distributed application environments, troubleshooting often relies on logs and traces. Guance can correlate requests made by users through the Web with backend interfaces via traceId. If the backend interfaces output logs, the traces and logs are correlated through traceId, ultimately forming a correlation of RUM, APM, and logs. Using the Guance platform for comprehensive analysis makes it very convenient to quickly discover and locate issues.
This article uses a simple, easy-to-use open-source project as an example to implement full-link observability step by step.
Prerequisites¶
- You need to first create a Guance account.
- Spring Boot and Vue applications.
- A Linux server with Nginx deployed.
Configuration Steps¶
Warning
The version information used in this article's examples is as follows: DataKit 1.4.15, SkyWalking 8.7.0, Nginx 1.20.2, JDK 1.8, Vue 3.2
1 Deploy DataKit¶
1.1 Install DataKit¶
Log in to 「Guance」, navigate to 「Integrations」 - 「DataKit」 - 「Linux」, and click the 「Copy icon」 to copy the installation command.
Log in to the Linux server and execute the copied command.
1.2 Enable Collectors¶
To enable RUM, users need remote access to DataKit's port 9529. Edit the following file.
Modify the listen value to 0.0.0.0:9529
Copy the conf file to enable the SkyWalking collector.
Enable the log collector.
Edit the skywalking-service-log.conf file
logfiles: fill in the log file path. Since the jar will be deployed to the/usr/local/df-demo/skywalkingdirectory, the log path here is/usr/local/df-demo/skywalking/logs/log.log.source: set toskywalking-service-log.
1.3 Restart DataKit¶
2 Deploy Applications¶
2.1 Deploy Backend Service¶
Download the skywalking-demo project, open it with IntelliJ IDEA, and click the 「package」 button on the right to generate the skywalking-user-service.jar file.
Upload skywalking-user-service.jar to the /usr/local/df-demo/skywalking directory.
Note:
1. The project needs to add the dependency
.
```xml
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>8.7.0</version>
</dependency>
```
2.2 Deploy Web¶
Navigate to the web project directory and execute cnpm install in the command line.
Execute npm run build to generate the deployment files.
Copy the files under the disk directory to the /usr/local/web directory on the server.
Edit the /etc/nginx/nginx.conf file and add the following content.
Reload the nginx configuration.
Enter the Linux server IP in the browser to access the frontend interface.
3 Enable APM¶
Download SkyWalking
Upload the agent directory to the /usr/local/df-demo/skywalking directory on the Linux server.
If the microservice uses Spring Cloud Gateway, copy agent/optional-plugins/, apm-spring-cloud-gateway-2.1.x-plugin-8.7.0.jar, and apm-spring-webflux-5.x-plugin-8.7.0.jar,
from the directory to the skywalking-agent/plugins/ directory.
Note: The version of
apm-spring-cloud-gatewaymust correspond to the specific version of Spring Cloud Gateway in use.
cp /usr/local/df-demo/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.1.x-plugin-8.7.0.jar /usr/local/df-demo/skywalking/agent/plugins/
cp /usr/local/df-demo/skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-8.7.0.jar /usr/local/df-demo/skywalking/agent/plugins/
Execute the following command to start the backend service, then click the button on the frontend interface to call the backend service.
cd /usr/local/df-demo/skywalking
java -javaagent:agent/skywalking-agent.jar -Dskywalking.agent.service_name=skywalking-log -Dskywalking.collector.backend_service=localhost:11800 -jar skywalking-user-service.jar
Log in to 「Guance」, go to 「Application Performance Monitoring」, and view the services, traces, and service map.
4 Enable RUM¶
Log in to 「Guance」, go to 「Real User Monitoring」, create a new application skywalking-web-demo, and copy the JS below.
Modify /usr/local/web/index.html, paste the JS into the <head> section.
- Modify
datakitOriginto the DataKit address (Linux server IP + port 9529). allowedTracingOriginsto the backend service address (Linux server IP + port 8090).
Parameter Description
datakitOrigin: The data transmission address, which is the DataKit domain name or IP. Required.env: The environment of the application. Required.version: The version of the application. Required.trackInteractions: Whether to enable user behavior tracking, e.g., button clicks, form submissions. Required.traceType: The trace type, defaults toddtrace. Optional.allowedTracingOrigins: Enables correlation between APM and RUM traces. Fill in the backend service domain name or IP. Optional.
Click the button on the frontend interface. Log in to 「Guance」 - 「Real User Monitoring」, click 「skywalking-web-demo」, and view UV, PV, session count, visited pages, and other information.
5 Full-Link Observability¶
Log in to 「Guance」 - 「Real User Monitoring」, click 「skywalking-web-demo」, then click 「Explorer」, select 「view」, review the page call details, and then click 「route_change」 to enter.
Select 「Traces」
Click on a request record to observe the "Flame Graph", "Span List", "Service Call Relationships", and the logs generated by this trace.






















