module OpenTelemetry.Resource.Process where
import Data.Text (Text)
import OpenTelemetry.Attributes.Key (unkey)
import OpenTelemetry.Resource
import qualified OpenTelemetry.SemanticConventions as SC
data Process = Process
{ Process -> Maybe Int
processPid :: Maybe Int
, Process -> Maybe Text
processExecutableName :: Maybe Text
, Process -> Maybe Text
processExecutablePath :: Maybe Text
, Process -> Maybe Text
processCommand :: Maybe Text
, Process -> Maybe Text
processCommandLine :: Maybe Text
, Process -> Maybe [Text]
processCommandArgs :: Maybe [Text]
, Process -> Maybe Text
processOwner :: Maybe Text
, Process -> Maybe Text
processCreationTime :: Maybe Text
, Process -> Maybe Int
processArgsCount :: Maybe Int
, Process -> Maybe Int
processParentPid :: Maybe Int
, Process -> Maybe Text
processWorkingDirectory :: Maybe Text
, Process -> Maybe Bool
processInteractive :: Maybe Bool
, Process -> Maybe Text
processTitle :: Maybe Text
, Process -> Maybe Text
processLinuxCgroup :: Maybe Text
}
instance ToResource Process where
toResource :: Process -> Resource
toResource Process {Maybe Bool
Maybe Int
Maybe [Text]
Maybe Text
processPid :: Process -> Maybe Int
processExecutableName :: Process -> Maybe Text
processExecutablePath :: Process -> Maybe Text
processCommand :: Process -> Maybe Text
processCommandLine :: Process -> Maybe Text
processCommandArgs :: Process -> Maybe [Text]
processOwner :: Process -> Maybe Text
processCreationTime :: Process -> Maybe Text
processArgsCount :: Process -> Maybe Int
processParentPid :: Process -> Maybe Int
processWorkingDirectory :: Process -> Maybe Text
processInteractive :: Process -> Maybe Bool
processTitle :: Process -> Maybe Text
processLinuxCgroup :: Process -> Maybe Text
processPid :: Maybe Int
processExecutableName :: Maybe Text
processExecutablePath :: Maybe Text
processCommand :: Maybe Text
processCommandLine :: Maybe Text
processCommandArgs :: Maybe [Text]
processOwner :: Maybe Text
processCreationTime :: Maybe Text
processArgsCount :: Maybe Int
processParentPid :: Maybe Int
processWorkingDirectory :: Maybe Text
processInteractive :: Maybe Bool
processTitle :: Maybe Text
processLinuxCgroup :: Maybe Text
..} =
Maybe Text -> [Maybe (Text, Attribute)] -> Resource
mkResourceWithSchema
(Text -> Maybe Text
forall a. a -> Maybe a
Just Text
semConvSchemaUrl)
[ AttributeKey Int64 -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Int64
SC.process_pid Text -> Maybe Int -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Int
processPid
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_executable_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processExecutableName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_executable_path Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processExecutablePath
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_command Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processCommand
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_commandLine Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processCommandLine
, AttributeKey [Text] -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey [Text]
SC.process_commandArgs Text -> Maybe [Text] -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe [Text]
processCommandArgs
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_owner Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processOwner
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_creation_time Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processCreationTime
, AttributeKey Int64 -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Int64
SC.process_argsCount Text -> Maybe Int -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Int
processArgsCount
, AttributeKey Int64 -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Int64
SC.process_parentPid Text -> Maybe Int -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Int
processParentPid
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_workingDirectory Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processWorkingDirectory
, AttributeKey Bool -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Bool
SC.process_interactive Text -> Maybe Bool -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Bool
processInteractive
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_title Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processTitle
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_linux_cgroup Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processLinuxCgroup
]
data ProcessRuntime = ProcessRuntime
{ ProcessRuntime -> Maybe Text
processRuntimeName :: Maybe Text
, ProcessRuntime -> Maybe Text
processRuntimeVersion :: Maybe Text
, ProcessRuntime -> Maybe Text
processRuntimeDescription :: Maybe Text
}
instance ToResource ProcessRuntime where
toResource :: ProcessRuntime -> Resource
toResource ProcessRuntime {Maybe Text
processRuntimeName :: ProcessRuntime -> Maybe Text
processRuntimeVersion :: ProcessRuntime -> Maybe Text
processRuntimeDescription :: ProcessRuntime -> Maybe Text
processRuntimeName :: Maybe Text
processRuntimeVersion :: Maybe Text
processRuntimeDescription :: Maybe Text
..} =
Maybe Text -> [Maybe (Text, Attribute)] -> Resource
mkResourceWithSchema
(Text -> Maybe Text
forall a. a -> Maybe a
Just Text
semConvSchemaUrl)
[ AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_runtime_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processRuntimeName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_runtime_version Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processRuntimeVersion
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.process_runtime_description Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
processRuntimeDescription
]