{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module OpenTelemetry.Resource.Kubernetes where
import Data.Text (Text)
import OpenTelemetry.Resource
newtype Cluster = Cluster
{ Cluster -> Maybe Text
clusterName :: Maybe Text
}
instance ToResource Cluster where
type ResourceSchema Cluster = 'Nothing
toResource :: Cluster -> Resource (ResourceSchema Cluster)
toResource Cluster {Maybe Text
clusterName :: Cluster -> Maybe Text
clusterName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[Text
"k8s.cluster.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
clusterName]
data Node = Node
{ Node -> Maybe Text
nodeName :: Maybe Text
, Node -> Maybe Text
nodeUid :: Maybe Text
}
instance ToResource Node where
type ResourceSchema Node = 'Nothing
toResource :: Node -> Resource (ResourceSchema Node)
toResource Node {Maybe Text
nodeName :: Node -> Maybe Text
nodeUid :: Node -> Maybe Text
nodeName :: Maybe Text
nodeUid :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.node.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
nodeName
, Text
"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
}
instance ToResource Namespace where
type ResourceSchema Namespace = 'Nothing
toResource :: Namespace -> Resource (ResourceSchema Namespace)
toResource Namespace {Maybe Text
namespaceName :: Namespace -> Maybe Text
namespaceName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"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
}
instance ToResource Pod where
type ResourceSchema Pod = 'Nothing
toResource :: Pod -> Resource (ResourceSchema Pod)
toResource Pod {Maybe Text
podName :: Pod -> Maybe Text
podUid :: Pod -> Maybe Text
podName :: Maybe Text
podUid :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.pod.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
podName
, Text
"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
type ResourceSchema Container = 'Nothing
toResource :: Container -> Resource (ResourceSchema Container)
toResource Container {Maybe Int
Maybe Text
containerName :: Container -> Maybe Text
containerRestartCount :: Container -> Maybe Int
containerName :: Maybe Text
containerRestartCount :: Maybe Int
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.container.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
containerName
, Text
"k8s.container.restart_count" 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
type ResourceSchema ReplicaSet = 'Nothing
toResource :: ReplicaSet -> Resource (ResourceSchema ReplicaSet)
toResource ReplicaSet {Maybe Text
replicaSetUid :: ReplicaSet -> Maybe Text
replicaSetName :: ReplicaSet -> Maybe Text
replicaSetUid :: Maybe Text
replicaSetName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.replicaset.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
replicaSetName
, Text
"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
type ResourceSchema Deployment = 'Nothing
toResource :: Deployment -> Resource (ResourceSchema Deployment)
toResource Deployment {Maybe Text
deploymentUid :: Deployment -> Maybe Text
deploymentName :: Deployment -> Maybe Text
deploymentUid :: Maybe Text
deploymentName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.deployment.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
deploymentName
, Text
"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
type ResourceSchema StatefulSet = 'Nothing
toResource :: StatefulSet -> Resource (ResourceSchema StatefulSet)
toResource StatefulSet {Maybe Text
statefulSetUid :: StatefulSet -> Maybe Text
statefulSetName :: StatefulSet -> Maybe Text
statefulSetUid :: Maybe Text
statefulSetName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.statefulset.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
statefulSetName
, Text
"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
type ResourceSchema DaemonSet = 'Nothing
toResource :: DaemonSet -> Resource (ResourceSchema DaemonSet)
toResource DaemonSet {Maybe Text
daemonSetUid :: DaemonSet -> Maybe Text
daemonSetName :: DaemonSet -> Maybe Text
daemonSetUid :: Maybe Text
daemonSetName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.daemonset.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
daemonSetName
, Text
"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
type ResourceSchema Job = 'Nothing
toResource :: Job -> Resource (ResourceSchema Job)
toResource Job {Maybe Text
jobUid :: Job -> Maybe Text
jobName :: Job -> Maybe Text
jobUid :: Maybe Text
jobName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.job.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
jobName
, Text
"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
type ResourceSchema CronJob = 'Nothing
toResource :: CronJob -> Resource (ResourceSchema CronJob)
toResource CronJob {Maybe Text
cronJobUid :: CronJob -> Maybe Text
cronJobName :: CronJob -> Maybe Text
cronJobUid :: Maybe Text
cronJobName :: Maybe Text
..} =
[Maybe (Text, Attribute)] -> Resource 'Nothing
forall (r :: Maybe Symbol). [Maybe (Text, Attribute)] -> Resource r
mkResource
[ Text
"k8s.cronjob.name" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
cronJobName
, Text
"k8s.cronjob.uid" Text -> Maybe Text -> Maybe (Text, Attribute)
forall a.
ToAttribute a =>
Text -> Maybe a -> Maybe (Text, Attribute)
.=? Maybe Text
cronJobUid
]