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

Ees 5687 add resource utilisation metric alerts #5464

Open
wants to merge 6 commits into
base: EES-5686-add-public-api-performance-metric-alerts
Choose a base branch
from

Conversation

duncan-at-hiveit
Copy link
Collaborator

Explain the motivation for making this change. What existing problem does the pull request solve?

You might also want to think about the following:

  • How did you solve complex parts of the problem? Other contributors may benefit from knowing more about your solution.
  • Are there any potential tradeoffs that need mentioning, or edge cases that have not been covered?
  • Have you added a reusable piece of functionality? Consider including some code snippets to better illustrate its usage.

Related changes

Are there any changes that were closely related to this change but not directly part of the main work e.g. refactoring, fixes, etc?

Screenshots

Are there any screenshots that help illustrate the change made?

@duncan-at-hiveit duncan-at-hiveit marked this pull request as ready for review December 12, 2024 20:05
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-5687-add-resource-utilisation-metric-alerts branch 2 times, most recently from 2cb2aa9 to 3eca3d8 Compare December 12, 2024 20:30
module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: {
name: '${name}ResponseTimeAlertModule'
module alerts '../baseResponseTimeAlert.bicep' = {
name: '${resourceNames[0]}ResponseTimeAlertModule'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given we're only using the first resourceNames item to construct the name, feels like the abstraction isn't quite right. The implication is that we intend this to only work with a single resource, so having a list of resourceNames seems a little confusing.

Should we change this so that we only work with a single resource by changing the resourceName to a string parameter?

We're doing a similar thing in a bunch of places throughout this PR so it'd be good to change this across the board if we make this change.

@description('Tags with which to tag the resource in Azure.')
param tagValues object

module alerts '../baseCpuPercentageAlert.bicep' = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we potentially over-abstracting by having loads of extra modules that wrap baseCpuPercentageAlert.bicep?

It's not clear what extra value we're getting from the additional wrapping and feels like we're just copy-pasting the same set of parameters and configuration in a bunch of different modules. It also looks we're generating a bunch of additional resource group deployments due to the extra wrapping, which is a little less clear to debug.

I'd potentially suggest we simplify things and remove the modules that are re-using the 'base' modules like baseCpuPercentageAlert.bicep. Instead, we can just use the base modules directly and avoid the extra abstraction layer.

Similar thing would apply across this PR.

param resourceNames string[]

@description('Names of the resources that these alerts are being applied to.')
param resourceType string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could create and use a new CpuResourceType that is a union of the specific resources with CPUs (rather than every resource type). This would help with auto-completion and general type safety.

param resourceType string

@description('Names of the resources that these alerts are being applied to.')
param metricName string
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above - could create a CpuMetricName type that could assist in auto-completion and general type safety.

Comment on lines +6 to +10
@description('Names of the resources that these alerts are being applied to.')
param resourceType string

@description('Names of the resources that these alerts are being applied to.')
param metricName string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to baseCpuPercentageAlert.bicep, we could create some memory-specific types that can constrain these two parameters.

Comment on lines +6 to +10
@description('Names of the resources that these alerts are being applied to.')
param resourceType string

@description('Names of the resources that these alerts are being applied to.')
param metricName string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to baseCpuPercentageAlert.bicep, we could create some response time-specific types that can constrain these two parameters.

Comment on lines 28 to 32
param sensitivity Sensitivity = 'Low'

param minFailingPeriodsToAlert int = 1
param minFailingPeriodsToAlert int = 3

param numberOfEvaluationPeriods int = 1
param numberOfEvaluationPeriods int = 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor, but shouldn't these changes be in the EES-5686 PR given we introduce dynamicMetricAlert.bicep there?

Doesn't make a lot of sense to have a follow-up PR that immediately changes the previous one.

@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-5687-add-resource-utilisation-metric-alerts branch from 3eca3d8 to a3e1b44 Compare December 20, 2024 10:07
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-5686-add-public-api-performance-metric-alerts branch 2 times, most recently from aaaccaf to 6cefbfc Compare December 20, 2024 17:06
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-5687-add-resource-utilisation-metric-alerts branch from a3e1b44 to dd56fa7 Compare December 20, 2024 17:15
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