File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change
1
+ Fix tag propagation of aurora `replication_role` tag. Prior to this change, the replication_role tag was not added as a host tag for mysql aurora instances.
Original file line number Diff line number Diff line change @@ -282,14 +282,18 @@ def check(self, _):
282
282
try :
283
283
self ._conn = db
284
284
285
+ # Update tag set with relevant information
286
+ if self ._get_is_aurora (db ):
287
+ aurora_tags = self ._get_runtime_aurora_tags (db )
288
+ self .tags = tags + aurora_tags
289
+ self ._non_internal_tags = self ._set_database_instance_tags (aurora_tags )
290
+
285
291
# version collection
286
292
self .version = get_version (db )
287
293
self ._send_metadata ()
288
294
self ._send_database_instance_metadata ()
289
295
290
296
self .is_mariadb = self .version .flavor == "MariaDB"
291
- if self ._get_is_aurora (db ):
292
- tags = tags + self ._get_runtime_aurora_tags (db )
293
297
294
298
self ._check_database_configuration (db )
295
299
@@ -323,6 +327,13 @@ def check(self, _):
323
327
self ._conn = None
324
328
self ._report_warnings ()
325
329
330
+ # _set_database_instance_tags sets the tag list for the `database_instance` resource
331
+ # based on metadata that is collected on check start. This ensures that we see tags such as
332
+ # `replication_role` appear on the database_instance as a host tag.
333
+ def _set_database_instance_tags (self , aurora_tags ):
334
+ tags = copy .deepcopy (self ._non_internal_tags )
335
+ return list (set (tags ) | set (aurora_tags ))
336
+
326
337
def cancel (self ):
327
338
self ._statement_samples .cancel ()
328
339
self ._statement_metrics .cancel ()
You can’t perform that action at this time.
0 commit comments