Skip to content
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

Azure Memory Usage Alert #1546

Merged
merged 16 commits into from
Nov 5, 2024
Merged

Azure Memory Usage Alert #1546

merged 16 commits into from
Nov 5, 2024

Conversation

jherrflexion
Copy link
Contributor

@jherrflexion jherrflexion commented Nov 4, 2024

Added memory usage alerts for TI - web app only.

Issue

#1401
#1401

jherrflexion and others added 10 commits November 4, 2024 09:32
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
Copy link

github-actions bot commented Nov 4, 2024

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1399 - Partially compliant

Fully compliant requirements:

  • Alert on high memory usage for CDC TI.

Not compliant requirements:

  • Alert specifically on high CPU usage.
  • Alerts for SFTP and database not addressed.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Misconfiguration
The memory threshold values are hardcoded. Consider making them configurable to adapt to different environments.

Resource Duplication
There are two similar alert resources defined. Check if they can be combined or if the differentiation is necessary.

operations/template/alert.tf Outdated Show resolved Hide resolved
operations/template/alert.tf Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Nov 4, 2024

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Maintainability
Use a variable for memory thresholds to enhance maintainability

Consider using a variable for the memory threshold values in the ti_memory_alert
resource to maintain consistency and ease of configuration changes.

operations/template/alert.tf [276]

-threshold = local.higher_environment_level ? 4000000000 : 2000000000
+threshold = var.memory_threshold
Suggestion importance[1-10]: 7

Why: Using a variable for memory thresholds in the 'ti_memory_alert' resource would improve maintainability and ease future configuration changes. This is a practical suggestion that enhances the code's flexibility.

7
Best practice
Implement validation for the environment variable to prevent misconfigurations

Add validation for the environment variable used in the alert names to prevent
configuration errors.

operations/template/alert.tf [263]

-name = "cdcti-${var.environment}-memory-alert"
+variable "environment" {
+  description = "The deployment environment"
+  type        = string
+  validation {
+    condition     = contains(["dev", "prod", "staging"], var.environment)
+    error_message = "The environment must be dev, prod, or staging."
+  }
+}
Suggestion importance[1-10]: 6

Why: Adding validation for the environment variable is a good practice to ensure the configuration is correct and to prevent potential runtime errors. This suggestion enhances the robustness of the configuration.

6
Verify and update the ignore_changes list to cover all necessary tags

Ensure that the ignore_changes lifecycle policy in both memory alert resources
covers all necessary tags to prevent unintended updates.

operations/template/alert.tf [244-257]

 ignore_changes = [
   tags["business_steward"],
   ...
-  tags["zone"]
+  tags["zone"],
+  tags["new_necessary_tag"]
 ]
Suggestion importance[1-10]: 5

Why: Ensuring that the ignore_changes lifecycle policy covers all necessary tags is important to prevent unintended updates. However, the suggestion lacks specific details on what new tags might be necessary, making it less actionable.

5
Enhancement
Use a variable for alert_sensitivity to allow flexible configuration

Consider adding more granularity to the alert_sensitivity setting in the
dynamic_criteria block to better tailor alert responses.

operations/template/alert.tf [235]

-alert_sensitivity = "Medium"
+alert_sensitivity = var.alert_sensitivity
Suggestion importance[1-10]: 6

Why: Using a variable for alert_sensitivity in the dynamic_criteria block provides flexibility in configuring alert sensitivity levels, which can be beneficial for different deployment scenarios. This suggestion adds customization potential to the alert settings.

6

Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
@jcrichlake
Copy link
Contributor

Added memory usage alerts for TI - web app only.

Issue

#1399 #1399

This card is for high CPU usage, but the alert is for high memory. Should it link to a different card?

Co-Authored-By: Samuel Aquino <[email protected]>
Co-Authored-By: Sylvie <[email protected]>
Co-Authored-By: jcrichlake <[email protected]>
Copy link
Contributor

@pluckyswan pluckyswan left a comment

Choose a reason for hiding this comment

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

Incorporated incredible ideas ideally!

Copy link

sonarqubecloud bot commented Nov 5, 2024

@jherrflexion jherrflexion merged commit df35158 into main Nov 5, 2024
17 checks passed
@jherrflexion jherrflexion deleted the azure-mem-alert branch November 5, 2024 16:08
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.

3 participants