mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-08 16:12:16 -04:00
Merge pull request #18845 from Intuinewin/rds-fix-empty-cluster
discovery/aws: handle rds clusters without instances
This commit is contained in:
commit
de17e1705e
2 changed files with 15 additions and 3 deletions
|
|
@ -486,9 +486,6 @@ func (d *RDSDiscovery) describeDBInstances(ctx context.Context, dbClusterARN str
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to describe DB instances for cluster ARN %s: %w", dbClusterARN, err)
|
||||
}
|
||||
if len(output.DBInstances) == 0 {
|
||||
return nil, fmt.Errorf("no DB instances found for cluster ARN %s", dbClusterARN)
|
||||
}
|
||||
|
||||
for _, dbInstance := range output.DBInstances {
|
||||
mu.Lock()
|
||||
|
|
|
|||
|
|
@ -250,6 +250,21 @@ func TestRDSDiscoveryRefresh(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "NoInstancesInCluster",
|
||||
clusters: map[string]types.DBCluster{
|
||||
"arn:aws:rds:us-west-2:123456789012:cluster:prod-cluster": {
|
||||
DBClusterArn: aws.String("arn:aws:rds:us-west-2:123456789012:cluster:prod-cluster"),
|
||||
DBClusterIdentifier: aws.String("prod-cluster"),
|
||||
Engine: aws.String("aurora-mysql"),
|
||||
EngineVersion: aws.String("8.0.mysql_aurora.3.04.0"),
|
||||
Status: aws.String("available"),
|
||||
DBClusterMembers: []types.DBClusterMember{},
|
||||
},
|
||||
},
|
||||
instances: map[string][]types.DBInstance{},
|
||||
expectedLabels: []model.LabelSet{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Reference in a new issue