# Path: mfr/server/settings.py
# STATIC_PATH = config.get('STATIC_PATH', os.path.join(os.path.dirname(__file__), 'static'))
# ADDRESS = config.get('ADDRESS', 'localhost')
# PORT = config.get('PORT', 7778)
# DEBUG = config.get_bool('DEBUG', False)
# SSL_CERT_FILE = config.get_nullable('SSL_CERT_FILE', None)
# SSL_KEY_FILE = config.get_nullable('SSL_KEY_FILE', None)
# XHEADERS = config.get_bool('XHEADERS', False)
# CORS_ALLOW_ORIGIN = config.get('CORS_ALLOW_ORIGIN', '*')
# CHUNK_SIZE = int(config.get('CHUNK_SIZE', 65536))  # 64KB
# MAX_BUFFER_SIZE = int(config.get('MAX_BUFFER_SIZE', 1024 * 1024 * 100))  # 100MB
# PROVIDER_NAME = config.get('PROVIDER_NAME', 'osf')
# CACHE_ENABLED = config.get_bool('CACHE_ENABLED', False)
# CACHE_PROVIDER_NAME = config.get('CACHE_PROVIDER_NAME', 'filesystem')
# CACHE_PROVIDER_SETTINGS = config.get_object('CACHE_PROVIDER_SETTINGS', {'folder': '/tmp/mfr/'})
# CACHE_PROVIDER_CREDENTIALS = config.get_object('CACHE_PROVIDER_CREDENTIALS', {})
# LOCAL_CACHE_PROVIDER_SETTINGS = config.get_object('LOCAL_CACHE_PROVIDER_SETTINGS', {'folder': '/tmp/mfrlocalcache/'})
# ALLOWED_PROVIDER_DOMAINS = config.get('ALLOWED_PROVIDER_DOMAINS', 'http://localhost:5000/ http://localhost:7777/').split(' ')
# ALLOWED_PROVIDER_NETLOCS = []
# KEEN_API_BASE_URL = keen_config.get('API_BASE_URL', 'https://api.keen.io')
# KEEN_API_VERSION = keen_config.get('API_VERSION', '3.0')
# KEEN_ENABLE_LOGGING = keen_config.get_bool('ENABLE_LOGGING', True)
# KEEN_PRIVATE_PROJECT_ID = keen_private_config.get_nullable('PROJECT_ID', None)
# KEEN_PRIVATE_WRITE_KEY = keen_private_config.get_nullable('WRITE_KEY', None)
# KEEN_PRIVATE_LOG_VIEWS = keen_private_config.get_bool('LOG_VIEWS', True)
# KEEN_PRIVATE_LOG_ERRORS = keen_private_config.get_bool('LOG_ERRORS', True)
# KEEN_PUBLIC_PROJECT_ID = keen_public_config.get_nullable('PROJECT_ID', None)
# KEEN_PUBLIC_WRITE_KEY = keen_public_config.get_nullable('WRITE_KEY', None)
# KEEN_PUBLIC_LOG_VIEWS = keen_public_config.get_bool('LOG_VIEWS', True)
# 
# Path: mfr/version.py



import copy
import json
import logging
import aiohttp
from mfr.server import settings
from mfr.version import __version__
from waterbutler.core.utils import async_retry




logger = logging.getLogger(__name__)


async def log_analytics(request, metrics, is_error=False):
    """Send events to Keen describing the action that occurred."""
    if not settings.KEEN_ENABLE_LOGGING:
        return

    keen_payload = copy.deepcopy(metrics)
    keen_payload['meta'] = {

# Path: mfr/server/settings.py
# STATIC_PATH = config.get('STATIC_PATH', os.path.join(os.path.dirname(__file__), 'static'))
# ADDRESS = config.get('ADDRESS', 'localhost')
# PORT = config.get('PORT', 7778)
# DEBUG = config.get_bool('DEBUG', False)
# SSL_CERT_FILE = config.get_nullable('SSL_CERT_FILE', None)
# SSL_KEY_FILE = config.get_nullable('SSL_KEY_FILE', None)
# XHEADERS = config.get_bool('XHEADERS', False)
# CORS_ALLOW_ORIGIN = config.get('CORS_ALLOW_ORIGIN', '*')
# CHUNK_SIZE = int(config.get('CHUNK_SIZE', 65536))  # 64KB
# MAX_BUFFER_SIZE = int(config.get('MAX_BUFFER_SIZE', 1024 * 1024 * 100))  # 100MB
# PROVIDER_NAME = config.get('PROVIDER_NAME', 'osf')
# CACHE_ENABLED = config.get_bool('CACHE_ENABLED', False)
# CACHE_PROVIDER_NAME = config.get('CACHE_PROVIDER_NAME', 'filesystem')
# CACHE_PROVIDER_SETTINGS = config.get_object('CACHE_PROVIDER_SETTINGS', {'folder': '/tmp/mfr/'})
# CACHE_PROVIDER_CREDENTIALS = config.get_object('CACHE_PROVIDER_CREDENTIALS', {})
# LOCAL_CACHE_PROVIDER_SETTINGS = config.get_object('LOCAL_CACHE_PROVIDER_SETTINGS', {'folder': '/tmp/mfrlocalcache/'})
# ALLOWED_PROVIDER_DOMAINS = config.get('ALLOWED_PROVIDER_DOMAINS', 'http://localhost:5000/ http://localhost:7777/').split(' ')
# ALLOWED_PROVIDER_NETLOCS = []
# KEEN_API_BASE_URL = keen_config.get('API_BASE_URL', 'https://api.keen.io')
# KEEN_API_VERSION = keen_config.get('API_VERSION', '3.0')
# KEEN_ENABLE_LOGGING = keen_config.get_bool('ENABLE_LOGGING', True)
# KEEN_PRIVATE_PROJECT_ID = keen_private_config.get_nullable('PROJECT_ID', None)
# KEEN_PRIVATE_WRITE_KEY = keen_private_config.get_nullable('WRITE_KEY', None)
# KEEN_PRIVATE_LOG_VIEWS = keen_private_config.get_bool('LOG_VIEWS', True)
# KEEN_PRIVATE_LOG_ERRORS = keen_private_config.get_bool('LOG_ERRORS', True)
# KEEN_PUBLIC_PROJECT_ID = keen_public_config.get_nullable('PROJECT_ID', None)
# KEEN_PUBLIC_WRITE_KEY = keen_public_config.get_nullable('WRITE_KEY', None)
# KEEN_PUBLIC_LOG_VIEWS = keen_public_config.get_bool('LOG_VIEWS', True)
# 
# Path: mfr/version.py



# Path: mfr/core/remote_logging.py
import copy
import json
import logging
import aiohttp
from mfr.server import settings
from mfr.version import __version__
from waterbutler.core.utils import async_retry





logger = logging.getLogger(__name__)


async def log_analytics(request, metrics, is_error=False):
    """Send events to Keen describing the action that occurred."""
    if not settings.KEEN_ENABLE_LOGGING:
        return

    keen_payload = copy.deepcopy(metrics)
    keen_payload['meta'] = {

        'mfr_version': __version__,