Skip to content

Instantly share code, notes, and snippets.

@JoMingyu
JoMingyu / .py
Created February 25, 2019 11:56
from newrelic import agent
import os
newrelic_init_vars = {}
if 'NEW_RELIC_CONFIG_FILE' not in os.environ:
newrelic_init_vars['config_file'] = os.path.dirname(os.path.abspath(__file__)) + '/newrelic.ini'
if 'NEW_RELIC_ENVIRONMENT' not in os.environ:
newrelic_init_vars['environment'] = os.getenv('AWS_LAMBDA_FUNCTION_NAME', 'local').split('-')[-1]