{-# LANGUAGE DeriveGeneric #-}
module Instana.SDK.Span.NonRootEntry
( NonRootEntry(..)
, addData
, addToErrorCount
, setServiceName
) where
import Data.Aeson (Value)
import qualified Data.Aeson.Extra.Merge as AesonExtra
import Data.Text (Text)
import GHC.Generics
import Instana.SDK.Internal.Id (Id)
data NonRootEntry =
NonRootEntry
{
NonRootEntry -> Id
traceId :: Id
, NonRootEntry -> Id
spanId :: Id
, NonRootEntry -> Id
parentId :: Id
, NonRootEntry -> Text
spanName :: Text
, NonRootEntry -> Int
timestamp :: Int
, NonRootEntry -> Int
errorCount :: Int
, NonRootEntry -> Maybe Text
serviceName :: Maybe Text
, NonRootEntry -> Value
spanData :: Value
} deriving (NonRootEntry -> NonRootEntry -> Bool
(NonRootEntry -> NonRootEntry -> Bool)
-> (NonRootEntry -> NonRootEntry -> Bool) -> Eq NonRootEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NonRootEntry -> NonRootEntry -> Bool
$c/= :: NonRootEntry -> NonRootEntry -> Bool
== :: NonRootEntry -> NonRootEntry -> Bool
$c== :: NonRootEntry -> NonRootEntry -> Bool
Eq, (forall x. NonRootEntry -> Rep NonRootEntry x)
-> (forall x. Rep NonRootEntry x -> NonRootEntry)
-> Generic NonRootEntry
forall x. Rep NonRootEntry x -> NonRootEntry
forall x. NonRootEntry -> Rep NonRootEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NonRootEntry x -> NonRootEntry
$cfrom :: forall x. NonRootEntry -> Rep NonRootEntry x
Generic, Int -> NonRootEntry -> ShowS
[NonRootEntry] -> ShowS
NonRootEntry -> String
(Int -> NonRootEntry -> ShowS)
-> (NonRootEntry -> String)
-> ([NonRootEntry] -> ShowS)
-> Show NonRootEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NonRootEntry] -> ShowS
$cshowList :: [NonRootEntry] -> ShowS
show :: NonRootEntry -> String
$cshow :: NonRootEntry -> String
showsPrec :: Int -> NonRootEntry -> ShowS
$cshowsPrec :: Int -> NonRootEntry -> ShowS
Show)
addToErrorCount :: Int -> NonRootEntry -> NonRootEntry
addToErrorCount :: Int -> NonRootEntry -> NonRootEntry
addToErrorCount increment :: Int
increment nonRootEntry :: NonRootEntry
nonRootEntry =
let
ec :: Int
ec = NonRootEntry -> Int
errorCount NonRootEntry
nonRootEntry
in
NonRootEntry
nonRootEntry { errorCount :: Int
errorCount = Int
ec Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
increment }
setServiceName :: Text -> NonRootEntry -> NonRootEntry
setServiceName :: Text -> NonRootEntry -> NonRootEntry
setServiceName serviceName_ :: Text
serviceName_ nonRootEntry :: NonRootEntry
nonRootEntry =
NonRootEntry
nonRootEntry { serviceName :: Maybe Text
serviceName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
serviceName_ }
addData :: Value -> NonRootEntry -> NonRootEntry
addData :: Value -> NonRootEntry -> NonRootEntry
addData newData :: Value
newData nonRootEntry :: NonRootEntry
nonRootEntry =
let
currentData :: Value
currentData = NonRootEntry -> Value
spanData NonRootEntry
nonRootEntry
mergedData :: Value
mergedData = Value -> Value -> Value
AesonExtra.lodashMerge Value
currentData Value
newData
in
NonRootEntry
nonRootEntry { spanData :: Value
spanData = Value
mergedData }