Help us shape the future of Go! Take the 2026 Go Developer Survey

entitystore

package
v1.300073.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Service              = "Service"
	InstanceIDKey        = "EC2.InstanceId"
	ASGKey               = "EC2.AutoScalingGroup"
	ServiceNameSourceKey = "AWS.ServiceNameSource"
	PlatformType         = "PlatformType"
	EC2PlatForm          = "AWS::EC2"
)
View Source
const (
	SERVICE     = "service"
	APPLICATION = "application"
	APP         = "app"

	// Matches the default value from OTel
	// https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_service_name
	ServiceNameUnknown = "unknown_service"

	ServiceNameSourceClientIamRole     = "ClientIamRole"
	ServiceNameSourceInstrumentation   = "Instrumentation"
	ServiceNameSourceResourceTags      = "ResourceTags"
	ServiceNameSourceUnknown           = "Unknown"
	ServiceNameSourceUserConfiguration = "UserConfiguration"
	ServiceNameSourceK8sWorkload       = "K8sWorkload"
)
View Source
const (
	RequestLimitExceeded = "RequestLimitExceeded"
)

Variables

View Source
var (
	TypeStr, _ = component.NewType("entitystore")
)

Functions

func NewFactory

func NewFactory() extension.Factory

Types

type Config

type Config struct {
	Mode           string `mapstructure:"mode"`
	KubernetesMode string `mapstructure:"kubernetes_mode,omitempty"`
	Region         string `mapstructure:"region"`
	Profile        string `mapstructure:"profile,omitempty"`
	RoleARN        string `mapstructure:"role_arn,omitempty"`
	Filename       string `mapstructure:"shared_credential_file,omitempty"`
}

type EC2Info added in v1.300049.0

type EC2Info struct {
	InstanceID       string
	AccountID        string
	InstanceType     string
	ImageID          string
	AvailabilityZone string
	Hostname         string

	// region is used while making call to describeTags Ec2 API for AutoScalingGroup
	Region string
	// contains filtered or unexported fields
}

func (*EC2Info) GetAccountID added in v1.300049.0

func (ei *EC2Info) GetAccountID() string

func (*EC2Info) GetAvailabilityZone added in v1.300067.0

func (ei *EC2Info) GetAvailabilityZone() string

func (*EC2Info) GetHostname added in v1.300067.0

func (ei *EC2Info) GetHostname() string

func (*EC2Info) GetImageID added in v1.300067.0

func (ei *EC2Info) GetImageID() string

func (*EC2Info) GetInstanceID added in v1.300049.0

func (ei *EC2Info) GetInstanceID() string

func (*EC2Info) GetInstanceType added in v1.300067.0

func (ei *EC2Info) GetInstanceType() string

type EntityStore

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

func GetEntityStore

func GetEntityStore() *EntityStore

func (*EntityStore) AddPodServiceEnvironmentMapping added in v1.300049.0

func (e *EntityStore) AddPodServiceEnvironmentMapping(podName string, serviceName string, environmentName string, serviceNameSource string)

func (*EntityStore) AddServiceAttrEntryForLogFile

func (e *EntityStore) AddServiceAttrEntryForLogFile(fileGlob LogFileGlob, serviceName string, environmentName string)

AddServiceAttrEntryForLogFile adds an entry to the entity store for the provided file glob -> (serviceName, environmentName) key-value pair

func (*EntityStore) AddServiceAttrEntryForLogGroup

func (e *EntityStore) AddServiceAttrEntryForLogGroup(logGroupName LogGroupName, serviceName string, environmentName string)

AddServiceAttrEntryForLogGroup adds an entry to the entity store for the provided log group nme -> (serviceName, environmentName) key-value pair

func (*EntityStore) CreateLogFileEntity

func (e *EntityStore) CreateLogFileEntity(logFileGlob LogFileGlob, logGroupName LogGroupName) *cloudwatchlogs.Entity

