clusteragent

package
v0.0.0-...-2feb83d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Overview

Package clusteragent provides clients for the APIs exposed by the Cluster Agent and the Cluster Check Runners.

Index

Constants

View Source
const (

	// RealIPHeader refers to the cluster level check runner ip passed in the request headers
	RealIPHeader = "X-Real-Ip"
)

Variables

This section is empty.

Functions

func GetClusterAgentEndpoint

func GetClusterAgentEndpoint() (string, error)

GetClusterAgentEndpoint provides a validated https endpoint from configuration keys in datadog.yaml: 1st. configuration key "cluster_agent.url" (or the DD_CLUSTER_AGENT_URL environment variable),

add the https prefix if the scheme isn't specified

2nd. environment variables associated with "cluster_agent.kubernetes_service_name"

${dcaServiceName}_SERVICE_HOST and ${dcaServiceName}_SERVICE_PORT

Types

type CLCRunnerClient

type CLCRunnerClient struct {
	sync.Once
	// contains filtered or unexported fields
}

CLCRunnerClient is required to query the API of Datadog Cluster Level Check Runner

func (*CLCRunnerClient) GetRunnerStats

func (c *CLCRunnerClient) GetRunnerStats(IP string) (types.CLCRunnersStats, error)

GetRunnerStats fetches the runner stats exposed by the Cluster Level Check Runner

func (*CLCRunnerClient) GetRunnerWorkers

func (c *CLCRunnerClient) GetRunnerWorkers(IP string) (types.Workers, error)

GetRunnerWorkers fetches the runner workers information exposed by the Cluster Level Check Runner

func (*CLCRunnerClient) GetVersion

func (c *CLCRunnerClient) GetVersion(IP string) (version.Version, error)

GetVersion fetches the version of the CLC Runner

type CLCRunnerClientInterface

type CLCRunnerClientInterface interface {
	GetVersion(IP string) (version.Version, error)
	GetRunnerStats(IP string) (types.CLCRunnersStats, error)
	GetRunnerWorkers(IP string) (types.Workers, error)
}

CLCRunnerClientInterface is required to query the API of Datadog Cluster Level Check Runner

func GetCLCRunnerClient

func GetCLCRunnerClient() (CLCRunnerClientInterface, error)

GetCLCRunnerClient returns or init the CLCRunnerClient

type DCAClient

type DCAClient struct {
	// contains filtered or unexported fields
}

DCAClient is required to query the API of Datadog cluster agent

func (*DCAClient) ClusterAgentAPIEndpoint

func (c *DCAClient) ClusterAgentAPIEndpoint() string

ClusterAgentAPIEndpoint returns the Agent API Endpoint URL as a string

func (*DCAClient) GetCFAppsMetadataForNode

func (c *DCAClient) GetCFAppsMetadataForNode(nodename string) (map[string][]string, error)

GetCFAppsMetadataForNode returns the CF application tags from the Cluster Agent.

func (*DCAClient) GetClusterCheckConfigs

func (c *DCAClient) GetClusterCheckConfigs(ctx context.Context, identifier string) (types.ConfigResponse, error)

GetClusterCheckConfigs is called by the clustercheck config provider

func (*DCAClient) GetEndpointsCheckConfigs

func (c *DCAClient) GetEndpointsCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)

GetEndpointsCheckConfigs is called by the endpointscheck config provider

func (*DCAClient) GetKubernetesClusterID added in v0.9.0

func (c *DCAClient) GetKubernetesClusterID() (string, error)

GetKubernetesClusterID queries the datadog cluster agent to get the Kubernetes cluster ID Prefer calling clustername.GetClusterID which has a cached response

func (*DCAClient) GetKubernetesMetadataNames

func (c *DCAClient) GetKubernetesMetadataNames(nodeName, ns, podName string) ([]string, error)

GetKubernetesMetadataNames queries the datadog cluster agent to get nodeName/podName registered Kubernetes metadata.

func (*DCAClient) GetNamespaceLabels added in v0.9.0

func (c *DCAClient) GetNamespaceLabels(nsName string) (map[string]string, error)

GetNamespaceLabels returns the namespace labels from the Cluster Agent.

func (*DCAClient) GetNodeAnnotations

func (c *DCAClient) GetNodeAnnotations(nodeName string) (map[string]string, error)

GetNodeAnnotations returns the node annotations from the Cluster Agent.

func (*DCAClient) GetNodeLabels

func (c *DCAClient) GetNodeLabels(nodeName string) (map[string]string, error)

GetNodeLabels returns the node labels from the Cluster Agent.

func (*DCAClient) GetPodsMetadataForNode

func (c *DCAClient) GetPodsMetadataForNode(nodeName string) (apiv1.NamespacesPodsStringsSet, error)

GetPodsMetadataForNode queries the datadog cluster agent to get nodeName registered Kubernetes pods metadata.

func (*DCAClient) GetVersion

func (c *DCAClient) GetVersion() (version.Version, error)

GetVersion fetches the version of the Cluster Agent. Used in the agent status command.

func (*DCAClient) PostClusterCheckStatus

func (c *DCAClient) PostClusterCheckStatus(ctx context.Context, identifier string, status types.NodeStatus) (types.StatusResponse, error)

PostClusterCheckStatus is called by the clustercheck config provider

func (*DCAClient) PostLanguageMetadata

func (c *DCAClient) PostLanguageMetadata(ctx context.Context, data *pbgo.ParentLanguageAnnotationRequest) error

PostLanguageMetadata is called by the core-agent's language detection client

func (*DCAClient) Version

func (c *DCAClient) Version() version.Version

Version returns ClusterAgentVersion already stored in the DCAClient

type DCAClientInterface

type DCAClientInterface interface {
	Version() version.Version
	ClusterAgentAPIEndpoint() string

	GetVersion() (version.Version, error)
	GetNodeLabels(nodeName string) (map[string]string, error)
	GetNodeAnnotations(nodeName string) (map[string]string, error)
	GetNamespaceLabels(nsName string) (map[string]string, error)
	GetPodsMetadataForNode(nodeName string) (apiv1.NamespacesPodsStringsSet, error)
	GetKubernetesMetadataNames(nodeName, ns, podName string) ([]string, error)
	GetCFAppsMetadataForNode(nodename string) (map[string][]string, error)

	PostClusterCheckStatus(ctx context.Context, nodeName string, status types.NodeStatus) (types.StatusResponse, error)
	GetClusterCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)
	GetEndpointsCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)
	GetKubernetesClusterID() (string, error)

	PostLanguageMetadata(ctx context.Context, data *pbgo.ParentLanguageAnnotationRequest) error
}

DCAClientInterface is required to query the API of Datadog cluster agent

func GetClusterAgentClient

func GetClusterAgentClient() (DCAClientInterface, error)

GetClusterAgentClient returns or init the DCAClient

Jump to

Keyboard shortcuts

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