-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from lidofinance/develop
develop -> main
- Loading branch information
Showing
43 changed files
with
597 additions
and
212 deletions.
There are no files selected for viewing
This file contains 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 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,13 @@ | ||
groups: | ||
- name: Keys API. Initial keys update check | ||
rules: | ||
- alert: KeysApiOutdatedKeysEmptyDB | ||
expr: | | ||
(time() - process_start_time_seconds{}) >= 15 * 60 and (lido_keys_api_last_update_timestamp{} == 0) | ||
labels: | ||
severity: critical | ||
service: keys_api | ||
app_team: tooling | ||
annotations: | ||
summary: Keys are outdated | ||
description: 'Initial update took more than {{ $value | humanizeDuration }}' |
This file contains 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,36 @@ | ||
rule_files: | ||
- 'keys-api-outdated-keys.empty-db.rule.yml' | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
# Test Case 1: Keys API not updated since process start | ||
- interval: 1m | ||
input_series: | ||
- series: 'process_start_time_seconds{}' | ||
values: '0x15' | ||
- series: 'lido_keys_api_last_update_timestamp{}' | ||
values: '0x15' | ||
alert_rule_test: | ||
- eval_time: 15m | ||
alertname: KeysApiOutdatedKeysEmptyDB | ||
exp_alerts: | ||
- exp_labels: | ||
severity: 'critical' | ||
service: 'keys_api' | ||
app_team: 'tooling' | ||
exp_annotations: | ||
summary: 'Keys are outdated' | ||
description: 'Initial update took more than 15m 0s' | ||
|
||
#Test Case 2: Keys API updated after process start | ||
- interval: 1m | ||
input_series: | ||
- series: 'process_start_time_seconds{}' | ||
values: '0x15' | ||
- series: 'lido_keys_api_last_update_timestamp{}' | ||
values: '0x12 0 0 1' | ||
alert_rule_test: | ||
- eval_time: 15m | ||
alertname: KeysApiOutdatedKeysEmptyDB | ||
exp_alerts: [] |
This file contains 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,13 @@ | ||
groups: | ||
- name: Keys API. Update on non empty db | ||
rules: | ||
- alert: KeysApiOutdatedKeysNonEmptyDB | ||
expr: | | ||
(time() - lido_keys_api_last_update_timestamp{}) >= 10*60 and lido_keys_api_last_update_timestamp{} > 0 | ||
labels: | ||
severity: critical | ||
service: keys_api | ||
app_team: tooling | ||
annotations: | ||
summary: Keys are outdated | ||
description: 'Keys were not updated for more than {{ $value | humanizeDuration }}' |
This file contains 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,32 @@ | ||
rule_files: | ||
- 'keys-api-outdated-keys.non-empty-db.rule.yml' | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
# Test Case 1: Keys API not updated for more than 10 minutes | ||
- interval: 1m | ||
input_series: | ||
- series: 'lido_keys_api_last_update_timestamp{}' | ||
values: '0x10 60' | ||
alert_rule_test: | ||
- eval_time: 11m | ||
alertname: KeysApiOutdatedKeysNonEmptyDB | ||
exp_alerts: | ||
- exp_labels: | ||
severity: 'critical' | ||
service: 'keys_api' | ||
app_team: 'tooling' | ||
exp_annotations: | ||
summary: 'Keys are outdated' | ||
description: 'Keys were not updated for more than 10m 0s' | ||
|
||
# Test Case 2: Keys API updated during 10 minutes | ||
- interval: 1m | ||
input_series: | ||
- series: 'lido_keys_api_last_update_timestamp{}' | ||
values: '60x10 61' | ||
alert_rule_test: | ||
- eval_time: 11m | ||
alertname: KeysApiOutdatedKeysNonEmptyDB | ||
exp_alerts: [] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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,32 @@ | ||
global: | ||
# The default SMTP From header field. | ||
smtp_from: 'alertmanager@example.com' | ||
# # The default SMTP smarthost used for sending emails. | ||
smtp_smarthost: 'localhost:25' | ||
# The default route. | ||
resolve_timeout: '5m' | ||
|
||
route: | ||
# The route's receiver's name. | ||
receiver: 'team-X-mails' | ||
# Group by these labels. | ||
group_by: ['alertname', 'cluster', 'service'] | ||
# Wait for 30 seconds before sending a notification. | ||
group_wait: '30s' | ||
# Send a notification every 5 minutes. | ||
group_interval: '5m' | ||
# Repeat a notification every 2 hours if the alert is still firing. | ||
repeat_interval: '2h' | ||
# Routes for specific alerts. | ||
routes: | ||
- match: | ||
severity: critical | ||
receiver: 'team-Y-mails' | ||
continue: true | ||
receivers: | ||
- name: 'team-X-mails' | ||
email_configs: | ||
- to: 'team-X+alerts@example.com' | ||
- name: 'team-Y-mails' | ||
email_configs: | ||
- to: 'team-Y+alerts@example.com' |
This file contains 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 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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { DynamicModule, Module } from '@nestjs/common'; | ||
import { MikroOrmModule } from '@mikro-orm/nestjs'; | ||
import config from 'mikro-orm.config'; | ||
import { ConfigModule, ConfigService } from 'common/config'; | ||
|
||
@Module({ | ||
imports: [ | ||
ConfigModule, | ||
MikroOrmModule.forRootAsync({ | ||
async useFactory(configService: ConfigService) { | ||
return { | ||
...config, | ||
dbName: configService.get('DB_NAME'), | ||
host: configService.get('DB_HOST'), | ||
port: configService.get('DB_PORT'), | ||
user: configService.get('DB_USER'), | ||
password: configService.get('DB_PASSWORD'), | ||
autoLoadEntities: false, | ||
cache: { enabled: false }, | ||
debug: false, | ||
registerRequestContext: true, | ||
allowGlobalContext: true, | ||
}; | ||
}, | ||
inject: [ConfigService], | ||
}), | ||
], | ||
}) | ||
export class DatabaseTestingModule {} | ||
@Module({}) | ||
export class DatabaseTestingModule { | ||
static forRoot(mikroOrmConfigOverrides: Partial<typeof config> = {}): DynamicModule { | ||
return { | ||
module: DatabaseTestingModule, | ||
imports: [ | ||
ConfigModule, | ||
MikroOrmModule.forRootAsync({ | ||
async useFactory(configService: ConfigService) { | ||
return { | ||
...config, | ||
...mikroOrmConfigOverrides, | ||
dbName: configService.get('DB_NAME'), | ||
host: configService.get('DB_HOST'), | ||
port: configService.get('DB_PORT'), | ||
user: configService.get('DB_USER'), | ||
password: configService.get('DB_PASSWORD'), | ||
autoLoadEntities: false, | ||
cache: { enabled: false }, | ||
debug: false, | ||
registerRequestContext: true, | ||
allowGlobalContext: true, | ||
}; | ||
}, | ||
inject: [ConfigService], | ||
}), | ||
], | ||
}; | ||
} | ||
} |
Oops, something went wrong.