Skip to content

Commit 90e8e4f

Browse files
Haoning-Sunhaoning.sun
authored andcommitted
Check newSamplesPerSecond in UpdateSamplingFrequency
1 parent 894e4cf commit 90e8e4f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/controller/controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ func (c *Controller) Shutdown() {
164164
// UpdateSamplingFrequency dynamically updates the sampling frequency for both the tracer
165165
// and reporter.
166166
func (c *Controller) UpdateSamplingFrequency(newSamplesPerSecond int) error {
167+
if newSamplesPerSecond < 1 {
168+
return fmt.Errorf("invalid sampling frequency: %d (must be >= 1)", newSamplesPerSecond)
169+
}
170+
167171
if c.tracer == nil {
168172
return fmt.Errorf("tracer is not initialized")
169173
}

0 commit comments

Comments
 (0)