Skip to content

Commit

Permalink
Merge pull request #446 from wellcomecollection/Remove-catalogue-DLQ-…
Browse files Browse the repository at this point in the history
…alerts-from-Slack

Remove catalogue dlq alerts from slack
  • Loading branch information
StepanBrychta authored Sep 9, 2024
2 parents 7f684c5 + 8bdb798 commit ec9209a
Showing 1 changed file with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def create_context_url(alarm_info):
url_template = """https://logging.wellcomecollection.org/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'{from_date}',to:'{to_date}'))&_a=(columns:!(log),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'{index_pattern_id}',key:ecs_cluster,negate:!f,params:(query:{cluster_name}),type:phrase),query:(match_phrase:(ecs_cluster:{cluster_name})))),index:'{index_pattern_id}',interval:auto,query:(language:kuery,query:'not%20log:%22*HTTP%2F1.1%5C%22%20200*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20206*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20302*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20304*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20307*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20308*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20400*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20401*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20404*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20410*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20414*%22%20and%20not%20log:%22*HTTP%2F1.1%5C%22%20499*%22%20and%20not%20log:%22*GET%20%2Faccount%2Fapi%2Fusers%2Fme%20401*%22%20and%20not%20log:%22*GET%20%2Faccount%2Fapi%2Fauth%2Fme%20401*%22%20and%20not%20log:%22*%3C--%20GET%20%2Faccount%2Fapi%2Fauth%2Fme*%22%20and%20not%20log:%22*%2Fmanagement%2Fhealthcheck*%22%20and%20not%20log:%22*--%3E%20GET%20%2Faccount%2Fapi%2Fusers%2Fme%2Fitem-requests%20304*%22%20and%20not%20log:%22*-x-%20GET%20%2Faccount%2Fapi%2Fusers%2Fme%2Fitem-requests%20304*%22%20and%20not%20log:%22*--%3E%20GET%20%2Faccount%2Fapi%2Fauth%2Flogin%20302*%22%20and%20not%20log:%22-x-%3E%20GET%20%2Faccount%2Fapi%2Fauth%2Flogin%20302*%22%20and%20not%20log:%22*--%3E%20GET%20%2Faccount*%20200*%22%20and%20not%20log:%22*-x-%3E%20GET%20%2Faccount*%20200*%22%20and%20not%20log:%22%3C--%20GET%20%2Faccount%2Fapi%2Fusers%2Fme%2Fitem-requests%22%20and%20not%20log:%22%3C--%20GET%20%2Faccount%2Fapi%2Fauth%2Flogin%22'),sort:!(!('@timestamp',desc)))"""

if alarm_info["name"] == "cloudfront_wc.org_error_5xx":
cluster_name = f"experience-frontend-prod"
cluster_name = "experience-frontend-prod"
elif alarm_info["name"] == "cloudfront_stage.wc.org_error_5xx":
cluster_name = f"experience-frontend-stage"
cluster_name = "experience-frontend-stage"
else:
return

Expand Down Expand Up @@ -133,29 +133,6 @@ def create_context_url(alarm_info):
"label": "View logs in Kibana",
}

if os.environ.get("CONTEXT_URL_TEMPLATE") == "platform-dlq-alerts" and alarm_info[
"name"
].startswith("catalogue-"):
# The alarm name will be something like:
#
# catalogue-2022-03-10_id_minter_input_dlq_not_empty
#
cluster_name = alarm_info["name"].split("_")[0]
service_name = alarm_info["name"].replace("_input_dlq_not_empty", "")

url_template = """https://logging.wellcomecollection.org/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'{from_date}',to:'{to_date}'))&_a=(columns:!(log),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'{index_pattern_id}',key:ecs_cluster,negate:!f,params:(query:{cluster_name}),type:phrase),query:(match_phrase:(ecs_cluster:{cluster_name}))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'{index_pattern_id}',key:service_name,negate:!f,params:(query:{service_name}),type:phrase),query:(match_phrase:(service_name:{service_name})))),index:'{index_pattern_id}',interval:auto,query:(language:kuery,query:''),sort:!(!('@timestamp',desc)))"""

return {
"url": url_template.format(
cluster_name=cluster_name,
service_name=service_name,
to_date=kibana_to_date,
from_date=kibana_from_date,
index_pattern_id=index_pattern_id,
),
"label": "View logs in Kibana",
}


def get_alarm_info(alarm):
# This will be a message of the form:
Expand Down

0 comments on commit ec9209a

Please sign in to comment.