nri-observability-0.1.1.4: Report log spans collected by nri-prelude.
Safe HaskellNone
LanguageHaskell2010

Observability

Description

A module dedicated to observability, that is reporting information about what the program is doing in production to help us debugging it.

Specifically this module is dedicated to sending information that's already been collected to external monitoring platforms, such as Bugsnag and Honeycomb. To learn more about how this information is collected check out the Internal module in the `nri-prelude` package. That module also defines and documents the TracingSpan type, which is the data structure we use to contain observability data we have collected.

Synopsis

Documentation

report :: Handler -> Text -> TracingSpan -> IO () Source #

report takes a span containing all the tracing information we collected for a single request and then reports it to all platforms we enabled when creating this handler.

data Handler Source #

A handler for reporting to loggingmonitoringobservability platforms.

Instances

Instances details
Semigroup Handler Source # 
Instance details

Defined in Observability

Monoid Handler Source # 
Instance details

Defined in Observability

data Settings Source #

Settings for all supported reporters.

Constructors

Settings 

Fields

  • enabledReporters :: [Reporter]

    The reporters that we send debugging information to. The first reporter in the list is treated special: it will also report on failures that take place while running any of the other reporters. Because of this its best if the first reporter is one that has a high likelihood of succeeding, for example because it logs to stdout or a file.

  • file :: Settings

    Each supported reporter has a settings entry below. We parse settings even for reporters that aren't enabled. Because our environment parser insists all variables have default values it's not necessary to make up values for reporters we don't want enabled.

  • bugsnag :: Settings
     
  • honeycomb :: Settings
     
  • dev :: ()
     

data Reporter where Source #

A helper type that combines all the different functions a specific reporter must implement in a single record.

We've defined this as a GADT so we don't need to expose the handler and settings parameters on the type, meaning this type is defined as Reporter rather than `Reporter settings handler`. This allows us to combine multiple reporters in a list.

Constructors

Reporter 

Fields

  • :: { reporterName :: Text
     
  •    , reporterSettings :: Settings -> settings

    Pick the reporter-specific settings from the global Settings type defined in this module.

  •    , reporterHandler :: settings -> Acquire handler

    Create a handler for this reporter. This function will be called once when the application starts for each enabled reporter.

  •    , reporterReport :: handler -> Text -> TracingSpan -> IO ()

    Report a span to this reporter.

  •    } -> Reporter
     

decoder :: Decoder Settings Source #

Read Settings from environment variables. Default variables will be used in case no environment variable is set for an option.

handler :: Settings -> Acquire Handler Source #

Function for creating an observability handler. The settings we pass in determine which platforms we'll report information to.