Skip to content

Options traces_sample_rate and profiles_sample_rate have to be float, not accepting null value #963

@SomeDevSpace

Description

@SomeDevSpace

How do you use Sentry?

Self-hosted / on-premises

SDK version

4.14

Steps to reproduce

I would like to easily completely disable sentry tracing and profiling using ENV vars.
If I set in the config:

traces_sample_rate: '%env(float:SENTRY_TRACES_SAMPLE_RATE)%' profiles_sample_rate: '%env(float:SENTRY_PROFILES_SAMPLE_RATE)%' 

I'm not able to make the output of the method isTracingEnabled() false
$sentryHub->getClient()->getOptions()->isTracingEnabled()

SENTRY_TRACES_SAMPLE_RATE=0.0 SENTRY_PROFILES_SAMPLE_RATE=0.0 $sentryHub->getClient()->getOptions()->isTracingEnabled() == true 

There's no way, to make the traces_sample_rate and profiles_sample_rate == null, even that the library take that case into account:

 public function isTracingEnabled(): bool { if (null !== $this->getEnableTracing() && false === $this->getEnableTracing()) { return false; } return null !== $this->getTracesSampleRate() || null !== $this->getTracesSampler(); } 

Expected result

SENTRY_TRACES_SAMPLE_RATE= SENTRY_PROFILES_SAMPLE_RATE= 
$this->getTracesSampleRate() == null $this->getTracesSampler() == null 

Actual result

I'm not able to achieve the following result using the environment variables.

$this->getTracesSampleRate() == null $this->getTracesSampler() == null 

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions