Skip to content
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

[APM] Relax time-shifting so it doesn't affect async transactions #35800

Closed
sorenlouv opened this issue Apr 30, 2019 · 1 comment · Fixed by #35845
Closed

[APM] Relax time-shifting so it doesn't affect async transactions #35800

sorenlouv opened this issue Apr 30, 2019 · 1 comment · Fixed by #35845
Labels
Team:APM All issues that need APM UI Team support

Comments

@sorenlouv
Copy link
Member

Background: #24072

This is how we currently do time shifting:

export function getClockSkew(
item: IWaterfallItem,
parentItem?: IWaterfallItem
) {
if (!parentItem) {
return 0;
}
switch (item.docType) {
// don't calculate skew for spans. Just use parent's skew
case 'span':
return parentItem.skew;
// transaction is the inital entry in a service. Calculate skew for this, and it will be propogated to all child spans
case 'transaction': {
const parentStart = parentItem.timestamp + parentItem.skew;
const parentEnd = parentStart + parentItem.duration;
// determine if child starts before the parent
const offsetStart = parentStart - item.timestamp;
// determine if child starts after the parent has ended
const offsetEnd = item.timestamp - parentEnd;
// child transaction starts before parent OR
// child transaction starts after parent has ended
if (offsetStart > 0 || offsetEnd > 0) {
const latency = Math.max(parentItem.duration - item.duration, 0) / 2;
return offsetStart + latency;
// child transaction starts withing parent duration and no adjustment is needed
} else {
return 0;
}
}
}
}

Time shifting in its current form may be causing more harm than good, especially for users using async message queues.

Solution could be to only time shift when child start before parent. Not if the child starts after parent has ended.

@sorenlouv sorenlouv added Team:APM All issues that need APM UI Team support [zube]: Inbox labels Apr 30, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:APM All issues that need APM UI Team support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants