Skip to content

Money Configuration

Paul Cleary edited this page Dec 6, 2018 · 9 revisions

Money uses the Typesafe Config Library for configuring the system. Money follows the recommendations set forth by the config library; namely it provides "sane" default values for everything that can be configured, and allows you to override the default configuration by providing a file named application.conf on the classpath of your application.

Core configuration

  • enabled - set this to false to disable tracing for the application
  • mdc.enabled - true or false, indicates whether or not you want to use the SLF4J MDC value. If enabled, then you can include the current Trace Context in every log line. This is very helpful when correlating log entries with span data.
  • application-name - set this to the name you want reported for your application. It is best not to use spaces in the application name. This value is reported on each Span as an app-name Note. If you see app-name=unknown, it indicates that you have not configured the application-name.
  • log-exceptions - set this to true to log stack traces with log events for span data

Handler configuration

The handling configuration dictates how span data will ultimately be processed. This gives users the ability to customize the way that span data is reported. The handler configuration is defined under the money.handling configuration namespace. The following entries are available.

  • async - true or false, whether you want to process all handlers asynchronously, or synchronously in a step-wise. If set to true, the span handlers are executed outside of the calling thread that stops the span. If set to false, the span handlers are executed on the same calling thread that stops the span
  • handlers - the configuration settings for one or more span handlers that will process span data. By default, a single SLF4J Logging Span Handler is configured. This will output span data to your log files.

Out-of-the-box Handlers

  • com.comcast.money.core.handlers.StructuredLogSpanHandler - outputs log entries suitable for ingest into ELK
  • com.comcast.money.core.handlers.MetricsSpanHandler - records span data using drop wizard metrics. This includes latency metrics (as a histogram) and error rate metric (as a Meter) for each span in the application.
  • com.comcast.money.core.handlers.LoggingSpanHandler - an alternative to the StructuredSpanHandler for generating output with some configurable formatting for the span log lines themselves.

Example Configuration File:

money {
  enabled = true
  mdc.enabled = true
  application-name = "unknown"
  log-exceptions = false

  handling = {
    async = true
    handlers = [
      {
        class = "com.comcast.money.core.handlers.LoggingSpanHandler"
        log-level = "INFO"
        formatting {
          span-start = "Span: "
          null-value = "NULL"
          log-template = "[ %s=%s ]"
          span-duration-ms-enabled = "false"
          keys {
            span-id = "span-id"
            trace-id = "trace-id"
            parent-id = "parent-id"
            span-name = "span-name"
            app-name = "app-name"
            start-time = "start-time"
            span-duration = "span-duration"
            span-duration-ms = "span-duration-ms"
            span-success = "span-success"
          }
        }
      }
    ]
  }

  async-notifier {
    handlers = [
      {
        class = "com.comcast.money.core.async.ScalaFutureNotificationHandler"
      }
    ]
  }
}