2 個答案
- 最新
- 最多得票
- 最多評論
0
Tested in my test environment and it is working fine for nodejs application on EC2 with xray Daemon. Below is steps performed:
- Installed nodejs on EC2 Amazon Linux.
# yum groupinstall 'Development Tools'
# curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
# yum install -y nodejs
- Installed xray deamon2
# wget https://s3.us-west-2.amazonaws.com/aws-xray-assets.us-west-2/xray-daemon/aws-xray-daemon-3.x.rpm
# yum install aws-xray-daemon-3.x.rpm
- Added needed permission for xray to instance IAM role 3
AWSXrayReadOnlyAccess
AWSXRayDaemonWriteAccess <<read permissions to get sampling rules
AWSXrayFullAccess
# wget https://github.com/aws-samples/aws-xray-sdk-node-sample/archive/refs/heads/master.zip
# unzip master.zip
# cd aws-xray-sdk-node-sample-master/
# npm install aws-xray-sdk
# npm install aws-xray-sdk --save
# npm install express
# node --inspect index.js
- Generate multiple requests (in my case modified port to 80 instead of 3000)
# curl -v http://<INSTANCE_IP>/http-request/
- Checked on EC2 instance xray data been successfully sent.
$ tail -f /var/log/xray/xray.log
[Info] Successfully sent batch of 1 segments (0.003 seconds)
[Info] Successfully sent batch of 1 segments (0.005 seconds)
[Info] Successfully sent batch of 2 segments (0.005 seconds)
[Info] Successfully sent batch of 1 segments (0.121 seconds)
[Info] Successfully sent batch of 1 segments (0.015 seconds)
- Monitor Sampling rules (AWS X-Ray> Sampling), you can see data in Trend graph
Please try on your above in your test environment.
已回答 1 年前
0
Centralized sampling rules are stored in X-Ray service. X-Ray sdk in user application has to take time to poll it and this poll action is lazy initialization, triggered by the first segment. So, the first segment generated in user application will fall back to a local rule (1/sec + 5%), which means the first segment is always sampled.
X-Ray centralized sampling has some limits, it does not work well in such cases:
- Instrumented application's life is short. Centralized sampling rules is not ready to take effect.
- If user's fleet scale is large, poll centralized sampling rules and sync up status with X-Ray service would take more time.
The alternative solution is using local sampling rules.
已回答 1 年前
相關內容
- 已提問 6 個月前
- AWS 官方已更新 7 個月前