You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify DefaultMaxQueueSize and DefaultScheduleDelay usage (#6974)
### Description
OpenTelemetry uses `DefaultScheduleDelay` and `DefaultExportTimeout`
values as milliseconds but Go time package will understand them as
nanoseconds.
I understand that this is a stable library and that those value will
probably never change, so can we at least clarify their usage?
Right above the defaults declaration it says `// Defaults for
BatchSpanProcessorOptions.` which is confusing.
We used `trace.DefaultScheduleDelay` as a fallback value for our tracing
setup.
This confusion led to high CPU usage due to the frequent batch exports.
### Confusing behavior
```go
processor := trace.NewBatchSpanProcessor(exporter,
// set timeout to 5000 ns instead of the expected 5000 ms
trace.WithBatchTimeout(trace.DefaultScheduleDelay),
// set timeout to 30000 ns instead of the expected 30000 ms
trace.WithExportTimeout(trace.DefaultExportTimeout),
)
```
### Correct way to use those values
```go
processor := trace.NewBatchSpanProcessor(exporter,
trace.WithBatchTimeout(trace.DefaultScheduleDelay * time.Millisecond),
trace.WithExportTimeout(trace.DefaultExportTimeout * time.Millisecond),
)
```
---------
Co-authored-by: Damien Mathieu <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
0 commit comments