Skip to content

Commit

Permalink
tracer: startup message for hotspots/endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
felixge committed Dec 30, 2021
1 parent 4d858e7 commit 0e5b928
Showing 1 changed file with 52 additions and 48 deletions.
100 changes: 52 additions & 48 deletions ddtrace/tracer/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,33 @@ const (

// startupInfo contains various information about the status of the tracer on startup.
type startupInfo struct {
Date string `json:"date"` // ISO 8601 date and time of start
OSName string `json:"os_name"` // Windows, Darwin, Debian, etc.
OSVersion string `json:"os_version"` // Version of the OS
Version string `json:"version"` // Tracer version
Lang string `json:"lang"` // "Go"
LangVersion string `json:"lang_version"` // Go version, e.g. go1.13
Env string `json:"env"` // Tracer env
Service string `json:"service"` // Tracer Service
AgentURL string `json:"agent_url"` // The address of the agent
AgentError string `json:"agent_error"` // Any error that occurred trying to connect to agent
Debug bool `json:"debug"` // Whether debug mode is enabled
AnalyticsEnabled bool `json:"analytics_enabled"` // True if there is a global analytics rate set
SampleRate string `json:"sample_rate"` // The default sampling rate for the rules sampler
SamplingRules []SamplingRule `json:"sampling_rules"` // Rules used by the rules sampler
SamplingRulesError string `json:"sampling_rules_error"` // Any errors that occurred while parsing sampling rules
ServiceMappings map[string]string `json:"service_mappings"` // Service Mappings
Tags map[string]string `json:"tags"` // Global tags
RuntimeMetricsEnabled bool `json:"runtime_metrics_enabled"` // Whether or not runtime metrics are enabled
HealthMetricsEnabled bool `json:"health_metrics_enabled"` // Whether or not health metrics are enabled
ApplicationVersion string `json:"dd_version"` // Version of the user's application
Architecture string `json:"architecture"` // Architecture of host machine
GlobalService string `json:"global_service"` // Global service string. If not-nil should be same as Service. (#614)
LambdaMode string `json:"lambda_mode"` // Whether or not the client has enabled lambda mode
AppSec bool `json:"appsec"` // AppSec status: true when started, false otherwise.
AgentFeatures agentFeatures `json:"agent_features"` // Lists the capabilities of the agent.
Date string `json:"date"` // ISO 8601 date and time of start
OSName string `json:"os_name"` // Windows, Darwin, Debian, etc.
OSVersion string `json:"os_version"` // Version of the OS
Version string `json:"version"` // Tracer version
Lang string `json:"lang"` // "Go"
LangVersion string `json:"lang_version"` // Go version, e.g. go1.13
Env string `json:"env"` // Tracer env
Service string `json:"service"` // Tracer Service
AgentURL string `json:"agent_url"` // The address of the agent
AgentError string `json:"agent_error"` // Any error that occurred trying to connect to agent
Debug bool `json:"debug"` // Whether debug mode is enabled
AnalyticsEnabled bool `json:"analytics_enabled"` // True if there is a global analytics rate set
SampleRate string `json:"sample_rate"` // The default sampling rate for the rules sampler
SamplingRules []SamplingRule `json:"sampling_rules"` // Rules used by the rules sampler
SamplingRulesError string `json:"sampling_rules_error"` // Any errors that occurred while parsing sampling rules
ServiceMappings map[string]string `json:"service_mappings"` // Service Mappings
Tags map[string]string `json:"tags"` // Global tags
RuntimeMetricsEnabled bool `json:"runtime_metrics_enabled"` // Whether or not runtime metrics are enabled
HealthMetricsEnabled bool `json:"health_metrics_enabled"` // Whether or not health metrics are enabled
ProfilerCodeHotspotsEnabled bool `json:"profiler_code_hotspots_enabled"` // Whether or not profiler code hotspots are enabled
ProfilerEndpointsEnabled bool `json:"profiler_endpoints_enabled"` // Whether or not profiler endpoints are enabled
ApplicationVersion string `json:"dd_version"` // Version of the user's application
Architecture string `json:"architecture"` // Architecture of host machine
GlobalService string `json:"global_service"` // Global service string. If not-nil should be same as Service. (#614)
LambdaMode string `json:"lambda_mode"` // Whether or not the client has enabled lambda mode
AppSec bool `json:"appsec"` // AppSec status: true when started, false otherwise.
AgentFeatures agentFeatures `json:"agent_features"` // Lists the capabilities of the agent.
}

// checkEndpoint tries to connect to the URL specified by endpoint.
Expand Down Expand Up @@ -79,29 +81,31 @@ func logStartup(t *tracer) {
}

info := startupInfo{
Date: time.Now().Format(time.RFC3339),
OSName: osName(),
OSVersion: osVersion(),
Version: version.Tag,
Lang: "Go",
LangVersion: runtime.Version(),
Env: t.config.env,
Service: t.config.serviceName,
AgentURL: t.config.transport.endpoint(),
Debug: t.config.debug,
AnalyticsEnabled: !math.IsNaN(globalconfig.AnalyticsRate()),
SampleRate: fmt.Sprintf("%f", t.rulesSampling.globalRate),
SamplingRules: t.rulesSampling.rules,
ServiceMappings: t.config.serviceMappings,
Tags: tags,
RuntimeMetricsEnabled: t.config.runtimeMetrics,
HealthMetricsEnabled: t.config.runtimeMetrics,
ApplicationVersion: t.config.version,
Architecture: runtime.GOARCH,
GlobalService: globalconfig.ServiceName(),
LambdaMode: fmt.Sprintf("%t", t.config.logToStdout),
AgentFeatures: t.config.agent,
AppSec: appsec.Enabled(),
Date: time.Now().Format(time.RFC3339),
OSName: osName(),
OSVersion: osVersion(),
Version: version.Tag,
Lang: "Go",
LangVersion: runtime.Version(),
Env: t.config.env,
Service: t.config.serviceName,
AgentURL: t.config.transport.endpoint(),
Debug: t.config.debug,
AnalyticsEnabled: !math.IsNaN(globalconfig.AnalyticsRate()),
SampleRate: fmt.Sprintf("%f", t.rulesSampling.globalRate),
SamplingRules: t.rulesSampling.rules,
ServiceMappings: t.config.serviceMappings,
Tags: tags,
RuntimeMetricsEnabled: t.config.runtimeMetrics,
HealthMetricsEnabled: t.config.runtimeMetrics,
ApplicationVersion: t.config.version,
ProfilerCodeHotspotsEnabled: t.config.profilerHotspots,
ProfilerEndpointsEnabled: t.config.profilerEndpoints,
Architecture: runtime.GOARCH,
GlobalService: globalconfig.ServiceName(),
LambdaMode: fmt.Sprintf("%t", t.config.logToStdout),
AgentFeatures: t.config.agent,
AppSec: appsec.Enabled(),
}
if _, err := samplingRulesFromEnv(); err != nil {
info.SamplingRulesError = fmt.Sprintf("%s", err)
Expand Down

0 comments on commit 0e5b928

Please sign in to comment.