Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions internal/config/config.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
: # github.com/DataDog/dd-trace-go/v2/internal/config [github.com/DataDog/dd-trace-go/v2/internal/config.test]

// Unless explicitly stated otherwise all files in this repository are licensed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
undefined: telemetry

OriginCode = telemetry.OriginCode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
undefined: telemetry

OriginCalculated = telemetry.OriginCalculated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
undefined: telemetry (typecheck)

OriginDefault = telemetry.OriginDefault

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"github.com/DataDog/dd-trace-go/v2/internal/config/provider"
"github.com/DataDog/dd-trace-go/v2/internal/env"
"github.com/DataDog/dd-trace-go/v2/internal/log"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetryapi"
"github.com/DataDog/dd-trace-go/v2/internal/traceprof"
)

Expand All @@ -33,14 +33,14 @@
)

// Origin represents where a configuration value came from.
// Re-exported so callers don't need to import internal/telemetry.
type Origin = telemetry.Origin
// Re-exported so callers don't need to import internal/telemetry/types.
type Origin = telemetryapi.Origin

// Re-exported origin constants for common configuration sources
const (
OriginCode = telemetry.OriginCode

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / checklocks

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / generate

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / Verify generated files are up-to-date

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry

Check failure on line 41 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry
OriginCalculated = telemetry.OriginCalculated

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / checklocks

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / generate

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / Verify generated files are up-to-date

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry

Check failure on line 42 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry
OriginDefault = telemetry.OriginDefault

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / checklocks

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / generate

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / Verify generated files are up-to-date

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (ubuntu-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (macos-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.26) / test-core

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.25) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / multios-unit-tests (windows-latest, 1.26) / test-multi-os

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry

Check failure on line 43 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests (1.25) / test-core

undefined: telemetry
)

// Config represents global configuration properties.
Expand Down Expand Up @@ -255,7 +255,7 @@
return &u
}

func (c *Config) SetAgentURL(u *url.URL, origin telemetry.Origin) {
func (c *Config) SetAgentURL(u *url.URL, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.agentURL = u
Expand All @@ -281,7 +281,7 @@
return c.debug
}

func (c *Config) SetDebug(enabled bool, origin telemetry.Origin) {
func (c *Config) SetDebug(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.debug = enabled
Expand All @@ -294,7 +294,7 @@
return c.profilerEndpoints
}

func (c *Config) SetProfilerEndpoints(enabled bool, origin telemetry.Origin) {
func (c *Config) SetProfilerEndpoints(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.profilerEndpoints = enabled
Expand All @@ -307,7 +307,7 @@
return c.profilerHotspots
}

func (c *Config) SetProfilerHotspotsEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetProfilerHotspotsEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.profilerHotspots = enabled
Expand All @@ -319,7 +319,7 @@
return c.runtimeMetrics
}

func (c *Config) SetRuntimeMetricsEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetRuntimeMetricsEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.runtimeMetrics = enabled
Expand All @@ -332,7 +332,7 @@
return c.runtimeMetricsV2
}

func (c *Config) SetRuntimeMetricsV2Enabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetRuntimeMetricsV2Enabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.runtimeMetricsV2 = enabled
Expand All @@ -345,7 +345,7 @@
return c.dataStreamsMonitoringEnabled
}

func (c *Config) SetDataStreamsMonitoringEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetDataStreamsMonitoringEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.dataStreamsMonitoringEnabled = enabled
Expand All @@ -358,7 +358,7 @@
return c.logStartup
}

