Skip to content

Commit

Permalink
hotfix for dynamically setting the otel service name
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Nov 18, 2024
1 parent d723c61 commit 7d494b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions otel/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ type Config struct {

// ConfigureOnce is used to prevent reinitialization of OpenTelemetry by later arriving configurations
func ConfigureOnce(cfg *Config, name string) {
serviceName.Store(name)
Configure(cfg)
stopReconfiguration.Store(true)
serviceName.Store(name)
}

func Configure(cfg *Config) {
Expand All @@ -53,7 +53,9 @@ func Configure(cfg *Config) {
log.Debugf("Connecting to endpoint %v", cfg.Endpoint)
log.Debugf("Using headers %v", cfg.Headers)

serviceName.Store("flashlight")
if serviceName.Load() == nil {
serviceName.Store("flashlight")
}
if cfg.SampleRate < 1 {
cfg.SampleRate = 1
}
Expand Down

0 comments on commit 7d494b5

Please sign in to comment.