Skip to content

Commit

Permalink
Rename getAttributes to getMap
Browse files Browse the repository at this point in the history
  • Loading branch information
4of9 committed Oct 29, 2024
1 parent e6e43bc commit 236bb67
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/loop/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (e *EnvConfig) parse() error {
if err != nil {
return err
}
e.TracingAttributes = getAttributes(envTracingAttribute)
e.TracingAttributes = getMap(envTracingAttribute)
e.TracingSamplingRatio = getFloat64OrZero(envTracingSamplingRatio)
e.TracingTLSCertPath = os.Getenv(envTracingTLSCertPath)
}
Expand All @@ -128,9 +128,9 @@ func (e *EnvConfig) parse() error {
return fmt.Errorf("failed to parse %s: %w", envTelemetryEndpoint, err)
}
e.TelemetryCACertFile = os.Getenv(envTelemetryCACertFile)
e.TelemetryAttributes = getAttributes(envTelemetryAttribute)
e.TelemetryAttributes = getMap(envTelemetryAttribute)
e.TelemetryTraceSampleRatio = getFloat64OrZero(envTelemetryTraceSampleRatio)
e.TelemetryAuthHeaders = getAttributes(envTelemetryAuthHeader)
e.TelemetryAuthHeaders = getMap(envTelemetryAuthHeader)
}
return nil
}
Expand Down Expand Up @@ -165,14 +165,14 @@ func getValidCollectorTarget() (string, error) {
return tracingCollectorTarget, nil
}

func getAttributes(envKeyPrefix string) map[string]string {
tracingAttributes := make(map[string]string)
func getMap(envKeyPrefix string) map[string]string {
m := make(map[string]string)
for _, env := range os.Environ() {
if strings.HasPrefix(env, envKeyPrefix) {
tracingAttributes[strings.TrimPrefix(env, envKeyPrefix)] = os.Getenv(env)
m[strings.TrimPrefix(env, envKeyPrefix)] = os.Getenv(env)
}
}
return tracingAttributes
return m
}

// Any errors in parsing result in a sampling ratio of 0.0.
Expand Down

0 comments on commit 236bb67

Please sign in to comment.