hs-opentelemetry-api-1.0.0.0: src/OpenTelemetry/Resource/Host.hs
{- |
Module : OpenTelemetry.Resource.Host
Copyright : (c) Ian Duncan, 2021
License : BSD-3
Description : Information about the underlying general computing instance
Maintainer : Ian Duncan
Stability : experimental
Portability : non-portable (GHC extensions)
-}
module OpenTelemetry.Resource.Host (
Host (..),
) where
import Data.Text (Text)
import OpenTelemetry.Attributes.Key (unkey)
import OpenTelemetry.Resource (ToResource (..), mkResourceWithSchema, semConvSchemaUrl, (.=?))
import qualified OpenTelemetry.SemanticConventions as SC
{- | A host is defined as a general computing instance.
@since 0.0.1.0
-}
data Host = Host
{ hostId :: Maybe Text
-- ^ Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider.
, hostName :: Maybe Text
-- ^ Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.
, hostType :: Maybe Text
-- ^ Type of host. For Cloud, this must be the machine type.
, hostArch :: Maybe Text
-- ^ The CPU architecture the host system is running on.
, hostImageName :: Maybe Text
-- ^ Name of the VM image or OS install the host was instantiated from.
, hostImageId :: Maybe Text
-- ^ VM image ID. For Cloud, this value is from the provider.
, hostImageVersion :: Maybe Text
-- ^ The version string of the VM image as defined in Version Attributes.
, hostIp :: Maybe [Text]
-- ^ Host IP addresses.
, hostMac :: Maybe [Text]
-- ^ MAC addresses of the host.
}
instance ToResource Host where
toResource Host {..} =
mkResourceWithSchema
(Just semConvSchemaUrl)
[ unkey SC.host_id .=? hostId
, unkey SC.host_name .=? hostName
, unkey SC.host_type .=? hostType
, unkey SC.host_arch .=? hostArch
, unkey SC.host_image_name .=? hostImageName
, unkey SC.host_image_id .=? hostImageId
, unkey SC.host_image_version .=? hostImageVersion
, unkey SC.host_ip .=? hostIp
, unkey SC.host_mac .=? hostMac
]