Documentation
¶
Index ¶
- Constants
- Variables
- type EdgeInfo
- type EntityInfo
- type K8SDeploymentObject
- type K8SPodObject
- type K8SStatefulSetObject
- type RelationshipMap
- type ResourceEntity
- type ResourceEntityCache
- func (ec *ResourceEntityCache) GetAllEntities() []byte
- func (ec *ResourceEntityCache) ProvisionDeployment(deployment *K8SDeploymentObject)
- func (ec *ResourceEntityCache) ProvisionPod(podObject *K8SPodObject)
- func (ec *ResourceEntityCache) ProvisionRecordAttributes(resourceEntityMap map[string]*ResourceEntity, recordAttributes pcommon.Map)
- func (ec *ResourceEntityCache) ProvisionResourceAttributes(attributes pcommon.Map) map[string]*ResourceEntity
- func (ec *ResourceEntityCache) ProvisionStatefulSet(statefulSet *K8SStatefulSetObject)
- func (ec *ResourceEntityCache) PutEntity(attributeName, entityName, entityType string, attributes map[string]string) (*ResourceEntity, bool)
- func (ec *ResourceEntityCache) PutEntityObject(entity *ResourceEntity)
Constants ¶
View Source
const ( BelongsToAccount = "belongs to account" BelongsToCluster = "belongs to cluster" BelongsToNamespace = "belongs to namespace" BelongsToProvider = "belongs to provider" BelongsToRegion = "belongs to region" BelongsToZone = "belongs to zone" ConsumesFrom = "consumes from" ContainsAvailabilityZone = "contains availability zone" ContainsNamespace = "contains namespace" ContainsPod = "contains pod" ContainsRegion = "contains region" ContainsService = "contains service" ContainsTask = "contains task" DBQuerySummary = "db.query.summary" DBStatement = "db.statement" HasCollection = "has a collection" HasInstance = "has instance" HasNamespace = "has a namespace" HasNode = "has a node" HasResourcesInRegion = "has resources in region" HostedOnNode = "hosted on node" HostsCluster = "hosts cluster" HostsPod = "hosts pod" HostsService = "hosts service" IsACronJobFor = "is a cronjob for" IsAJobFor = "is a job for" IsAPodFor = "is a pod for" IsAPodForService = "is a pod for service" IsAssociatedWith = "is associated with" IsAssociatedWithCluster = "is associated with cluster" IsAssociatedWithNode = "is associated with node" IsAssociatedWithTask = "is associated with task" IsCollectionHostedOn = "is a collection hosted on" IsDaemonSetFor = "is daemonset for" IsDatabaseHostedOn = "is a database hosted on" IsDeployedOnContainer = "is deployed on container" IsDeployedOnNode = "is deployed on node" IsDeployedOnPod = "is deployed on pod" IsInstanceOfFunction = "is instance of function" IsManagedByCronJob = "is managed by cronjob" IsManagedByDaemonSet = "is managed by daemonset" IsManagedByDeployment = "is managed by deployment" IsManagedByJob = "is managed by job" IsManagedByReplicaSet = "is managed by replicaset" IsManagedByStatefulSet = "is managed by statefulset" IsPartOfCluster = "is part of cluster" IsPartOfNamespace = "is part of namespace" IsPartOfDatabase = "is part of database" IsRunningOnNode = "is running on node" IsSpawnedByService = "is spawned by service" IsStatefulSetFor = "is statefulset for" IsUsedByContainer = "is used by container" IsUsedByService = "is used by service" IsConsumedFromByService = "is consumed from by service" ManagesAccount = "manages account" ManagesReplicaset = "manages replicaset" NetPeerName = "net.peer.name" ProducesTo = "produces to" RunsInPod = "runs in pod" RunsOnOperatingSystem = "runs on operating system" UsesDatabase = "uses database" UsesDatabaseCollection = "uses database collection" UsesImage = "uses image" UsesMessagingDestination = "uses messaging destination" )
View Source
const ( AwsEcsCluster = "aws.ecs.cluster" AwsEcsContainer = "aws.ecs.container" AwsEcsTask = "aws.ecs.task" AwsEksCluster = "aws.eks.cluster" CloudAccount = "cloud.account" CloudAvailabilityZone = "cloud.availability_zone" CloudProvider = "cloud.provider" CloudRegion = "cloud.region" CloudResourceId = "cloud.resource_id" Container = "container" ContainerImage = "container.image" FaasFunction = "faas.function" FaasInstance = "faas.instance" Host = "host" KubernetesCluster = "k8s.cluster" KubernetesContainer = "k8s.container" KubernetesCronJob = "k8s.cronjob" KubernetesDaemonSet = "k8s.daemonset" KubernetesDeployment = "k8s.deployment" KubernetesJob = "k8s.job" KubernetesNamespace = "k8s.namespace" KubernetesPod = "k8s.pod" KubernetesReplicaSet = "k8s.replicaset" KubernetesStatefulSet = "k8s.statefulset" Node = "k8s.node" Os = "os" Process = "process" Service = "service" Database = "database" DatabaseCollection = "database.collection" MessagingDestination = "messaging.destination" MessagingConsumerGroup = "messaging.consumer.group" K8SPodIp = "k8s.pod.ip" HostIp = "host.ip" PodPhase = "pod.phase" PendingReason = "pending.reason" )
Variables ¶
View Source
var EntityRelationships = RelationshipMap{ string(semconv.K8SClusterNameKey): { Type: KubernetesCluster, Relationships: map[string]string{ string(semconv.K8SNodeNameKey): HasNode, }, AttributeNames: []string{ string(semconv.K8SClusterUIDKey), }, }, string(semconv.K8SNodeNameKey): { Type: Node, Relationships: map[string]string{ string(semconv.K8SNamespaceNameKey): ContainsNamespace, string(semconv.K8SClusterNameKey): BelongsToCluster, string(semconv.OSNameKey): RunsOnOperatingSystem, }, AttributeNames: []string{ string(semconv.K8SNodeUIDKey), }, }, string(semconv.K8SNamespaceNameKey): { Type: KubernetesNamespace, Relationships: map[string]string{ string(semconv.ServiceNameKey): ContainsService, string(semconv.K8SNodeNameKey): HostedOnNode, }, AttributeNames: []string{ string(semconv.K8SNodeNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.ServiceNameKey): { Type: Service, Relationships: map[string]string{ string(semconv.K8SDaemonSetNameKey): IsManagedByDaemonSet, string(semconv.K8SDeploymentNameKey): IsManagedByDeployment, string(semconv.K8SStatefulSetNameKey): IsManagedByStatefulSet, string(semconv.K8SCronJobNameKey): IsManagedByCronJob, string(semconv.K8SJobNameKey): IsManagedByJob, string(semconv.K8SNamespaceNameKey): BelongsToNamespace, string(semconv.DBNamespaceKey): UsesDatabase, string(semconv.DBCollectionNameKey): UsesDatabaseCollection, string(semconv.MessagingConsumerGroupNameKey): ConsumesFrom, }, AttributeNames: []string{ string(semconv.ServiceInstanceIDKey), string(semconv.ServiceVersionKey), string(semconv.ServiceNamespaceKey), string(semconv.TelemetrySDKNameKey), string(semconv.TelemetrySDKLanguageKey), string(semconv.TelemetrySDKVersionKey), }, AttributePrefixes: []string{}, DeriveRelationshipCallbacks: map[string]func(m pcommon.Map) string{ string(semconv.MessagingDestinationNameKey): func(m pcommon.Map) string { _, mcgVFound := m.Get(string(semconv.MessagingConsumerGroupNameKey)) if mcgVFound { return ConsumesFrom } monV, monVFound := m.Get(string(semconv.MessagingOperationNameKey)) if monVFound { operation := monV.AsString() if operation == "publish" { return ProducesTo } if operation == "process" { return ConsumesFrom } } return UsesMessagingDestination }, }, }, string(semconv.K8SDaemonSetNameKey): { Type: KubernetesDaemonSet, Relationships: map[string]string{ string(semconv.K8SPodNameKey): ContainsPod, string(semconv.ServiceNameKey): IsDaemonSetFor, }, AttributeNames: []string{string(semconv.K8SStatefulSetUIDKey)}, AttributePrefixes: []string{}, }, string(semconv.K8SDeploymentNameKey): { Type: KubernetesDeployment, Relationships: map[string]string{ string(semconv.K8SReplicaSetNameKey): ManagesReplicaset, string(semconv.ServiceNameKey): IsManagedByDeployment, }, AttributeNames: []string{ string(semconv.K8SDeploymentUIDKey), string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.K8SReplicaSetNameKey): { Type: KubernetesReplicaSet, Relationships: map[string]string{ string(semconv.K8SPodNameKey): ContainsPod, string(semconv.K8SDeploymentNameKey): IsManagedByDeployment, }, AttributeNames: []string{ string(semconv.K8SReplicaSetUIDKey), string(semconv.K8SDeploymentNameKey), string(semconv.K8SNamespaceNameKey), string(semconv.ServiceNameKey), string(semconv.K8SNodeNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.K8SStatefulSetNameKey): { Type: KubernetesStatefulSet, Relationships: map[string]string{ string(semconv.K8SPodNameKey): ContainsPod, string(semconv.ServiceNameKey): IsStatefulSetFor, }, AttributeNames: []string{ string(semconv.K8SStatefulSetUIDKey), string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.K8SJobNameKey): { Type: KubernetesJob, Relationships: map[string]string{ string(semconv.K8SPodNameKey): ContainsPod, string(semconv.ServiceNameKey): IsAJobFor, }, AttributeNames: []string{ string(semconv.K8SJobUIDKey), string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.K8SCronJobNameKey): { Type: KubernetesCronJob, Relationships: map[string]string{ string(semconv.K8SPodNameKey): ContainsPod, string(semconv.ServiceNameKey): IsACronJobFor, }, AttributeNames: []string{ string(semconv.K8SCronJobUIDKey), string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.K8SPodNameKey): { Type: KubernetesPod, Relationships: map[string]string{ string(semconv.K8SContainerNameKey): RunsInPod, string(semconv.K8SCronJobNameKey): IsAPodFor, string(semconv.K8SDaemonSetNameKey): IsAPodFor, string(semconv.K8SJobNameKey): IsAPodFor, string(semconv.K8SStatefulSetNameKey): IsAPodFor, string(semconv.K8SReplicaSetNameKey): IsAPodFor, }, AttributeNames: []string{ K8SPodIp, string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), string(semconv.K8SPodUIDKey), }, AttributePrefixes: []string{"k8s.pod.label.", "k8s.pod.annotation."}, }, string(semconv.K8SContainerNameKey): { Type: KubernetesContainer, Relationships: map[string]string{ string(semconv.K8SPodNameKey): RunsInPod, string(semconv.K8SNamespaceNameKey): IsPartOfNamespace, string(semconv.K8SNodeNameKey): IsDeployedOnNode, }, AttributeNames: []string{ string(semconv.K8SContainerRestartCountKey), string(semconv.K8SContainerStatusLastTerminatedReasonKey), string(semconv.K8SNamespaceNameKey), string(semconv.K8SNodeNameKey), string(semconv.ServiceNameKey), string(semconv.K8SClusterNameKey), }, AttributePrefixes: []string{}, }, string(semconv.ContainerNameKey): { Type: Container, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsDeployedOnContainer, string(semconv.ContainerImageNameKey): UsesImage, }, AttributeNames: []string{ string(semconv.ContainerIDKey), string(semconv.ContainerCommandKey), string(semconv.ContainerCommandArgsKey), string(semconv.ContainerRuntimeKey), string(semconv.ContainerCommandLineKey), }, AttributePrefixes: []string{"container.label"}, }, string(semconv.ContainerImageNameKey): { Type: ContainerImage, Relationships: map[string]string{ string(semconv.ContainerNameKey): IsUsedByContainer, }, AttributeNames: []string{ string(semconv.ContainerImageIDKey), string(semconv.ContainerImageTagsKey), string(semconv.ContainerImageRepoDigestsKey), }, AttributePrefixes: []string{}, }, string(semconv.OSNameKey): { Type: Os, Relationships: map[string]string{}, AttributeNames: []string{ string(semconv.OSVersionKey), string(semconv.OSDescriptionKey), string(semconv.OSBuildIDKey), }, AttributePrefixes: []string{}, }, string(semconv.ProcessCommandKey): { Type: Process, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsSpawnedByService, }, AttributeNames: []string{ string(semconv.ProcessExecutableNameKey), string(semconv.ProcessExecutablePathKey), string(semconv.ProcessCommandKey), string(semconv.ProcessCommandArgsKey), string(semconv.ProcessCommandLineKey), string(semconv.ProcessOwnerKey), string(semconv.ProcessCreationTimeKey), string(semconv.ProcessContextSwitchTypeKey), string(semconv.ProcessGroupLeaderPIDKey), string(semconv.ProcessParentPIDKey), string(semconv.ProcessPIDKey), }, AttributePrefixes: []string{}, }, string(semconv.DBNamespaceKey): { Type: Database, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsUsedByService, string(semconv.DBCollectionNameKey): HasCollection, }, AttributeNames: []string{ string(semconv.DBSystemKey), }, AttributePrefixes: []string{}, }, string(semconv.DBCollectionNameKey): { Type: DatabaseCollection, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsUsedByService, string(semconv.DBNamespaceKey): IsPartOfDatabase, }, AttributeNames: []string{ string(semconv.DBSystemKey), }, AttributePrefixes: []string{}, NameTransformer: func(s string) string { return functions.ScrubWord(s) }, }, string(semconv.MessagingDestinationNameKey): { Type: MessagingDestination, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsUsedByService, }, AttributeNames: []string{ string(semconv.MessagingSystemKey), }, AttributePrefixes: []string{}, }, string(semconv.MessagingConsumerGroupNameKey): { Type: MessagingConsumerGroup, Relationships: map[string]string{ string(semconv.ServiceNameKey): IsConsumedFromByService, }, AttributeNames: []string{ string(semconv.MessagingSystemKey), string(semconv.MessagingDestinationNameKey), }, AttributePrefixes: []string{}, }, string(semconv.AWSECSContainerARNKey): { Type: AwsEcsContainer, Relationships: map[string]string{ string(semconv.AWSECSClusterARNKey): IsPartOfCluster, string(semconv.AWSECSTaskARNKey): IsAssociatedWithTask, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.AWSECSTaskARNKey): { Type: AwsEcsTask, Relationships: map[string]string{ string(semconv.AWSECSClusterARNKey): IsPartOfCluster, }, AttributeNames: []string{ string(semconv.AWSECSTaskFamilyKey), string(semconv.AWSECSTaskRevisionKey), string(semconv.AWSECSTaskIDKey), }, AttributePrefixes: []string{}, }, string(semconv.AWSECSClusterARNKey): { Type: AwsEcsCluster, Relationships: map[string]string{ string(semconv.AWSECSTaskIDKey): ContainsTask, }, AttributeNames: []string{ string(semconv.AWSECSLaunchtypeKey), }, AttributePrefixes: []string{}, }, string(semconv.AWSEKSClusterARNKey): { Type: AwsEksCluster, Relationships: map[string]string{ string(semconv.K8SClusterNameKey): IsAssociatedWithCluster, string(semconv.K8SNodeNameKey): IsAssociatedWithNode, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.FaaSInstanceKey): { Type: FaasInstance, Relationships: map[string]string{ string(semconv.FaaSNameKey): IsInstanceOfFunction, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.FaaSNameKey): { Type: FaasFunction, Relationships: map[string]string{ string(semconv.FaaSInstanceKey): HasInstance, }, AttributeNames: []string{ string(semconv.FaaSColdstartKey), string(semconv.FaaSCronKey), string(semconv.FaaSDocumentCollectionKey), string(semconv.FaaSDocumentOperationKey), string(semconv.FaaSDocumentNameKey), string(semconv.FaaSDocumentTimeKey), string(semconv.FaaSInvokedRegionKey), string(semconv.FaaSMaxMemoryKey), string(semconv.FaaSInvokedNameKey), }, AttributePrefixes: []string{}, }, string(semconv.CloudProviderKey): { Type: CloudProvider, Relationships: map[string]string{ string(semconv.CloudAccountIDKey): ManagesAccount, string(semconv.CloudRegionKey): ContainsRegion, string(semconv.CloudAvailabilityZoneKey): ContainsAvailabilityZone, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.CloudAccountIDKey): { Type: CloudAccount, Relationships: map[string]string{ string(semconv.CloudProviderKey): BelongsToProvider, string(semconv.CloudRegionKey): HasResourcesInRegion, string(semconv.CloudAvailabilityZoneKey): ContainsAvailabilityZone, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.CloudRegionKey): { Type: CloudRegion, Relationships: map[string]string{ string(semconv.CloudProviderKey): BelongsToProvider, string(semconv.CloudAvailabilityZoneKey): ContainsAvailabilityZone, string(semconv.CloudAccountIDKey): BelongsToAccount, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.CloudAvailabilityZoneKey): { Type: CloudAvailabilityZone, Relationships: map[string]string{ string(semconv.CloudRegionKey): BelongsToRegion, string(semconv.CloudAccountIDKey): BelongsToAccount, string(semconv.CloudProviderKey): BelongsToProvider, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.CloudResourceIDKey): { Type: CloudResourceId, Relationships: map[string]string{ string(semconv.CloudRegionKey): BelongsToRegion, string(semconv.CloudAvailabilityZoneKey): BelongsToZone, string(semconv.CloudAccountIDKey): BelongsToAccount, string(semconv.CloudProviderKey): BelongsToProvider, }, AttributeNames: []string{}, AttributePrefixes: []string{}, }, string(semconv.HostNameKey): { Type: Host, Relationships: map[string]string{ string(semconv.ServiceNameKey): HostsService, string(semconv.K8SClusterNameKey): HostsCluster, string(semconv.K8SPodNameKey): HostsPod, string(semconv.K8SStatefulSetNameKey): HostsPod, string(semconv.K8SDaemonSetNameKey): HostsPod, }, AttributeNames: []string{ string(semconv.HostIDKey), string(semconv.HostTypeKey), string(semconv.HostImageIDKey), string(semconv.HostImageNameKey), string(semconv.HostImageVersionKey), string(semconv.HostCPUFamilyKey), string(semconv.HostCPUSteppingKey), string(semconv.HostCPUCacheL2SizeKey), string(semconv.HostCPUVendorIDKey), string(semconv.HostArchKey), string(semconv.HostIPKey), }, AttributePrefixes: []string{}, }, }
View Source
var RestrictedNamespaces = map[string]bool{ "datadog-agent": true, }
View Source
var RestrictedServices = map[string]bool{ "kubernetes-nodes": true, "kubernetes-nodes-cadvisor": true, }
Functions ¶
This section is empty.
Types ¶
type EntityInfo ¶
type K8SDeploymentObject ¶ added in v0.14.2
type K8SDeploymentObject struct { Name string Namespace string ReplicasAvailable int ReplicasDesired int ReplicasUpdated int DeploymentStatus string ProgressMessage string }
func ExtractDeploymentObject ¶ added in v0.14.3
func ExtractDeploymentObject(lr plog.LogRecord) *K8SDeploymentObject
type K8SPodObject ¶ added in v0.14.2
type K8SPodObject struct { Name string `json:"name"` Labels map[string]string `json:"labels"` OwnerRefKind string `json:"ownerRefKind"` OwnerRefName string `json:"ownerRefName"` Resources map[string]string `json:"resources"` Phase string `json:"phase"` StartedAt string `json:"startedAt"` PendingReason string `json:"pendingReason"` IsImagePullBackOff bool `json:"isImagePullBackOff"` IsCrashLoopBackOff bool `json:"isCrashLoopBackOff"` IsOOMKilled bool `json:"isOOMKilled"` PodIP string `json:"podIP"` HostIP string `json:"hostIP"` ImageID string `json:"imageID"` }
func ExtractPodObject ¶ added in v0.14.3
func ExtractPodObject(lr plog.LogRecord) *K8SPodObject
type K8SStatefulSetObject ¶ added in v0.14.2
func ExtractStatefulSetObject ¶ added in v0.14.3
func ExtractStatefulSetObject(lr plog.LogRecord) *K8SStatefulSetObject
type RelationshipMap ¶
type RelationshipMap map[string]*EntityInfo
type ResourceEntity ¶
type ResourceEntity struct { AttributeName string `json:"-"` Name string `json:"name"` Type string `json:"type"` Attributes map[string]string `json:"attributes"` Edges map[string]*EdgeInfo `json:"edges"` // contains filtered or unexported fields }
func (*ResourceEntity) AddEdge ¶
func (re *ResourceEntity) AddEdge(targetName, targetType, relationship string)
func (*ResourceEntity) PutAttribute ¶ added in v0.9.0
func (re *ResourceEntity) PutAttribute(k, v string)
type ResourceEntityCache ¶
type ResourceEntityCache struct {
// contains filtered or unexported fields
}
func NewResourceEntityCache ¶
func NewResourceEntityCache() *ResourceEntityCache
func (*ResourceEntityCache) GetAllEntities ¶
func (ec *ResourceEntityCache) GetAllEntities() []byte
func (*ResourceEntityCache) ProvisionDeployment ¶ added in v0.14.2
func (ec *ResourceEntityCache) ProvisionDeployment(deployment *K8SDeploymentObject)
func (*ResourceEntityCache) ProvisionPod ¶ added in v0.14.2
func (ec *ResourceEntityCache) ProvisionPod(podObject *K8SPodObject)
func (*ResourceEntityCache) ProvisionRecordAttributes ¶ added in v0.8.6
func (ec *ResourceEntityCache) ProvisionRecordAttributes(resourceEntityMap map[string]*ResourceEntity, recordAttributes pcommon.Map)
func (*ResourceEntityCache) ProvisionResourceAttributes ¶ added in v0.8.6
func (ec *ResourceEntityCache) ProvisionResourceAttributes(attributes pcommon.Map) map[string]*ResourceEntity
func (*ResourceEntityCache) ProvisionStatefulSet ¶ added in v0.14.2
func (ec *ResourceEntityCache) ProvisionStatefulSet(statefulSet *K8SStatefulSetObject)
func (*ResourceEntityCache) PutEntity ¶
func (ec *ResourceEntityCache) PutEntity(attributeName, entityName, entityType string, attributes map[string]string) (*ResourceEntity, bool)
func (*ResourceEntityCache) PutEntityObject ¶ added in v0.8.5
func (ec *ResourceEntityCache) PutEntityObject(entity *ResourceEntity)
Click to show internal directories.
Click to hide internal directories.