CreateLogFileEntity creates the entity for log events that are being uploaded from a log file in the environment.

func (*EntityStore) EC2Info

func (e *EntityStore) EC2Info() EC2Info

func (*EntityStore) EKSInfo

func (e *EntityStore) EKSInfo() *eksInfo

func (*EntityStore) GetAutoScalingGroup added in v1.300052.0

func (e *EntityStore) GetAutoScalingGroup() string

func (*EntityStore) GetMetricServiceNameAndSource added in v1.300049.0

func (e *EntityStore) GetMetricServiceNameAndSource() (string, string)

GetMetricServiceNameAndSource gets the service name source for service metrics if not customer provided

func (*EntityStore) GetPodServiceEnvironmentMapping added in v1.300049.0

func (e *EntityStore) GetPodServiceEnvironmentMapping() *ttlcache.Cache[string, ServiceEnvironment]

func (*EntityStore) GetServiceMetricAttributesMap added in v1.300049.0

func (e *EntityStore) GetServiceMetricAttributesMap() map[string]*string

GetServiceMetricAttributesMap creates the attribute map for service metrics. This will be expanded upon in a later PR'S, but for now is just covering the EC2 attributes for service metrics.

func (*EntityStore) KubernetesMode added in v1.300049.0

func (e *EntityStore) KubernetesMode() string

func (*EntityStore) Mode

func (e *EntityStore) Mode() string

func (*EntityStore) NativeCredentialExists

func (e *EntityStore) NativeCredentialExists() bool

func (*EntityStore) SetAutoScalingGroup added in v1.300052.0

func (e *EntityStore) SetAutoScalingGroup(asg string)

func (*EntityStore) SetNativeCredential

func (e *EntityStore) SetNativeCredential(client client.ConfigProvider)

func (*EntityStore) Shutdown

func (e *EntityStore) Shutdown(_ context.Context) error

func (*EntityStore) Start

func (e *EntityStore) Start(ctx context.Context, host component.Host) error

func (*EntityStore) StartPodToServiceEnvironmentMappingTtlCache added in v1.300049.0

func (e *EntityStore) StartPodToServiceEnvironmentMappingTtlCache()

type LeaseWriter added in v1.300067.0

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

LeaseWriter creates and renews a Kubernetes Lease containing IMDS-resolved node metadata as annotations. The cluster-scraper's NodeMetadataCache watches these Leases to enrich KSM metrics with correct per-node host attributes.

func NewLeaseWriter added in v1.300067.0

func NewLeaseWriter(ec2Info *EC2Info, nodeName, namespace string, client coordinationv1client.LeasesGetter, logger *zap.Logger) *LeaseWriter

NewLeaseWriter creates a new LeaseWriter. The nodeName should come from the K8S_NODE_NAME env var (Kubernetes downward API), not from IMDS hostname.

func (*LeaseWriter) Start added in v1.300067.0

func (lw *LeaseWriter) Start()

Start begins the Lease lifecycle in a goroutine: jitter → wait for EC2Info → create → renew loop.

func (*LeaseWriter) Stop added in v1.300067.0

func (lw *LeaseWriter) Stop()

Stop stops the renewal goroutine, waits for it to exit, then performs a best-effort delete of the Lease. Safe to call multiple times.

type LogFileGlob

type LogFileGlob string

type LogGroupName

type LogGroupName string

type Retryer added in v1.300049.0

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

func NewRetryer added in v1.300049.0

func NewRetryer(onetime bool, retryAnyError bool, successRetryMin int, successRetryMax int, backoffArray []time.Duration, maxRetry int, done chan struct{}, logger *zap.Logger) *Retryer

type ServiceAttribute

type ServiceAttribute struct {
	ServiceName       string
	ServiceNameSource string
	Environment       string
}

type ServiceEnvironment added in v1.300049.0

type ServiceEnvironment struct {
	ServiceName       string
	Environment       string
	ServiceNameSource string
}

Jump to

Keyboard shortcuts

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