UNPKG

newrelic

Version:
260 lines (250 loc) 9.12 kB
/* * Copyright 2020 New Relic Corporation. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ 'use strict' // Map of configuration values to their associated environment value names. const ENV_MAPPING = { newrelic_home: 'NEW_RELIC_HOME', app_name: 'NEW_RELIC_APP_NAME', license_key: 'NEW_RELIC_LICENSE_KEY', apdex_t: 'NEW_RELIC_APDEX_T', security_policies_token: 'NEW_RELIC_SECURITY_POLICIES_TOKEN', ssl: 'NEW_RELIC_USE_SSL', host: 'NEW_RELIC_HOST', port: 'NEW_RELIC_PORT', proxy: 'NEW_RELIC_PROXY_URL', proxy_host: 'NEW_RELIC_PROXY_HOST', proxy_port: 'NEW_RELIC_PROXY_PORT', proxy_user: 'NEW_RELIC_PROXY_USER', proxy_pass: 'NEW_RELIC_PROXY_PASS', agent_enabled: 'NEW_RELIC_ENABLED', attributes: { enabled: 'NEW_RELIC_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_ATTRIBUTES_INCLUDE', include_enabled: 'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED' }, logging: { level: 'NEW_RELIC_LOG_LEVEL', filepath: 'NEW_RELIC_LOG', enabled: 'NEW_RELIC_LOG_ENABLED' }, audit_log: { enabled: 'NEW_RELIC_AUDIT_LOG_ENABLED', endpoints: 'NEW_RELIC_AUDIT_LOG_ENDPOINTS' }, error_collector: { attributes: { enabled: 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED' }, enabled: 'NEW_RELIC_ERROR_COLLECTOR_ENABLED', ignore_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES', ignore_classes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS', expected_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES', expected_classes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS', }, strip_exception_messages: { enabled: 'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED' }, transaction_events: { attributes: { enabled: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE' } }, transaction_tracer: { attributes: { enabled: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE' }, enabled: 'NEW_RELIC_TRACER_ENABLED', transaction_threshold: 'NEW_RELIC_TRACER_THRESHOLD', top_n: 'NEW_RELIC_TRACER_TOP_N', record_sql: 'NEW_RELIC_RECORD_SQL', explain_threshold: 'NEW_RELIC_EXPLAIN_THRESHOLD', hide_internals: 'NEW_RELIC_HIDE_INTERNALS' }, utilization: { detect_aws: 'NEW_RELIC_UTILIZATION_DETECT_AWS', detect_pcf: 'NEW_RELIC_UTILIZATION_DETECT_PCF', detect_azure: 'NEW_RELIC_UTILIZATION_DETECT_AZURE', detect_gcp: 'NEW_RELIC_UTILIZATION_DETECT_GCP', detect_docker: 'NEW_RELIC_UTILIZATION_DETECT_DOCKER', detect_kubernetes: 'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES', logical_processors: 'NEW_RELIC_UTILIZATION_LOGICAL_PROCESSORS', total_ram_mib: 'NEW_RELIC_UTILIZATION_TOTAL_RAM_MIB', billing_hostname: 'NEW_RELIC_UTILIZATION_BILLING_HOSTNAME' }, rules: { name: 'NEW_RELIC_NAMING_RULES', ignore: 'NEW_RELIC_IGNORING_RULES' }, enforce_backstop: 'NEW_RELIC_ENFORCE_BACKSTOP', browser_monitoring: { attributes: { enabled: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE' }, enable: 'NEW_RELIC_BROWSER_MONITOR_ENABLE', debug: 'NEW_RELIC_BROWSER_MONITOR_DEBUG' }, high_security: 'NEW_RELIC_HIGH_SECURITY', labels: 'NEW_RELIC_LABELS', slow_sql: { enabled: 'NEW_RELIC_SLOW_SQL_ENABLED', max_samples: 'NEW_RELIC_MAX_SQL_SAMPLES' }, process_host: { display_name: 'NEW_RELIC_PROCESS_HOST_DISPLAY_NAME', ipv_preference: 'NEW_RELIC_IPV_PREFERENCE' }, api: { custom_attributes_enabled: 'NEW_RELIC_API_CUSTOM_ATTRIBUTES', custom_events_enabled: 'NEW_RELIC_API_CUSTOM_EVENTS', notice_error_enabled: 'NEW_RELIC_API_NOTICE_ERROR' }, datastore_tracer: { instance_reporting: { enabled: 'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED' }, database_name_reporting:{ enabled: 'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED' } }, span_events: { enabled: 'NEW_RELIC_SPAN_EVENTS_ENABLED', attributes: { enabled: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE' } }, transaction_segments: { attributes: { enabled: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED', exclude: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE', include: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE' } }, distributed_tracing: { enabled: 'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED', exclude_newrelic_header: 'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER' }, message_tracer: { segment_parameters: { enabled: 'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED' } }, serverless_mode: { enabled: 'NEW_RELIC_SERVERLESS_MODE_ENABLED' }, plugins: { native_metrics: { enabled: 'NEW_RELIC_NATIVE_METRICS_ENABLED' } }, trusted_account_key: 'NEW_RELIC_TRUSTED_ACCOUNT_KEY', primary_application_id: 'NEW_RELIC_PRIMARY_APPLICATION_ID', account_id: 'NEW_RELIC_ACCOUNT_ID', infinite_tracing: { trace_observer: { host: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST', port: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT' }, span_events: { queue_size: 'NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE' } } } // List of environment values which are comma-delimited lists. const LIST_VARS = new Set([ 'NEW_RELIC_APP_NAME', 'NEW_RELIC_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_ATTRIBUTES_INCLUDE', 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES', 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS', 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES', 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS', 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDE', 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE', 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE', 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE', 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE', 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE', 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE', 'NEW_RELIC_IGNORING_RULES', 'NEW_RELIC_AUDIT_LOG_ENDPOINTS' ]) // Mapping to customize the split delimiter for the LIST_VARS const LIST_VARS_CUSTOM_DELIMITERS = { 'NEW_RELIC_APP_NAME': /;|,/ } // Values in object lists are comma-delimited object literals const OBJECT_LIST_VARS = new Set([ 'NEW_RELIC_NAMING_RULES' ]) // Values in boolean variables. Is pretty tolerant about values, but don't get // fancy--just use 'true' and 'false', everybody. const BOOLEAN_VARS = new Set([ 'NEW_RELIC_ENABLED', 'NEW_RELIC_ATTRIBUTES_ENABLED', 'NEW_RELIC_ERROR_COLLECTOR_ENABLED', 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED', 'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED', 'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED', 'NEW_RELIC_TRACER_ENABLED', 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED', 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED', 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED', 'NEW_RELIC_DEBUG_METRICS', 'NEW_RELIC_DEBUG_TRACER', 'NEW_RELIC_ENFORCE_BACKSTOP', 'NEW_RELIC_USE_SSL', 'NEW_RELIC_BROWSER_MONITOR_ENABLE', 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED', 'NEW_RELIC_BROWSER_MONITOR_DEBUG', 'NEW_RELIC_HIGH_SECURITY', 'NEW_RELIC_SLOW_SQL_ENABLED', 'NEW_RELIC_SPAN_EVENTS_ENABLED', 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED', 'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED', 'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER', 'NEW_RELIC_LOG_ENABLED', 'NEW_RELIC_AUDIT_LOG_ENABLED', 'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED', 'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED', 'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED', 'NEW_RELIC_UTILIZATION_DETECT_AWS', 'NEW_RELIC_UTILIZATION_DETECT_PCF', 'NEW_RELIC_UTILIZATION_DETECT_AZURE', 'NEW_RELIC_UTILIZATION_DETECT_DOCKER', 'NEW_RELIC_UTILIZATION_DETECT_GCP', 'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES', 'NEW_RELIC_SERVERLESS_MODE_ENABLED', 'NEW_RELIC_NATIVE_METRICS_ENABLED' ]) const FLOAT_VARS = new Set([ 'NEW_RELIC_APDEX_T', 'NEW_RELIC_TRACER_THRESHOLD' ]) const INT_VARS = new Set([ 'NEW_RELIC_EXPLAIN_THRESHOLD', 'NEW_RELIC_MAX_SQL_SAMPLES', 'NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE' ]) exports.ENV_MAPPING = ENV_MAPPING exports.LIST_VARS = LIST_VARS exports.LIST_VARS_CUSTOM_DELIMITERS = LIST_VARS_CUSTOM_DELIMITERS exports.OBJECT_LIST_VARS = OBJECT_LIST_VARS exports.BOOLEAN_VARS = BOOLEAN_VARS exports.FLOAT_VARS = FLOAT_VARS exports.INT_VARS = INT_VARS