module OpenTelemetry.Resource.Kubernetes where
import Data.Text (Text)
import OpenTelemetry.Attributes.Key (unkey)
import OpenTelemetry.Resource
import qualified OpenTelemetry.SemanticConventions as SC
data Cluster = Cluster
{ Cluster -> Maybe Text
clusterName :: Maybe Text
, Cluster -> Maybe Text
clusterUid :: Maybe Text
}
deriving (Int -> Cluster -> ShowS
[Cluster] -> ShowS
Cluster -> String
(Int -> Cluster -> ShowS)
-> (Cluster -> String) -> ([Cluster] -> ShowS) -> Show Cluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Cluster -> ShowS
showsPrec :: Int -> Cluster -> ShowS
$cshow :: Cluster -> String
show :: Cluster -> String
$cshowList :: [Cluster] -> ShowS
showList :: [Cluster] -> ShowS
Show)
instance ToResource Cluster where
toResource :: Cluster -> Resource
toResource Cluster {Maybe Text
clusterName :: Cluster -> Maybe Text
clusterUid :: Cluster -> Maybe Text
clusterName :: Maybe Text
clusterUid :: 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.k8s_cluster_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
clusterName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_cluster_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
clusterUid
]
data Node = Node
{ Node -> Maybe Text
nodeName :: Maybe Text
, Node -> Maybe Text
nodeUid :: Maybe Text
}
deriving (Int -> Node -> ShowS
[Node] -> ShowS
Node -> String
(Int -> Node -> ShowS)
-> (Node -> String) -> ([Node] -> ShowS) -> Show Node
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Node -> ShowS
showsPrec :: Int -> Node -> ShowS
$cshow :: Node -> String
show :: Node -> String
$cshowList :: [Node] -> ShowS
showList :: [Node] -> ShowS
Show)
instance ToResource Node where
toResource :: Node -> Resource
toResource Node {Maybe Text
nodeName :: Node -> Maybe Text
nodeUid :: Node -> Maybe Text
nodeName :: Maybe Text
nodeUid :: 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.k8s_node_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
nodeName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_node_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
nodeUid
]
newtype Namespace = Namespace
{ Namespace -> Maybe Text
namespaceName :: Maybe Text
}
deriving (Int -> Namespace -> ShowS
[Namespace] -> ShowS
Namespace -> String
(Int -> Namespace -> ShowS)
-> (Namespace -> String)
-> ([Namespace] -> ShowS)
-> Show Namespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Namespace -> ShowS
showsPrec :: Int -> Namespace -> ShowS
$cshow :: Namespace -> String
show :: Namespace -> String
$cshowList :: [Namespace] -> ShowS
showList :: [Namespace] -> ShowS
Show)
instance ToResource Namespace where
toResource :: Namespace -> Resource
toResource Namespace {Maybe Text
namespaceName :: Namespace -> Maybe Text
namespaceName :: 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.k8s_namespace_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
namespaceName
]
data Pod = Pod
{ Pod -> Maybe Text
podName :: Maybe Text
, Pod -> Maybe Text
podUid :: Maybe Text
}
deriving (Int -> Pod -> ShowS
[Pod] -> ShowS
Pod -> String
(Int -> Pod -> ShowS)
-> (Pod -> String) -> ([Pod] -> ShowS) -> Show Pod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Pod -> ShowS
showsPrec :: Int -> Pod -> ShowS
$cshow :: Pod -> String
show :: Pod -> String
$cshowList :: [Pod] -> ShowS
showList :: [Pod] -> ShowS
Show)
instance ToResource Pod where
toResource :: Pod -> Resource
toResource Pod {Maybe Text
podName :: Pod -> Maybe Text
podUid :: Pod -> Maybe Text
podName :: Maybe Text
podUid :: 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.k8s_pod_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
podName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_pod_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
podUid
]
data Container = Container
{ Container -> Maybe Text
containerName :: Maybe Text
, Container -> Maybe Int
containerRestartCount :: Maybe Int
}
instance ToResource Container where
toResource :: Container -> Resource
toResource Container {Maybe Int
Maybe Text
containerName :: Container -> Maybe Text
containerRestartCount :: Container -> Maybe Int
containerName :: Maybe Text
containerRestartCount :: 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.k8s_container_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
containerName
, AttributeKey Int64 -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Int64
SC.k8s_container_restartCount Text -> Maybe Int -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Int
containerRestartCount
]
data ReplicaSet = ReplicaSet
{ ReplicaSet -> Maybe Text
replicaSetUid :: Maybe Text
, ReplicaSet -> Maybe Text
replicaSetName :: Maybe Text
}
instance ToResource ReplicaSet where
toResource :: ReplicaSet -> Resource
toResource ReplicaSet {Maybe Text
replicaSetUid :: ReplicaSet -> Maybe Text
replicaSetName :: ReplicaSet -> Maybe Text
replicaSetUid :: Maybe Text
replicaSetName :: 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.k8s_replicaset_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
replicaSetName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_replicaset_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
replicaSetUid
]
data Deployment = Deployment
{ Deployment -> Maybe Text
deploymentUid :: Maybe Text
, Deployment -> Maybe Text
deploymentName :: Maybe Text
}
instance ToResource Deployment where
toResource :: Deployment -> Resource
toResource Deployment {Maybe Text
deploymentUid :: Deployment -> Maybe Text
deploymentName :: Deployment -> Maybe Text
deploymentUid :: Maybe Text
deploymentName :: 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.k8s_deployment_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
deploymentName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_deployment_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
deploymentUid
]
data StatefulSet = StatefulSet
{ StatefulSet -> Maybe Text
statefulSetUid :: Maybe Text
, StatefulSet -> Maybe Text
statefulSetName :: Maybe Text
}
instance ToResource StatefulSet where
toResource :: StatefulSet -> Resource
toResource StatefulSet {Maybe Text
statefulSetUid :: StatefulSet -> Maybe Text
statefulSetName :: StatefulSet -> Maybe Text
statefulSetUid :: Maybe Text
statefulSetName :: 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.k8s_statefulset_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
statefulSetName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_statefulset_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
statefulSetUid
]
data DaemonSet = DaemonSet
{ DaemonSet -> Maybe Text
daemonSetUid :: Maybe Text
, DaemonSet -> Maybe Text
daemonSetName :: Maybe Text
}
instance ToResource DaemonSet where
toResource :: DaemonSet -> Resource
toResource DaemonSet {Maybe Text
daemonSetUid :: DaemonSet -> Maybe Text
daemonSetName :: DaemonSet -> Maybe Text
daemonSetUid :: Maybe Text
daemonSetName :: 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.k8s_daemonset_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
daemonSetName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_daemonset_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
daemonSetUid
]
data Job = Job
{ Job -> Maybe Text
jobUid :: Maybe Text
, Job -> Maybe Text
jobName :: Maybe Text
}
instance ToResource Job where
toResource :: Job -> Resource
toResource Job {Maybe Text
jobUid :: Job -> Maybe Text
jobName :: Job -> Maybe Text
jobUid :: Maybe Text
jobName :: 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.k8s_job_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
jobName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_job_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
jobUid
]
data CronJob = CronJob
{ CronJob -> Maybe Text
cronJobUid :: Maybe Text
, CronJob -> Maybe Text
cronJobName :: Maybe Text
}
instance ToResource CronJob where
toResource :: CronJob -> Resource
toResource CronJob {Maybe Text
cronJobUid :: CronJob -> Maybe Text
cronJobName :: CronJob -> Maybe Text
cronJobUid :: Maybe Text
cronJobName :: 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.k8s_cronjob_name Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
cronJobName
, AttributeKey Text -> Text
forall a. AttributeKey a -> Text
unkey AttributeKey Text
SC.k8s_cronjob_uid Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
cronJobUid
]