Skip to content

Conversation

@ishuar
Copy link
Owner

@ishuar ishuar commented Oct 1, 2025

resourcegrouptaggingapi does not support ASG, hence we are using the service based approach and then merging them together for better outputs.

Signed-off-by: ishuar ishansharma887@gmail.com

`resourcegrouptaggingapi` does not support ASG, hence we are using the service based approach and then merging them together for better outputs.

Signed-off-by: ishuar <ishansharma887@gmail.com>
Copilot AI review requested due to automatic review settings October 1, 2025 00:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances autoscaling resource scanning with tag-based filtering capabilities. Since the Resource Groups Tagging API does not support Auto Scaling Groups (ASG), the implementation uses a service-specific approach for autoscaling resources and then merges the results with other tagged resources for comprehensive output.

  • Enhanced autoscaling service to support flexible tag filtering (key only, value only, or key-value pairs)
  • Implemented hybrid scanning approach combining Resource Groups API with dedicated autoscaling scanning
  • Optimized launch configuration scanning to only fetch configurations used by matching ASGs

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
services/autoscaling_service.py Added comprehensive tag filtering logic for ASGs and launch templates, optimized launch configuration scanning
cli.py Enhanced dry-run output to display different tag filtering modes
aws_scanner_lib/scan.py Modified service-specific autoscaling scan to include tag filtering
aws_scanner_lib/resource_groups_utils.py Implemented hybrid scanning approach with parallel execution of Resource Groups API and autoscaling scans

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

logger.debug("Applying tag filters - key: %s, value: %s", tag_key, tag_value)

# Show progress to user on separate console (will not conflict with logging or progress bars)
if logger.is_debug_enabled():
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is_debug_enabled() is not a standard method on Python loggers. Standard Python loggers use isEnabledFor(logging.DEBUG) to check if debug logging is enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +138 to +142
logger.log_aws_operation(
"autoscaling",
"describe_multiple",
region,
parallel_workers=AUTOSCALING_MAX_WORKERS,
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method log_aws_operation() is not a standard method on Python loggers. This appears to be a custom method that may not exist on the logger instance.

Suggested change
logger.log_aws_operation(
"autoscaling",
"describe_multiple",
region,
parallel_workers=AUTOSCALING_MAX_WORKERS,
logger.info(
"AWS operation: service=%s, operation=%s, region=%s, parallel_workers=%d",
"autoscaling",
"describe_multiple",
region,
AUTOSCALING_MAX_WORKERS,

Copilot uses AI. Check for mistakes.
except (ClientError, BotoCoreError) as e:
console.print(
f"[yellow]Warning: Failed to scan Auto Scaling Groups in {region}: {str(e)}[/yellow]"
with logger.timer(f"Auto Scaling parallel scan in {region}"):
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method timer() is not a standard method on Python loggers. This appears to be a custom context manager that may not exist on the logger instance.

Copilot uses AI. Check for mistakes.
Comment on lines +218 to +219
logger.log_error_context(
e, {"service": "autoscaling", "region": region, "operation": "full_scan"}
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method log_error_context() is not a standard method on Python loggers. This appears to be a custom method that may not exist on the logger instance.

Suggested change
logger.log_error_context(
e, {"service": "autoscaling", "region": region, "operation": "full_scan"}
logger.error(
"Error during Auto Scaling scan in %s: %s | Context: %s",
region, str(e), {"service": "autoscaling", "region": region, "operation": "full_scan"}

Copilot uses AI. Check for mistakes.
Signed-off-by: ishuar <ishansharma887@gmail.com>
@ishuar ishuar merged commit e65ce56 into main Oct 1, 2025
1 check passed
@ishuar ishuar deleted the feat/integrate-asg-with-tags-filters branch October 1, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants