-
Notifications
You must be signed in to change notification settings - Fork 145
Additional metric alert clickhouse performance improvements #8201
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
Draft
jonathanawesome
wants to merge
20
commits into
main
Choose a base branch
from
additional-metric-alert-clickhouse-performance-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7a3e3b1
Gate metric-alert evaluation cadence by rule window
jonathanawesome 381df29
Add operations_by_target_daily ClickHouse rollup migration
jonathanawesome 62f2b95
Route metric-alert windows >= 7 days to daily rollups
jonathanawesome a9760ee
Reject metric-alert windows >= 7 days that are not whole days
jonathanawesome 2d0a0c1
Make workflows service deploy after db migrations
jonathanawesome 815eb93
Skip the previous window for absolute-only alert groups
jonathanawesome 31fd97f
Handle null previous value in alert notifications
jonathanawesome 6a44e11
Skip unused duration columns for error/traffic alert groups
jonathanawesome fdb9022
Evaluate metric-alert groups with a concurrency pool
jonathanawesome d2fcb93
Add rule intent to metric-alert evaluate-group spans
jonathanawesome bb5fc08
Add filtered-vs-unfiltered rule gauges and dashboard panels
jonathanawesome a8c2e6c
prettier
jonathanawesome 20e753f
Count actually-filtering rules in the metric-alert filter gauges
jonathanawesome fbef784
Derive metric-alert group query needs in one helper
jonathanawesome bd19727
const MINUTES_PER_DAY and pin the daily-rollup threshold
jonathanawesome 816fdbc
Fail loud when a latency alert reads an unselected column
jonathanawesome 868cbf6
Keep traffic on hourly and split alert groups by rollup tier
jonathanawesome 176003f
Persist null previous value for fixed-threshold alerts
jonathanawesome 822b2f7
Merge branch 'main' into additional-metric-alert-clickhouse-performan…
jonathanawesome 1ba000f
Merge branch 'main' into additional-metric-alert-clickhouse-performan…
jonathanawesome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/migrations/src/clickhouse-actions/019-metric-alert-target-daily-rollup.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import type { Action } from '../clickhouse'; | ||
|
|
||
| // Daily by-target rollup for the metric-alert evaluator. Mirrors the | ||
| // minutely/hourly rollups in 018 but bucketed per day, so long-window rules | ||
| // (>= 7 days) read ~60 daily buckets for a 30-day query instead of ~1,440 | ||
| // hourly ones. The 90-day TTL covers the 60-day (2x window) scan of a 30-day | ||
| // rule. | ||
| const tableColumns = ` | ||
| target LowCardinality(String) CODEC(ZSTD(1)), | ||
| timestamp DateTime('UTC') CODEC(DoubleDelta, LZ4), | ||
| total UInt32 CODEC(T64, ZSTD(1)), | ||
| total_ok UInt32 CODEC(T64, ZSTD(1)), | ||
| duration_avg AggregateFunction(avg, UInt64) CODEC(ZSTD(1)), | ||
| duration_quantiles AggregateFunction(quantilesTDigest(0.75, 0.9, 0.95, 0.99), UInt64) CODEC(ZSTD(1)) | ||
| `; | ||
|
|
||
| export const action: Action = async exec => { | ||
| await exec(` | ||
| CREATE TABLE IF NOT EXISTS default.operations_by_target_daily | ||
| ( | ||
| ${tableColumns} | ||
| ) | ||
| ENGINE = SummingMergeTree | ||
| -- Monthly, not toYYYYMMDD like the hourly rollup: daily buckets would make | ||
| -- one partition per day. Keep monthly so a 90-day TTL has few parts. | ||
| PARTITION BY toYYYYMM(timestamp) | ||
| PRIMARY KEY (target, timestamp) | ||
| ORDER BY (target, timestamp) | ||
| TTL timestamp + INTERVAL 90 DAY | ||
| SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1 | ||
| `); | ||
|
|
||
| await exec(` | ||
| CREATE MATERIALIZED VIEW IF NOT EXISTS default.operations_by_target_daily_mv TO default.operations_by_target_daily | ||
| AS ( | ||
| SELECT | ||
| target, | ||
| toStartOfDay(timestamp) AS timestamp, | ||
| CAST(count() AS UInt32) AS total, | ||
| CAST(sum(ok) AS UInt32) AS total_ok, | ||
| avgState(duration) AS duration_avg, | ||
| quantilesTDigestState(0.75, 0.9, 0.95, 0.99)(duration) AS duration_quantiles | ||
| FROM default.operations | ||
| GROUP BY | ||
| target, | ||
| timestamp | ||
| ) | ||
| `); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.