File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ func (e *EC2Fetcher) GetDBInstanceTypeInformation(instanceTypes []string) (Metri
7575 // Remove "db." prefix from instance types
7676 instanceTypesToFetch := make ([]aws_ec2_types.InstanceType , len (instances ))
7777 for i , instance := range instances {
78- instanceTypesToFetch [i ] = (aws_ec2_types .InstanceType )(removeDBPrefix (instance ))
78+ instanceTypesToFetch [i ] = (aws_ec2_types .InstanceType )(overrideInvalidInstanceTypes ( removeDBPrefix (instance ) ))
7979 }
8080
8181 input := & aws_ec2.DescribeInstanceTypesInput {InstanceTypes : instanceTypesToFetch }
Original file line number Diff line number Diff line change @@ -19,3 +19,15 @@ func addDBPrefix(instance string) string {
1919func removeDBPrefix (instance string ) string {
2020 return strings .Trim (instance , "db." )
2121}
22+
23+ // overrideInvalidInstanceTypes normalizes EC2 instance type names to handle
24+ // inconsistencies between RDS and EC2 services.
25+ // x2g RDS instances which are memory-optimized instance classes with AWS Graviton2 processors
26+ // are referenced as x2gd in EC2 API
27+ // See: https://github.com/qonto/prometheus-rds-exporter/issues/258
28+ func overrideInvalidInstanceTypes (instanceType string ) string {
29+ if strings .HasPrefix (instanceType , "x2g." ) {
30+ return strings .Replace (instanceType , "x2g." , "x2gd." , 1 )
31+ }
32+ return instanceType
33+ }
You can’t perform that action at this time.
0 commit comments