"""Config for spotify_daily_chart_freshness Lambda.""" import os from lambdacommon import common_config logger = common_config.logger # Environment ENVIRONMENT = os.environ.get('ENVIRONMENT', common_config.ENVIRONMENT) # Secrets Manager path prefix for all credentials SPOTIFY_SECRETS_PATH = os.environ.get('SPOTIFY_SECRETS_PATH', 'spotify_charts') SNOWFLAKE_SECRETS_PATH = os.environ.get('SNOWFLAKE_SECRETS_PATH', 'snowflake/lambda') # Snowflake connection (non-sensitive — passed as env vars) SNOWFLAKE_ACCOUNT = os.environ.get('SNOWFLAKE_ACCOUNT', 'delphi.us-east-1') SNOWFLAKE_USER = os.environ.get('SNOWFLAKE_USER', 'PROD_LAMBDA_SPOTIFY_DAILY_CHART_FRESHNESS') # SSM parameter for persisting monitor state across invocations SSM_STATE_PARAM = os.environ.get( 'SSM_STATE_PARAM', f'/{ENVIRONMENT}/spotify-daily-chart-freshness/state' ) # How long to wait (minutes) after Spotify has a new date before alerting LAG_ALERT_MINUTES = int(os.environ.get('LAG_ALERT_MINUTES', '15')) # Spotify provider API SPOTIFY_OAUTH_URL = 'https://accounts.spotify.com/api/token' # GLOBAL daily regional chart — earliest / most representative availability signal SPOTIFY_CHART_URL = ( 'https://provider-api.spotify.com/v1/analytics/spotifycharts/' 'regional-global-daily/{year}/{month}/{day}' ) # DataDog metric names DD_LAG_METRIC = 'insights.spotify_daily_chart.lag_minutes' DD_ALERT_METRIC = 'insights.spotify_daily_chart.lag_alert' DD_SPOTIFY_UP_METRIC = 'insights.spotify_daily_chart.spotify_api_up' DD_TAGS = [f'env:{ENVIRONMENT}', 'service:spotify-daily-chart-freshness']