Skip to content

Commit

Permalink
github: Fix wrong cloudsql/WARN/2023_003 MQL query
Browse files Browse the repository at this point in the history
This changes the MQL query for cloudsql/WARN/2023_003 from `aggregate` (which adds the value up to the thousands) to `max` which I assume was the intended way this query works.

Also, I fixed two small typos I found when I accidentally opened the wrong file.

Edit: Fixes #74

Merge da4af2a into 620a060

Closes #75

FUTURE_COPYBARA_INTEGRATE_REVIEW=#75 from m3adow:fix/correct-2023_003-mql-query da4af2a
ORIGINAL_AUTHOR=Till Wiese <1872304+m3adow@users.noreply.github.com>
GitOrigin-RevId: b9bebbf
Change-Id: I4a206f4c8ede86c8f650ce8b7dbb0483b97ab870
  • Loading branch information
m3adow authored and copybara-github committed Jul 31, 2023
1 parent 0953676 commit 78ebba8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Lint as: python3
"""Cloud SQL enables automatic storage increases feature
Configure storage to accomodate critical database maintennance by enabling the
Configure storage to accommodate critical database maintenance by enabling the
automatic storage increases feature. Otherwise, ensure that you have at least
20% available space to accommodate any critical database maintenance operations
that Cloud SQL may perform. Keep in mind that when an instance becomes unable to
Expand Down
12 changes: 6 additions & 6 deletions gcpdiag/lint/cloudsql/warn_2023_003_high_mem_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def prefetch_rule(context: models.Context):
context.project_id,
f"""
fetch cloudsql_database
| metric 'cloudsql.googleapis.com/database/memory/components'
| group_by 6h, [value_components_aggregate: aggregate(value.components)]
| filter metric.component = 'Usage'
| every 6h
| filter val() >= {MEM_USAGE_THRESHOLD}
| {within_str}
| metric 'cloudsql.googleapis.com/database/memory/components'
| group_by 6h, [value_components_max: max(value.components)]
| filter metric.component = 'Usage'
| every 6h
| filter val() >= {MEM_USAGE_THRESHOLD}
| {within_str}
""")


Expand Down

0 comments on commit 78ebba8

Please sign in to comment.