Skip to content

Commit

Permalink
Set container name as sentry tag (#73)
Browse files Browse the repository at this point in the history
* Set container name as sentry tag
  • Loading branch information
amCap1712 authored Feb 17, 2022
1 parent 9d0e2bd commit b92983e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions brainzutils/flask/loggers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=invalid-name
import logging
import os
from logging.handlers import RotatingFileHandler, SMTPHandler

import sentry_sdk
Expand Down Expand Up @@ -35,3 +36,7 @@ def add_sentry(dsn, level=logging.WARNING, **options):
sentry_sdk.init(dsn, integrations=[LoggingIntegration(level=level), FlaskIntegration(), RedisIntegration(),
SqlalchemyIntegration()],
**options)
# This env variable is set in the MetaBrainz production infrastructure and is unique per container
container_name = os.getenv("CONTAINER_NAME")
if container_name:
sentry_sdk.set_tag("container_name", container_name)

0 comments on commit b92983e

Please sign in to comment.