Skip to content

Commit

Permalink
Endrer config for test-alert, endret navn på alerts til å bli mer Ale…
Browse files Browse the repository at this point in the history
…rtmanager-vennlige.

(cherry picked from commit b880306)
  • Loading branch information
rfc3092 authored and stigus committed Oct 17, 2023
1 parent eba1b1a commit db6d0cc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
68 changes: 34 additions & 34 deletions .nais/alerting-dolly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
labels:
team: dolly
spec:
receivers:
slack:
channel: "#dolly-alerts"
icon_emoji: ':dolly-panic:'
groups:
- name: dolly-alerts
rules:
Expand All @@ -14,53 +18,49 @@ spec:
expr: 'kube_deployment_status_replicas_available{namespace = "dolly"} == 0'
for: 5m
annotations:
summary: 'Applikasjonen *{{ $labels.deployment }}* har hatt 0 replicas i >5min og er ikke tilgjengelig.'
summary: 'Applikasjonen {{ $labels.deployment }} har hatt 0 replicas i >5min og er ikke tilgjengelig.'
action: |
Alertmanager: <https://alertmanager.dev-gcp.nav.cloud.nais.io/#/alerts?silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22dolly-replicas-unavailable%22%2C%20app%3D%22{{ $labels.app }}%22%7D&customGrouping=true|Link>
Events: `kubectl describe pod -l app={{ $labels.deployment }}`
Logger: `kubectl logs -l app={{ $labels.deployment }}`
labels:
namespace: 'dolly'
severity: 'critical'
'Events: `kubectl describe pod -l app={{ $labels.deployment }}`\n
Logger: `kubectl logs -l app={{ $labels.deployment }}`'
- action: 'action'
alert: 'dolly-log-errors-test'
description: 'description'
documentation: 'https://www.nav.no'
expr: sum by (app) (increase(log_messages_errors{namespace="dolly",level="Error"}[15m] offset 30m) > 1)
for: 1m
severity: 'danger'
sla: 'sla''
annotations:
summary: 'En applikasjon har hatt mer enn 1 ERRORs i loggen i løpet av de siste 15 minuttene.'


