You are here

function statsd_admin_settings in StatsD 7.2

Same name and namespace in other branches
  1. 6 statsd.admin.inc \statsd_admin_settings()
  2. 7 statsd.admin.inc \statsd_admin_settings()

Page callback for StatsD administrative settings.

1 string reference to 'statsd_admin_settings'
statsd_menu in ./statsd.module
Implementation of hook_menu()

File

./statsd.admin.inc, line 7

Code

function statsd_admin_settings() {
  $statsd = statsd_instance();
  $form['statsd_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable StatsD'),
    '#description' => t('Enable StatsD logging. You may want to disable this in non-production environments.'),
    '#default_value' => $statsd->enabled,
  );
  $form['statsd_host'] = array(
    '#type' => 'textfield',
    '#title' => t('Host'),
    '#size' => 25,
    '#description' => t('The hostname, or IP address of the StatsD daemon. To minimize latency issue, use an IP whenever possible.'),
    '#default_value' => $statsd->host,
  );
  $form['statsd_port'] = array(
    '#type' => 'textfield',
    '#title' => t('Port'),
    '#size' => 5,
    '#description' => t('The port of the StatsD daemon'),
    '#default_value' => $statsd->port,
  );
  $form['events'] = array(
    '#type' => 'fieldset',
    '#title' => t('Events'),
    '#collapsible' => TRUE,
  );
  $form['events']['statsd_user_events'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send User Events'),
    '#description' => t('Captures various user events in the following categories: active sessions, successful logins, failed logins, page views'),
    '#default_value' => variable_get('statsd_user_events', TRUE),
  );
  $form['events']['statsd_performance_events'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send Performance Events'),
    '#description' => t('Captures various performance events including peak memory usage and page execution time.'),
    '#default_value' => variable_get('stats_performance_events', TRUE),
  );
  $form['events']['statsd_watchdog_events'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send Watchdog Events'),
    '#description' => t('Captures the severity and type of errors passed through watchdog.'),
    '#default_value' => variable_get('statsd_watchdog_events', TRUE),
  );
  $form['events']['statsd_watchdog_level'] = array(
    '#type' => 'select',
    '#title' => t('Log Level'),
    '#description' => t('If watchdog events are enabled, only send data to StatsD at or above the selected threshold'),
    '#options' => watchdog_severity_levels(),
    '#default_value' => variable_get('statsd_watchdog_level', WATCHDOG_WARNING),
  );
  $form['statsd_sample_rate'] = array(
    '#type' => 'textfield',
    '#title' => t('Sample Rate'),
    '#size' => 2,
    '#description' => t('StatsD can send a subset of events to Graphite. Choose a lower sample rate if you want to reduce the number of events being sent. Sample rates are between 0 and 1 (e.g. 0.1 implies 10% of events will be logged)'),
    '#default_value' => $statsd->sampleRate,
  );
  $form['statsd_prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#size' => 15,
    '#description' => t('Use a prefix if you need to separate similar events (such as on different web servers). This prefix is added for calls (if enabled), as well as any calls via the built-in StatsD client. Do not include the period at the end of the prefix (e.g. use "myprefix" instead of "myprefix."'),
    '#default_value' => $statsd->prefix,
  );
  $form['statsd_suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#size' => 15,
    '#description' => t('Use a suffix if you need to separate similar events (such as on different web servers). This suffix is added for calls (if enabled), as well as any calls via the built-in StatsD client. Do not include the period at the beginning of the suffix (e.g. use "mysuffix" instead of "mysuffix."'),
    '#default_value' => $statsd->suffix,
  );
  return system_settings_form($form);
}