func (c *Config) SetLogStartup(enabled bool, origin telemetry.Origin) {
func (c *Config) SetLogStartup(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.logStartup = enabled
Expand All @@ -371,7 +371,7 @@
return c.logToStdout
}

func (c *Config) SetLogToStdout(enabled bool, origin telemetry.Origin) {
func (c *Config) SetLogToStdout(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.logToStdout = enabled
Expand All @@ -384,7 +384,7 @@
return c.isLambdaFunction
}

func (c *Config) SetIsLambdaFunction(enabled bool, origin telemetry.Origin) {
func (c *Config) SetIsLambdaFunction(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.isLambdaFunction = enabled
Expand All @@ -397,7 +397,7 @@
return c.globalSampleRate
}

func (c *Config) SetGlobalSampleRate(rate float64, origin telemetry.Origin) {
func (c *Config) SetGlobalSampleRate(rate float64, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.globalSampleRate = rate
Expand All @@ -410,7 +410,7 @@
return c.traceRateLimitPerSecond
}

func (c *Config) SetTraceRateLimitPerSecond(rate float64, origin telemetry.Origin) {
func (c *Config) SetTraceRateLimitPerSecond(rate float64, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.traceRateLimitPerSecond = rate
Expand All @@ -426,14 +426,14 @@
return enabled, minSpans
}

func (c *Config) SetPartialFlushEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetPartialFlushEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.partialFlushEnabled = enabled
configtelemetry.Report("DD_TRACE_PARTIAL_FLUSH_ENABLED", enabled, origin)
}

func (c *Config) SetPartialFlushMinSpans(minSpans int, origin telemetry.Origin) {
func (c *Config) SetPartialFlushMinSpans(minSpans int, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.partialFlushMinSpans = minSpans
Expand All @@ -446,7 +446,7 @@
return c.debugAbandonedSpans
}

func (c *Config) SetDebugAbandonedSpans(enabled bool, origin telemetry.Origin) {
func (c *Config) SetDebugAbandonedSpans(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.debugAbandonedSpans = enabled
Expand All @@ -459,7 +459,7 @@
return c.spanTimeout
}

func (c *Config) SetSpanTimeout(timeout time.Duration, origin telemetry.Origin) {
func (c *Config) SetSpanTimeout(timeout time.Duration, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.spanTimeout = timeout
Expand All @@ -472,7 +472,7 @@
return c.debugStack
}

func (c *Config) SetDebugStack(enabled bool, origin telemetry.Origin) {
func (c *Config) SetDebugStack(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.debugStack = enabled
Expand All @@ -485,7 +485,7 @@
return c.statsComputationEnabled
}

func (c *Config) SetStatsComputationEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetStatsComputationEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.statsComputationEnabled = enabled
Expand All @@ -498,7 +498,7 @@
return c.logDirectory
}

func (c *Config) SetLogDirectory(directory string, origin telemetry.Origin) {
func (c *Config) SetLogDirectory(directory string, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.logDirectory = directory
Expand All @@ -517,7 +517,7 @@
return c.hostname
}

func (c *Config) SetHostname(hostname string, origin telemetry.Origin) {
func (c *Config) SetHostname(hostname string, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.hostname = hostname
Expand All @@ -537,7 +537,7 @@
return c.version
}

func (c *Config) SetVersion(version string, origin telemetry.Origin) {
func (c *Config) SetVersion(version string, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.version = version
Expand All @@ -550,14 +550,14 @@
return c.env
}

func (c *Config) SetEnv(env string, origin telemetry.Origin) {
func (c *Config) SetEnv(env string, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.env = env
configtelemetry.Report("DD_ENV", env, origin)
}

func (c *Config) SetFeatureFlags(features []string, origin telemetry.Origin) {
func (c *Config) SetFeatureFlags(features []string, origin telemetryapi.Origin) {
c.mu.Lock()
if c.featureFlags == nil {
c.featureFlags = make(map[string]struct{})
Expand Down Expand Up @@ -624,7 +624,7 @@
return to, ok
}

func (c *Config) SetServiceMapping(from, to string, origin telemetry.Origin) {
func (c *Config) SetServiceMapping(from, to string, origin telemetryapi.Origin) {
c.mu.Lock()
if c.serviceMappings == nil {
c.serviceMappings = make(map[string]string)
Expand All @@ -645,7 +645,7 @@
return c.retryInterval
}

func (c *Config) SetRetryInterval(interval time.Duration, origin telemetry.Origin) {
func (c *Config) SetRetryInterval(interval time.Duration, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.retryInterval = interval
Expand All @@ -658,7 +658,7 @@
return c.serviceName
}

func (c *Config) SetServiceName(name string, origin telemetry.Origin) {
func (c *Config) SetServiceName(name string, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.serviceName = name
Expand All @@ -671,7 +671,7 @@
return c.ciVisibilityEnabled
}

func (c *Config) SetCIVisibilityEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetCIVisibilityEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.ciVisibilityEnabled = enabled
Expand All @@ -684,7 +684,7 @@
return c.logsOTelEnabled
}

func (c *Config) SetLogsOTelEnabled(enabled bool, origin telemetry.Origin) {
func (c *Config) SetLogsOTelEnabled(enabled bool, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.logsOTelEnabled = enabled
Expand All @@ -697,7 +697,7 @@
return c.traceProtocol
}

func (c *Config) SetTraceProtocol(v float64, origin telemetry.Origin) {
func (c *Config) SetTraceProtocol(v float64, origin telemetryapi.Origin) {
c.mu.Lock()
defer c.mu.Unlock()
c.traceProtocol = v
Expand Down
18 changes: 9 additions & 9 deletions internal/config/configtelemetry/configtelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package configtelemetry
import (
"sync/atomic"

"github.com/DataDog/dd-trace-go/v2/internal/telemetry"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetryapi"
)

// defaultSeqID is the sequence ID used for all default configuration values.
Expand All @@ -35,20 +35,20 @@ func nextSeqID() uint64 {
}

// Report reports a configuration value from a non-default configuration source.
func Report(name string, value any, origin telemetry.Origin) {
telemetry.RegisterAppConfigs(telemetry.Configuration{
func Report(name string, value any, origin telemetryapi.Origin) {
telemetryapi.SubmitAppConfigs(telemetryapi.Configuration{
Name: name,
Value: value,
Origin: origin,
ID: telemetry.EmptyID,
ID: telemetryapi.EmptyID,
SeqID: nextSeqID(),
})
}

// ReportWithID reports a non-default configuration value, including the config source's ID.
// Use this for sources that carry a config_id (e.g. declarative config).
func ReportWithID(name string, value any, origin telemetry.Origin, id string) {
telemetry.RegisterAppConfigs(telemetry.Configuration{
func ReportWithID(name string, value any, origin telemetryapi.Origin, id string) {
telemetryapi.SubmitAppConfigs(telemetryapi.Configuration{
Name: name,
Value: value,
Origin: origin,
Expand All @@ -59,11 +59,11 @@ func ReportWithID(name string, value any, origin telemetry.Origin, id string) {

// ReportDefault reports the value for a configuration key from the 'default' configuration source.
func ReportDefault(name string, value any) {
telemetry.RegisterAppConfigs(telemetry.Configuration{
telemetryapi.SubmitAppConfigs(telemetryapi.Configuration{
Name: name,
Value: value,
Origin: telemetry.OriginDefault,
ID: telemetry.EmptyID,
Origin: telemetryapi.OriginDefault,
ID: telemetryapi.EmptyID,
SeqID: defaultSeqID,
})
}
4 changes: 2 additions & 2 deletions internal/config/provider/declarativeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package provider

import "github.com/DataDog/dd-trace-go/v2/internal/telemetry"
import "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetryapi"

// declarativeConfig represents a configuration loaded from a YAML source file.
type declarativeConfig struct {
Expand All @@ -24,6 +24,6 @@ func (d *declarativeConfig) getID() string {
func emptyDeclarativeConfig() *declarativeConfig {
return &declarativeConfig{
Config: make(map[string]string),
ID: telemetry.EmptyID,
ID: telemetryapi.EmptyID,
}
}
8 changes: 4 additions & 4 deletions internal/config/provider/declarativeconfigsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"go.yaml.in/yaml/v3"

"github.com/DataDog/dd-trace-go/v2/internal/log"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetryapi"
)

const (
Expand All @@ -25,7 +25,7 @@ const (

type declarativeConfigSource struct {
filePath string
originValue telemetry.Origin
originValue telemetryapi.Origin
config *declarativeConfig
}

Expand All @@ -37,11 +37,11 @@ func (d *declarativeConfigSource) getID() string {
return d.config.getID()
}

func (d *declarativeConfigSource) origin() telemetry.Origin {
func (d *declarativeConfigSource) origin() telemetryapi.Origin {
return d.originValue
}

func newDeclarativeConfigSource(filePath string, origin telemetry.Origin) *declarativeConfigSource {
func newDeclarativeConfigSource(filePath string, origin telemetryapi.Origin) *declarativeConfigSource {
return &declarativeConfigSource{
filePath: filePath,
originValue: origin,
Expand Down
6 changes: 3 additions & 3 deletions internal/config/provider/envconfigsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package provider

import (
"github.com/DataDog/dd-trace-go/v2/internal/env"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry"
"github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetryapi"
)

type envConfigSource struct{}
Expand All @@ -16,6 +16,6 @@ func (e *envConfigSource) get(key string) string {
return env.Get(normalizeKey(key))
}

func (e *envConfigSource) origin() telemetry.Origin {
return telemetry.OriginEnvVar
func (e *envConfigSource) origin() telemetryapi.Origin {
return telemetryapi.OriginEnvVar
}
Loading
Loading