- alert: 'dolly-log-errors'
expr: 'sum by (app,namespace) (increase(log_messages_errors{namespace="dolly",level="Error"}[15m]) > 1)'
expr: 'sum by (app) (increase(log_messages_errors{namespace="dolly",level="Error"}[15m]) > 1)'
for: 1m
annotations:
summary: 'Applikasjonen *{{ $labels.app }}* har hatt mer enn 1 ERRORs i loggen i løpet av de siste 15 minuttene.'
summary: 'Applikasjonen {{ $labels.app }} har hatt mer enn 1 ERRORs i loggen i løpet av de siste 15 minuttene.'
action: |
Alertmanager: <https://alertmanager.dev-gcp.nav.cloud.nais.io/#/alerts?silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22dolly-log-errors%22%2C%20app%3D%22{{ $labels.app }}%22%7D&customGrouping=true|Link>
Events: `kubectl describe pod -l app={{ $labels.app }}`
Logger: `kubectl logs -l app={{ $labels.app }}`
Kibana: <https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>
labels:
namespace: 'dolly'
severity: 'warning'
'Events: `kubectl describe pod -l app={{ $labels.app }}`\n
Logger: `kubectl logs -l app={{ $labels.app }}`\n
Kibana: `<https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22d{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>`'
- alert: 'dolly-server-http-5xx'
expr: 'sum by (app,namespace) (increase(http_server_requests_seconds_count{namespace="dolly",status=~"^5.."}[15m]) > 5)'
expr: 'sum by (app) (increase(http_server_requests_seconds_count{namespace="dolly",status=~"^5.."}[15m]) > 5)'
for: 1m
annotations:
summary: 'Applikasjonen *{{ $labels.app }}* har gitt mer enn 5 HTTP 5xx-responser i løpet av de siste 15 minuttene.'
summary: 'Applikasjonen {{ $labels.app }} har gitt mer enn 5 HTTP 5xx-responser i løpet av de siste 15 minuttene.'
action: |
Alertmanager: <https://alertmanager.dev-gcp.nav.cloud.nais.io/#/alerts?silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22dolly-server-http-5xx%22%2C%20app%3D%22{{ $labels.app }}%22%7D&customGrouping=true|Link>
Events: `kubectl describe pod -l app={{ $labels.app }}`
Logger: `kubectl logs -l app={{ $labels.app }}`
Kibana: <https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>
labels:
namespace: 'dolly'
severity: 'warning'
'Events: `kubectl describe pod -l app={{ $labels.app }}`\n
Logger: `kubectl logs -l app={{ $labels.app }}`\n
Kibana: `<https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22d{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>`'
- alert: 'dolly-client-http-4xx'
expr: 'sum by (app,namespace) (increase(http_client_requests_seconds_count{namespace="dolly",status=~"^4.."}[15m]) > 5)'
expr: 'sum by (app) (increase(http_client_requests_seconds_count{namespace="dolly",http_status_code=~"^4.."}[15m]) > 5)'
for: 1m
annotations:
summary: 'Applikasjonen *{{ $labels.app }}* har fått mer enn 5 HTTP 4xx-responser i løpet av de siste 15 minuttene.'
summary: 'Applikasjonen {{ $labels.app }} har fått mer enn 5 HTTP 4xx-responser i løpet av de siste 15 minuttene.'
action: |
Alertmanager: <https://alertmanager.dev-gcp.nav.cloud.nais.io/#/alerts?silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22dolly-client-http-4xx%22%2C%20app%3D%22{{ $labels.app }}%22%7D&customGrouping=true|Link>
Events: `kubectl describe pod -l app={{ $labels.app }}`
Logger: `kubectl logs -l app={{ $labels.app }}`
Kibana: <https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>
labels:
namespace: 'dolly'
severity: 'warning'
'Events: `kubectl describe pod -l app={{ $labels.app }}`\n
Logger: `kubectl logs -l app={{ $labels.app }}`\n
Kibana: `<https://logs.adeo.no/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-30m,to:now))&_a=(columns:!(level,message,envclass,application,pod),filters:!(),grid:(columns:(x_WorkerID:(width:325))),index:'96e648c0-980a-11e9-830a-e17bbd64b4db',interval:auto,query:(language:kuery,query:'namespace:%20%22dolly%22%20AND%20level:%20%22Error%22%20AND%20application:%20%22d{{ $labels.app }}%22'),sort:!(!('@timestamp',desc)))|Link>`'
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BestillingMal implements Serializable {
private String malNavn;

@ManyToOne
@JoinColumn(name = "bruker_id")
@JoinColumn(name = "BRUKER_ID")
private Bruker bruker;

@Column(name = "SIST_OPPDATERT", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package no.nav.dolly.repository;

import no.nav.dolly.domain.jpa.Bruker;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

public interface BrukerRepository extends JpaRepository<Bruker, Long> {
public interface BrukerRepository extends Repository<Bruker, Long> {
void deleteByBrukerId(String brukerId);

Bruker save(Bruker bruker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ void saveDummyBruker(Bruker bruker) {

void deleteAllDatabaseContent() {
bestillingMalRepository.deleteAll();
bestillingRepository.deleteAll();
identRepository.deleteAll();
bestillingRepository.deleteAll();
brukerFavoritterRepository.deleteAll();
testgruppeRepository.findAll(Sort.unsorted()).forEach(gruppe -> testgruppeRepository.deleteTestgruppeById(gruppe.getId()));
brukerRepository.deleteByBrukerId(DUMMY_EN.getBrukerId());
Expand Down

0 comments on commit db6d0cc

Please sign in to comment.