module OpenTelemetry.Resource.FaaS where
import Data.Text (Text)
import OpenTelemetry.Attributes.Key (unkey)
import OpenTelemetry.Resource
import qualified OpenTelemetry.SemanticConventions as SC
data FaaS = FaaS
{ FaaS -> Text
faasName :: Text
, FaaS -> Maybe Text
faasCloudResourceId :: Maybe Text
, FaaS -> Maybe Text
faasVersion :: Maybe Text
, FaaS -> Maybe Text
faasInstance :: Maybe Text
, FaaS -> Maybe Int
faasMaxMemory :: Maybe Int
}
deriving (Int -> FaaS -> ShowS
[FaaS] -> ShowS
FaaS -> String
(Int -> FaaS -> ShowS)
-> (FaaS -> String) -> ([FaaS] -> ShowS) -> Show FaaS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FaaS -> ShowS
showsPrec :: Int -> FaaS -> ShowS
$cshow :: FaaS -> String
show :: FaaS -> String
$cshowList :: [FaaS] -> ShowS
showList :: [FaaS] -> ShowS
Show)
instance ToResource FaaS where
toResource :: FaaS -> Resource
toResource FaaS {Maybe Int
Maybe Text
Text
faasName :: FaaS -> Text
faasCloudResourceId :: FaaS -> Maybe Text
faasVersion :: FaaS -> Maybe Text
faasInstance :: FaaS -> Maybe Text
faasMaxMemory :: FaaS -> Maybe Int
faasName :: Text
faasCloudResourceId :: Maybe Text
faasVersion :: Maybe Text
faasInstance :: Maybe Text
faasMaxMemory :: Maybe Int
..} =
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.faas_name Text -> Text -> Maybe (Text, Attribute)
forall a. ToAttribute a => Text -> a -> Maybe (Text, Attribute)
.= Text
faasName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.cloud_resourceId Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
faasCloudResourceId
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.faas_version Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
faasVersion
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.faas_instance Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
faasInstance
, AttributeKey Int64 -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Int64
SC.faas_maxMemory Text -> Maybe Int -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Int
faasMaxMemory
]