yeller-0.1.0.2: A Yeller Client For Haskell

Safe HaskellNone
LanguageHaskell2010

Network.Yeller.Internals

Synopsis

Documentation

data ErrorNotification a Source

An error notification. This is what is sent to Yeller's servers

Constructors

ErrorNotification 

Fields

errorType :: Text

The type of the error. E.g. SomeException, DivideByZero

errorMessage :: Text

The message of the exception

errorStackTrace :: [StackFrame]

The stacktrace of the error. Usually grabbed using whoCreated

errorHost :: Text

the host that this error occurred on

errorEnvironment :: Text

the application environment this error occurred in

errorClientVersion :: Text

the version of the yeller client reporting the error

errorExtra :: ExtraErrorInfo a

see ExtraErrorInfo

data StackFrame Source

A line of the stacktrace

Constructors

StackFrame 

Fields

stackFilename :: Text

The filename this line occurred in

stackLineNumber :: Text

The line number(s) this line occurred in

stackFunction :: Text

the function this line occurred in

stackOptions :: StackOptions
 

data StackOptions Source

Options to be associated with each | line in the stacktrace. Currently | only supports if the line is in | the application or not.

Constructors

StackOptions 

data ExtraErrorInfo a Source

Extra error information to be passed along with | an error. All fields are optional.

Constructors

ExtraErrorInfo 

Fields

errorURL :: Maybe Text

If the error happened during a web request, | the url that was hit during that request

errorCustomData :: Maybe (Map Text a)

A map of data that has to conform to Aeson's | ToJSON typeclass. Can be anything | you want that helps you debug the error.

errorLocation :: Maybe Text

what toplevel part of the application the | request that caused the error came from | e.g. web controller name, background job name

errorUser :: Maybe UserInfo

which user the error happened from. | Lets you see how many total users were affected by an error

errorHTTPRequest :: Maybe HTTPRequest

which http request was happening when | the error occurred

Instances

data UserInfo Source

lets you attach which user the error happened with | which lets you count the total number of affected users

Constructors

UserInfo 

Fields

userID :: Integer

the user id of the affected user

data HTTPRequest Source

lets you attach which http request was occurring when the | error happened | which lets you see the browser, if the request came from a spider | and so on

Constructors

HTTPRequest 

Fields

httpRequestUserAgent :: Text

the user agent of the impacted http request

maybeOr :: Maybe a -> a -> a Source

newtype Backend Source

Constructors

Backend Text 

data YellerClient Source

A Yeller client. | Build one with client like so: | client (defaultClientSettings { clientSettingsToken = YellerToken YOUR_TOKEN_HERE }) | | Used to keep persistent | http connections alive, keep track of | which endpoint to send to, and a bunch of | data that's sent along with the error.

Constructors

YellerClient 

Fields

clientToken :: Text

The token used to authenticate with Yeller's servers.

clientHost :: Text

The server this client is running on.

clientEnvironment :: Text

The environment this client is running in

clientVersion :: Text

The version number of this client

clientApplicationPackage :: Text

The name of the application package that is using this client

clientManager :: Manager

The http manager for tracking open connections

clientBackends :: TVar [Backend]

the set of backends to use. The next backend that will | be used is second in the list.

clientErrorHandler :: YellerClientErrorHandler

the client error handler. See YellerClientErrorHandler

clientMaxRetries :: Int

the maximum number of retries

DisabledYellerClient 

data YellerClientErrorHandler Source

An error handler, for dealing with errors when sending errors to Yeller's servers | defaultErrorHandler just prints to stderr when receiving errors, but you | might want to override that to make it go to your logging system of choice.

Constructors

YellerClientErrorHandler 

Fields

handleAuthenticationErrors :: Response BodyReader -> IO ()

used when handling authentication (401, 403) failures from Yeller's servers. | These errors are *not* retried like other ones.

handleIOErrors :: SomeException -> ErrorNotification Value -> IO ()

used when handling any errors that aren't authentication related. | This function will only be called after clientMaxRetries is | exceeded.

data ApplicationEnvironment Source

the Environment your client is running in. If set to TestEnvironment, | then no errors will be reported (which you should do for development/testing)

newtype ApplicationPackage Source

The name of the package your application is in.

Constructors

ApplicationPackage Text 

newtype YellerToken Source

An api token. Get one from your project's settings page

Constructors

YellerToken Text 

data YellerClientSettings Source

Options you pass when creating a client, usually done like this: | client (defaultClientSettings { clientSettingsToken = YellerToken YOUR_TOKEN_HERE })

Constructors

YellerClientSettings 

Fields

clientSettingsToken :: YellerToken

The api token used for authenticating with Yeller's servers

clientSettingsHost :: Maybe Text

(optional): the name of the server this client is running on | if set to Nothing, client will default it to getHostName

clientSettingsEnvironment :: ApplicationEnvironment

the name of the environment the application is running in | for example: production, test etc | if set to TestEnvironment, the client will be disabled

clientSettingsApplicationPackage :: ApplicationPackage

the name of the application package, used to | filter out noisy stacktrace lines by default in | the UI. Lines from functions starting with this | are marked as "in-app", others will only show | up via a toggle in the UI.

clientSettingsBackends :: [Backend]

a list of servers to contact. Weird things will | probably happen if it's set to []

clientSettingsErrorHandler :: YellerClientErrorHandler

used for handling errors when sending to Yeller's | servers. See YellerClientErrorHandler for more.

clientSettingsMaxRetries :: Int

the maximum number of times to retry sending to | the servers before logging a failure

defaultClientSettings :: YellerClientSettings Source

the default client settings, used for constructing a client

class ToError a where Source

A class for converting things into errors | Means you can pass both exceptions, and any | other error like values in your code

sendError :: (ToError e, ToJSON a) => YellerClient -> e -> ExtraErrorInfo a -> IO () Source

Sends an error to Yeller's servers | needs a client, something that can be turned into an error (via ToError), and | extra error information (which describes additional information to be sent | along with the error)

modifyTVar_ :: TVar a -> (a -> a) -> STM () Source

client :: YellerClientSettings -> IO YellerClient Source

Initializes a Yeller client, given some client settings | Call it like this with the default client settings: | client (defaultClientSettings { clientSettingsToken = YellerToken YOUR_TOKEN_HERE })