-
Couldn't load subscription status.
- Fork 5.7k
feat: Add the RDS performance and generic metrics option #17745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Add the RDS performance and generic metrics option #17745
Conversation
9487de2 to
3f2f6ab
Compare
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
|
@srebhan Can you please check the PR? |
|
Hi @srebhan, should I write more unit tests before the review can start? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @ZPascal! I have some small comments in the code from skimming over the PR.
However, I wonder if RDS and CMS are not two different services!? Wouldn't it be hard for a user to find the RDS part as you probably won't expect it to be in CMS, would you?
Should we add a aliyunrds plugin?
Furthermore, please reduce the amount of changes, especially in the gatherMetric function! No unnecessary renames or restructuring please as this makes it hard to review this PR!
| const ( | ||
| tagInstanceID = "instanceId" | ||
| tagBucketName = "BucketName" | ||
| tagUserID = "userId" | ||
| fieldTimestamp = "timestamp" | ||
| serviceRDS = "rds" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use the strings instead of declaring them as constants? This pattern is only helpful if the declared const adds information e.g. when declaring const ErrorNotFound = 5. This is not the case here so this only adds lines and makes it harder to find out which value is actually used in the code.
| ) | ||
|
|
||
| type ( | ||
| // AliyunCMS is Aliyun cms config info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not add any information, please remove!
| // formatTimeUTC formats time in the RFC3339 minute-precision expected by RDS API. | ||
| func formatTimeUTC(t time.Time) string { | ||
| return t.UTC().Format("2006-01-02T15:04Z") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this indirection? Please unroll this function!
Description
This PR extends the
aliyuncmsinput plugin to support additional metric data sources beyond Cloud Monitor Service (CMS). Specifically, it adds support for collecting performance metrics directly from Alibaba Cloud's Relational Database Service (RDS) API.Changes
metric_servicesconfiguration option to specify which metric services to query (defaults to["cms"])DescribeDBInstancePerformanceAPIKey Features
metric_services = ["cms", "rds"]to enable RDS metricsmetric_servicesis not configuredCPUUsage&IOPS) and normalizes them into separate datapointsConfiguration Example
Testing
Related Issues
Checklist
Breaking Changes
None. The change is fully backward compatible with existing configurations.
Notes:
&) are automatically split into individual datapoints