Safe Haskell | None |
---|---|
Language | Haskell2010 |
Instana.SDK.SDK is the main API of the Instana Haskell Trace SDK. Use one of
initInstana
, initConfiguredInstana
, withInstana
, or
withConfiguredInstana
to get an InstanaContext. Then use the context with any
of the withRootEntry
, withEntry
, withExit
functions for tracing.
- data Config
- type InstanaContext = InternalContext
- addData :: MonadIO m => InstanaContext -> Value -> m ()
- addDataAt :: (MonadIO m, ToJSON a) => InstanaContext -> Text -> a -> m ()
- addHttpTracingHeaders :: MonadIO m => InstanaContext -> Request -> m Request
- addToErrorCount :: MonadIO m => InstanaContext -> Int -> m ()
- agentHost :: Config -> Maybe String
- agentName :: Config -> Maybe String
- agentPort :: Config -> Maybe Int
- completeEntry :: MonadIO m => InstanaContext -> m ()
- completeExit :: MonadIO m => InstanaContext -> m ()
- defaultConfig :: Config
- forceTransmissionAfter :: Config -> Maybe Int
- forceTransmissionStartingAt :: Config -> Maybe Int
- incrementErrorCount :: MonadIO m => InstanaContext -> m ()
- initConfiguredInstana :: MonadIO m => Config -> m InstanaContext
- initInstana :: MonadIO m => m InstanaContext
- maxBufferedSpans :: Config -> Maybe Int
- readHttpTracingHeaders :: Request -> TracingHeaders
- startEntry :: MonadIO m => InstanaContext -> String -> String -> Text -> m ()
- startExit :: MonadIO m => InstanaContext -> Text -> m ()
- startHttpEntry :: MonadIO m => InstanaContext -> Request -> m ()
- startHttpExit :: MonadIO m => InstanaContext -> Request -> m Request
- startRootEntry :: MonadIO m => InstanaContext -> Text -> m ()
- withConfiguredInstana :: MonadIO m => Config -> (InstanaContext -> m a) -> m a
- withEntry :: MonadIO m => InstanaContext -> String -> String -> Text -> m a -> m a
- withExit :: MonadIO m => InstanaContext -> Text -> m a -> m a
- withHttpEntry :: MonadIO m => InstanaContext -> Request -> m a -> m a
- withHttpExit :: MonadIO m => InstanaContext -> Request -> (Request -> m a) -> m a
- withInstana :: MonadIO m => (InstanaContext -> m a) -> m a
- withRootEntry :: MonadIO m => InstanaContext -> Text -> m a -> m a
Documentation
Configuration for the Instana SDK. Please use the defaultConfig
function and then modify individual settings via record syntax For more
information, see http://www.yesodweb.com/book/settings-types.
type InstanaContext = InternalContext Source #
A container for all the things the Instana SDK needs to do its work.
addData :: MonadIO m => InstanaContext -> Value -> m () Source #
Adds additional custom data to the currently active span. Call this between startEntrystartRootEntrystartExit and completeEntry/completeExit or inside the IO action given to with withEntrywithExitwithRootEntry. Can be called multiple times, data from multiple calls will be merged.
addDataAt :: (MonadIO m, ToJSON a) => InstanaContext -> Text -> a -> m () Source #
Adds additional custom data to the currently active span. Call this between startEntrystartRootEntrystartExit and completeEntry/completeExit or inside the IO action given to with withEntrywithExitwithRootEntry. The given path can be a nested path, with path fragments separated by dots, like "http.url". This will result in "data": { ... "http": { "url": "..." }, ... }
addHttpTracingHeaders :: MonadIO m => InstanaContext -> Request -> m Request Source #
Adds the Instana tracing headers (https:/docs.instana.iocore_conceptstracing#http-tracing-headers) from the currently active span to the given HTTP client request.
addToErrorCount :: MonadIO m => InstanaContext -> Int -> m () Source #
Increments the error count for the currently active span by one. Call this between startEntrystartRootEntrystartExit and completeEntry/completeExit or inside the IO action given to with withEntrywithExitwithRootEntry if an error happens while processing the entry/exit.
agentName :: Config -> Maybe String Source #
When establishing a connection to the Instana agent, the SDK validates
the Instana agent's Server
HTTP response header. Should you have
changed the Server name on the agent side, you can use parameter to
provide the name to match that header against.
completeEntry :: MonadIO m => InstanaContext -> m () Source #
Completes an entry span, to be called at the last possible moment before the call has been processed completely.
completeExit :: MonadIO m => InstanaContext -> m () Source #
Completes an exit span, to be called as soon as the remote call has returned.
defaultConfig :: Config Source #
Populates all config values as Nothing, so that the Instana SDK relies on environment variables or on its default config values (in this order) internally.
forceTransmissionAfter :: Config -> Maybe Int Source #
Spans are usually buffered before being transmitted to the agent. This setting forces the transmission of all buffered spans after the given amount of milliseconds. Default: 1000.
forceTransmissionStartingAt :: Config -> Maybe Int Source #
This setting forces the transmission of all buffered spans when the given number of spans has been buffered.
incrementErrorCount :: MonadIO m => InstanaContext -> m () Source #
Increments the error count for the currently active span by one. Call this between startEntrystartRootEntrystartExit and completeEntry/completeExit or inside the IO action given to with withEntrywithExitwithRootEntry if an error happens while processing the entry/exit.
This is an alias for `addToErrorCount instanaContext 1`.
initConfiguredInstana :: MonadIO m => Config -> m InstanaContext Source #
Initializes the Instana SDK and the connection to the Instana agent, using the given Instana configuration.
Configuration settings that have not been set in the given configuration are read from the environment, falling back to default values.
initInstana :: MonadIO m => m InstanaContext Source #
Initializes the Instana SDK and the connection to the Instana agent.
The configuration is read from the environment, falling back to default values.
maxBufferedSpans :: Config -> Maybe Int Source #
Limits the number of spans to buffer. When the limit is reached, spans will be dropped. This setting is a safe guard against memory leaks from buffering excessive amounts of spans. It must be larger than forceTransmissionStartingAt.
readHttpTracingHeaders :: Request -> TracingHeaders Source #
Reads the Instana tracing headers (https:/docs.instana.iocore_conceptstracing#http-tracing-headers) from the given request.
startEntry :: MonadIO m => InstanaContext -> String -> String -> Text -> m () Source #
Creates a preliminary/incomplete entry span, which should later be completed
by calling completeEntry
.
startExit :: MonadIO m => InstanaContext -> Text -> m () Source #
Creates a preliminary/incomplete exit span, which should later be completed
with completeExit
.
startHttpEntry :: MonadIO m => InstanaContext -> Request -> m () Source #
A convenience function that examines the given request for Instana tracing
headers (https:/docs.instana.iocore_conceptstracing#http-tracing-headers)
and either calls startRootEntry
or startEntry
, depending on the presence
of absence of these headers.
startHttpExit :: MonadIO m => InstanaContext -> Request -> m Request Source #
Creates a preliminary/incomplete http exit span, which should later be
completed with completeExit
. The Instana tracing headers are added to the
request and the modified request value is returned (use the return value of
this function to execute your request instead of the request value passed
into this function).
startRootEntry :: MonadIO m => InstanaContext -> Text -> m () Source #
Creates a preliminary/incomplete root entry span, which should later be
completed with completeEntry
.
withConfiguredInstana :: MonadIO m => Config -> (InstanaContext -> m a) -> m a Source #
Initializes the Instana SDK and the connection to the Instana agent, then calls the given function with the established connection, using the given Instana configuration.
Configuration settings that have not been set in the given configuration are read from the environment, falling back to default values.
withEntry :: MonadIO m => InstanaContext -> String -> String -> Text -> m a -> m a Source #
Wraps an IO action in startEntry
and completeEntry
.
withExit :: MonadIO m => InstanaContext -> Text -> m a -> m a Source #
Wraps an IO action in startExit
and completeExit
.
withHttpEntry :: MonadIO m => InstanaContext -> Request -> m a -> m a Source #
A convenience function that examines the given request for Instana tracing
headers (https:/docs.instana.iocore_conceptstracing#http-tracing-headers)
and wraps the given IO action either in startRootEntry
or startEntry
and
completeEntry
, depending on the presence or absence of these headers.
withHttpExit :: MonadIO m => InstanaContext -> Request -> (Request -> m a) -> m a Source #
Wraps an IO action in startHttpExit
and completeExit
. The given action
is accepted as a function (Request -> IO a) and is expected to use the
provided request parameter for executing the HTTP request.
withInstana :: MonadIO m => (InstanaContext -> m a) -> m a Source #
Initializes the Instana SDK and the connection to the Instana agent, then calls the given function with the established connection.
The configuration is read from the environment, falling back to default values.
withRootEntry :: MonadIO m => InstanaContext -> Text -> m a -> m a Source #
Wraps an IO action in startRootEntry
and completeEntry
.