graph

package
v0.12.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

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"
	IsRunningOnNode          = "is running on node"
	IsSpawnedByService       = "is spawned by service"
	IsStatefulSetFor         = "is statefulset for"
	IsUsedByContainer        = "is used by container"
	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"
	UsesImage                = "uses image"
)
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"
)

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.DBSystemKey):                   UsesDatabase,
			string(semconv.MessagingConsumerGroupNameKey): ConsumesFrom,
			string(semconv.MessagingDestinationNameKey):   ProducesTo,
		},
		AttributeNames: []string{
			string(semconv.ServiceInstanceIDKey),
			string(semconv.ServiceVersionKey),
			string(semconv.ServiceNamespaceKey),
			string(semconv.TelemetrySDKNameKey),
			string(semconv.TelemetrySDKLanguageKey),
			string(semconv.TelemetrySDKVersionKey),
		},
		AttributePrefixes: []string{},
	},

	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{
			"k8s.pod.ip",
			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.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 EdgeInfo added in v0.11.2

type EdgeInfo struct {
	Relationship string
	LastSeen     int64
}

type EntityInfo

type EntityInfo struct {
	Type              string
	Relationships     map[string]string
	AttributeNames    []string
	AttributePrefixes []string
}

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) 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) PutEntity

func (ec *ResourceEntityCache) PutEntity(attributeName, entityName, entityType string, attributes map[string]string) *ResourceEntity

func (*ResourceEntityCache) PutEntityObject added in v0.8.5

func (ec *ResourceEntityCache) PutEntityObject(entity *ResourceEntity)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL