Documentation
¶
Index ¶
- Constants
- func GetMetaData(config *GCPConfig, cloudRunType CloudRunType) map[string]string
- type AppService
- func (a *AppService) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
- func (a *AppService) GetDefaultLogsSource() string
- func (a *AppService) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
- func (a *AppService) GetMetricPrefix() string
- func (a *AppService) GetOrigin() string
- func (a *AppService) GetSource() metrics.MetricSource
- func (a *AppService) GetTags() map[string]string
- func (a *AppService) GetUsageMetricSuffix() string
- func (a *AppService) Init(_ *TracingContext) error
- func (a *AppService) ShouldForceFlushAllOnForceFlushToSerializer() bool
- func (a *AppService) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, ...)
- type CloudRun
- func (c *CloudRun) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
- func (c *CloudRun) GetDefaultLogsSource() string
- func (c *CloudRun) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
- func (c *CloudRun) GetMetricPrefix() string
- func (c *CloudRun) GetOrigin() string
- func (c *CloudRun) GetSource() metrics.MetricSource
- func (c *CloudRun) GetTags() map[string]string
- func (c *CloudRun) GetUsageMetricSuffix() string
- func (c *CloudRun) Init(_ *TracingContext) error
- func (c *CloudRun) ShouldForceFlushAllOnForceFlushToSerializer() bool
- func (c *CloudRun) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, ...)
- type CloudRunJobs
- func (c *CloudRunJobs) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
- func (c *CloudRunJobs) GetDefaultLogsSource() string
- func (c *CloudRunJobs) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
- func (c *CloudRunJobs) GetMetricPrefix() string
- func (c *CloudRunJobs) GetOrigin() string
- func (c *CloudRunJobs) GetSource() metrics.MetricSource
- func (c *CloudRunJobs) GetTags() map[string]string
- func (c *CloudRunJobs) GetUsageMetricSuffix() string
- func (c *CloudRunJobs) Init(ctx *TracingContext) error
- func (c *CloudRunJobs) ShouldForceFlushAllOnForceFlushToSerializer() bool
- func (c *CloudRunJobs) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, ...)
- type CloudRunType
- type CloudService
- type ContainerApp
- func (c *ContainerApp) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
- func (c *ContainerApp) GetDefaultLogsSource() string
- func (c *ContainerApp) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
- func (c *ContainerApp) GetMetricPrefix() string
- func (c *ContainerApp) GetOrigin() string
- func (c *ContainerApp) GetSource() metrics.MetricSource
- func (c *ContainerApp) GetTags() map[string]string
- func (c *ContainerApp) GetUsageMetricSuffix() string
- func (c *ContainerApp) Init(_ *TracingContext) error
- func (c *ContainerApp) ShouldForceFlushAllOnForceFlushToSerializer() bool
- func (c *ContainerApp) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, ...)
- type EnhancedMetricTags
- type GCPConfig
- type LocalService
- func (l *LocalService) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
- func (l *LocalService) GetDefaultLogsSource() string
- func (l *LocalService) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
- func (l *LocalService) GetMetricPrefix() string
- func (l *LocalService) GetOrigin() string
- func (l *LocalService) GetSource() metrics.MetricSource
- func (l *LocalService) GetTags() map[string]string
- func (l *LocalService) GetUsageMetricSuffix() string
- func (l *LocalService) Init(_ *TracingContext) error
- func (l *LocalService) ShouldForceFlushAllOnForceFlushToSerializer() bool
- func (l *LocalService) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, ...)
- type TraceAgent
- type TracingContext
Constants ¶
const ( //nolint:revive // TODO(SERV) Fix revive linter WebsiteName = "WEBSITE_SITE_NAME" //nolint:revive // TODO(SERV) Fix revive linter RegionName = "REGION_NAME" //nolint:revive // TODO(SERV) Fix revive linter WebsiteStack = "WEBSITE_STACK" //nolint:revive // TODO(SERV) Fix revive linter AppLogsTrace = "WEBSITE_APPSERVICEAPPLOGS_TRACE_ENABLED" // AppServiceOrigin origin tag value AppServiceOrigin = "appservice" )
const ( //nolint:revive // TODO(SERV) Fix revive linter ContainerAppNameEnvVar = "CONTAINER_APP_NAME" //nolint:revive // TODO(SERV) Fix revive linter ContainerAppDNSSuffix = "CONTAINER_APP_ENV_DNS_SUFFIX" //nolint:revive // TODO(SERV) Fix revive linter ContainerAppRevision = "CONTAINER_APP_REVISION" //nolint:revive // TODO(SERV) Fix revive linter ContainerAppReplicaName = "CONTAINER_APP_REPLICA_NAME" //nolint:revive // TODO(SERV) Fix revive linter AzureSubscriptionIdEnvVar = "DD_AZURE_SUBSCRIPTION_ID" //nolint:revive // TODO(SERV) Fix revive linter AzureResourceGroupEnvVar = "DD_AZURE_RESOURCE_GROUP" // ContainerAppOrigin origin tag value ContainerAppOrigin = "containerapp" )
const CloudRunJobsOrigin = "cloudrunjobs"
CloudRunJobsOrigin origin tag value
const CloudRunOrigin = "cloudrun"
CloudRunOrigin origin tag value
const (
ServiceNameEnvVar = "K_SERVICE" // ServiceNameEnvVar is also used in the trace package
)
Variables ¶
This section is empty.
Functions ¶
func GetMetaData ¶
func GetMetaData(config *GCPConfig, cloudRunType CloudRunType) map[string]string
GetMetaData returns the container's metadata
Types ¶
type AppService ¶
type AppService struct{}
AppService has helper functions for getting specific Azure Container App data
func (*AppService) AddStartMetric ¶
func (a *AppService) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
func (*AppService) GetDefaultLogsSource ¶
func (a *AppService) GetDefaultLogsSource() string
GetDefaultLogsSource returns the default logs source if `DD_SOURCE` is not set
func (*AppService) GetEnhancedMetricTags ¶
func (a *AppService) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
func (*AppService) GetMetricPrefix ¶
func (a *AppService) GetMetricPrefix() string
func (*AppService) GetOrigin ¶
func (a *AppService) GetOrigin() string
GetOrigin returns the `origin` attribute type for the given cloud service.
func (*AppService) GetSource ¶
func (a *AppService) GetSource() metrics.MetricSource
GetSource returns the metrics source
func (*AppService) GetTags ¶
func (a *AppService) GetTags() map[string]string
GetTags returns a map of Azure-related tags
func (*AppService) GetUsageMetricSuffix ¶
func (a *AppService) GetUsageMetricSuffix() string
func (*AppService) Init ¶
func (a *AppService) Init(_ *TracingContext) error
Init is empty for AppService
func (*AppService) ShouldForceFlushAllOnForceFlushToSerializer ¶
func (a *AppService) ShouldForceFlushAllOnForceFlushToSerializer() bool
ShouldForceFlushAllOnForceFlushToSerializer is false usually.
func (*AppService) Shutdown ¶
func (a *AppService) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, _ error)
Shutdown emits the shutdown metric for AppService
type CloudRun ¶
type CloudRun struct {
// contains filtered or unexported fields
}
CloudRun has helper functions for getting Google Cloud Run data
func (*CloudRun) AddStartMetric ¶
func (c *CloudRun) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
func (*CloudRun) GetDefaultLogsSource ¶
GetDefaultLogsSource returns the default logs source if `DD_SOURCE` is not set
func (*CloudRun) GetEnhancedMetricTags ¶
func (c *CloudRun) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
func (*CloudRun) GetMetricPrefix ¶
func (*CloudRun) GetOrigin ¶
GetOrigin returns the `origin` attribute type for the given cloud service.
func (*CloudRun) GetSource ¶
func (c *CloudRun) GetSource() metrics.MetricSource
GetSource returns the metrics source
func (*CloudRun) GetUsageMetricSuffix ¶
func (*CloudRun) ShouldForceFlushAllOnForceFlushToSerializer ¶
ShouldForceFlushAllOnForceFlushToSerializer is false usually.
func (*CloudRun) Shutdown ¶
func (c *CloudRun) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, _ error)
Shutdown emits the shutdown metric for CloudRun
type CloudRunJobs ¶
type CloudRunJobs struct {
// contains filtered or unexported fields
}
CloudRunJobs has helper functions for getting Google Cloud Run data
func (*CloudRunJobs) AddStartMetric ¶
func (c *CloudRunJobs) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
func (*CloudRunJobs) GetDefaultLogsSource ¶
func (c *CloudRunJobs) GetDefaultLogsSource() string
GetDefaultLogsSource returns the default logs source if `DD_SOURCE` is not set
func (*CloudRunJobs) GetEnhancedMetricTags ¶
func (c *CloudRunJobs) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
func (*CloudRunJobs) GetMetricPrefix ¶
func (c *CloudRunJobs) GetMetricPrefix() string
func (*CloudRunJobs) GetOrigin ¶
func (c *CloudRunJobs) GetOrigin() string
GetOrigin returns the `origin` attribute type for the given cloud service.
func (*CloudRunJobs) GetSource ¶
func (c *CloudRunJobs) GetSource() metrics.MetricSource
GetSource returns the metrics source
func (*CloudRunJobs) GetTags ¶
func (c *CloudRunJobs) GetTags() map[string]string
GetTags returns a map of gcp-related tags for Cloud Run Jobs.
func (*CloudRunJobs) GetUsageMetricSuffix ¶
func (c *CloudRunJobs) GetUsageMetricSuffix() string
func (*CloudRunJobs) Init ¶
func (c *CloudRunJobs) Init(ctx *TracingContext) error
Init records the start time for CloudRunJobs and initializes the job span
func (*CloudRunJobs) ShouldForceFlushAllOnForceFlushToSerializer ¶
func (c *CloudRunJobs) ShouldForceFlushAllOnForceFlushToSerializer() bool
ShouldForceFlushAllOnForceFlushToSerializer is true for cloud run jobs.
func (*CloudRunJobs) Shutdown ¶
func (c *CloudRunJobs) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, runErr error)
Shutdown submits the task duration and shutdown metrics for CloudRunJobs, and completes and submits the job span.
type CloudRunType ¶
type CloudRunType string
CloudRunType identifies the GCP Cloud Run variant.
const ( CloudRunService CloudRunType = "service" CloudRunFunction CloudRunType = "function" CloudRunJob CloudRunType = "job" )
type CloudService ¶
type CloudService interface {
// GetTags returns a map of tags for a given cloud service. These tags are then attached to
// the logs, traces, and metrics.
GetTags() map[string]string
// GetEnhancedMetricTags returns base tags and high cardinality tags for a given cloud service.
GetEnhancedMetricTags(map[string]string) EnhancedMetricTags
// GetDefaultLogsSource returns the value that will be used for the logs source
// if `DD_SOURCE` is not set by the user.
GetDefaultLogsSource() string
// GetMetricPrefix returns the prefix that will be used for the metrics
GetMetricPrefix() string
// GetUsageMetricSuffix returns the name that will be used for the usage metric
GetUsageMetricSuffix() string
// GetOrigin returns the value that will be used for the `origin` attribute for
// all logs, traces, and metrics.
GetOrigin() string
// GetSource returns the metrics source
GetSource() metrics.MetricSource
// Init bootstraps the CloudService.
// ctx is optional and only used by CloudRunJobs for span creation
Init(ctx *TracingContext) error
// Shutdown cleans up the CloudService and allows emitting shutdown metrics
Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, runErr error)
// AddStartMetric adds the start (and legacy start, if any) metric to the metric agent
AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
// ShouldForceFlushAllOnForceFlushToSerializer is used for the
// forceFlushAll parameter on the call to forceFlushToSerializer in the
// pkg/aggregator/demultiplexer_serverless.ServerlessDemultiplexer.ForceFlushToSerializer
// method. This is currently necessary to support Cloud Run Jobs where the
// shutdown flow is more abrupt than other environments. We may want to
// unravel this thread in a cleaner way in the future.
ShouldForceFlushAllOnForceFlushToSerializer() bool
}
CloudService implements getting tags from each Cloud Provider.
func GetCloudServiceType ¶
func GetCloudServiceType() CloudService
GetCloudServiceType TODO: Refactor to avoid leaking individual service implementation details into the interface layer
type ContainerApp ¶
type ContainerApp struct {
//nolint:revive // TODO(SERV) Fix revive linter
SubscriptionId string
//nolint:revive // TODO(SERV) Fix revive linter
ResourceGroup string
}
ContainerApp has helper functions for getting specific Azure Container App data
func NewContainerApp ¶
func NewContainerApp() *ContainerApp
NewContainerApp returns a new ContainerApp instance
func (*ContainerApp) AddStartMetric ¶
func (c *ContainerApp) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
func (*ContainerApp) GetDefaultLogsSource ¶
func (c *ContainerApp) GetDefaultLogsSource() string
GetDefaultLogsSource returns the default logs source if `DD_SOURCE` is not set
func (*ContainerApp) GetEnhancedMetricTags ¶
func (c *ContainerApp) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
func (*ContainerApp) GetMetricPrefix ¶
func (c *ContainerApp) GetMetricPrefix() string
func (*ContainerApp) GetOrigin ¶
func (c *ContainerApp) GetOrigin() string
GetOrigin returns the `origin` attribute type for the given cloud service.
func (*ContainerApp) GetSource ¶
func (c *ContainerApp) GetSource() metrics.MetricSource
GetSource returns the metrics source
func (*ContainerApp) GetTags ¶
func (c *ContainerApp) GetTags() map[string]string
GetTags returns a map of Azure-related tags
func (*ContainerApp) GetUsageMetricSuffix ¶
func (c *ContainerApp) GetUsageMetricSuffix() string
func (*ContainerApp) Init ¶
func (c *ContainerApp) Init(_ *TracingContext) error
Init initializes ContainerApp specific code
func (*ContainerApp) ShouldForceFlushAllOnForceFlushToSerializer ¶
func (c *ContainerApp) ShouldForceFlushAllOnForceFlushToSerializer() bool
ShouldForceFlushAllOnForceFlushToSerializer is false usually.
func (*ContainerApp) Shutdown ¶
func (c *ContainerApp) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, _ error)
Shutdown emits the shutdown metric for ContainerApp
type EnhancedMetricTags ¶
EnhancedMetricTags holds base tags and high-cardinality tags for enhanced metrics.
type GCPConfig ¶
type GCPConfig struct {
// contains filtered or unexported fields
}
GCPConfig holds the metadata configuration
func GetDefaultConfig ¶
func GetDefaultConfig() *GCPConfig
GetDefaultConfig returns the medatadata's default config
type LocalService ¶
type LocalService struct{}
func (*LocalService) AddStartMetric ¶
func (l *LocalService) AddStartMetric(metricAgent *serverlessMetrics.ServerlessMetricAgent)
AddStartMetric adds the start metric for LocalService
func (*LocalService) GetDefaultLogsSource ¶
func (l *LocalService) GetDefaultLogsSource() string
GetDefaultLogsSource is a default implementation that returns an empty logs source
func (*LocalService) GetEnhancedMetricTags ¶
func (l *LocalService) GetEnhancedMetricTags(tags map[string]string) EnhancedMetricTags
GetEnhancedMetricTags is a default implementation that returns an empty tag set
func (*LocalService) GetMetricPrefix ¶
func (l *LocalService) GetMetricPrefix() string
GetMetrixPrefix is a default implementation that returns the default prefix
func (*LocalService) GetOrigin ¶
func (l *LocalService) GetOrigin() string
GetOrigin is a default implementation that returns a local empty origin
func (*LocalService) GetSource ¶
func (l *LocalService) GetSource() metrics.MetricSource
GetSource is a default implementation that returns a metrics source
func (*LocalService) GetTags ¶
func (l *LocalService) GetTags() map[string]string
GetTags is a default implementation that returns a local empty tag set
func (*LocalService) GetUsageMetricSuffix ¶
func (l *LocalService) GetUsageMetricSuffix() string
GetUsageMetricSuffix is a default implementation that returns the default usage metric suffix
func (*LocalService) Init ¶
func (l *LocalService) Init(_ *TracingContext) error
Init is not necessary for LocalService
func (*LocalService) ShouldForceFlushAllOnForceFlushToSerializer ¶
func (l *LocalService) ShouldForceFlushAllOnForceFlushToSerializer() bool
ShouldForceFlushAllOnForceFlushToSerializer is false usually.
func (*LocalService) Shutdown ¶
func (l *LocalService) Shutdown(metricAgent serverlessMetrics.ServerlessMetricAgent, enhancedMetricsEnabled bool, _ error)
Shutdown emits the shutdown metric for LocalService
type TraceAgent ¶
TraceAgent represents a trace agent that can process trace payloads, be flushed, and stopped. This interface avoids an import cycle with pkg/serverless/trace.
type TracingContext ¶
type TracingContext struct {
TraceAgent TraceAgent
SpanTags map[string]string
}
TracingContext holds tracing dependencies used by cloud services that need them. Only CloudRunJobs currently uses this context for span creation, but it's passed to all services for interface consistency.