-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(opentelemetry): Bucket spans for cleanup #14154
base: develop
Are you sure you want to change the base?
Conversation
} | ||
|
||
/** Try to flush any pending spans immediately. */ | ||
public flush(): void { | ||
this._clearTimeout(); | ||
|
||
const openSpanCount = this._finishedSpans.length; | ||
const finishedSpans: ReadableSpan[] = []; | ||
this._finishedSpanBuckets.forEach(bucket => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Can we instead add a get _finishSpans(): ReadableSpan[]
getter on the exporter class and use this? This makes it easier to test this as well as we can just access this in tests too? 🤔
public constructor(options?: { timeout?: number }) { | ||
this._finishedSpans = []; | ||
this._timeout = options?.timeout || DEFAULT_TIMEOUT; | ||
private _finishedSpanBuckets: (FinishedSpanBucket | undefined)[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Could we add comments to these explaining what they do here, e.g. why do we keep the spansToBucketEntry etc? it all makes sense to me, but for the sake of our future selves :D
yarn lint
) & (yarn test
).We had a huge performance problem with a overhead of 5x or so in CPU Load. We investigated the issue and saw that the cleanup logic for OTEL ran on every span end. Thats why we rewrote this to run only once every interval.
I do not guarantee that this code is perfect, this is just a hint, that there is something wrong currently.