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

fix(tracing): span start/end time precision #11484

Merged
merged 2 commits into from
Sep 12, 2023
Merged

Conversation

samugi
Copy link
Member

@samugi samugi commented Aug 30, 2023

Summary

Ensure the span lifetime is consistent with the spans hierarchy by using the same time precision for the root span's "end time" as the balancer span.

Before this fix, using millisecond precision instead of nano could result in the root span to end before its children.

Checklist

  • The Pull Request has tests
  • A changelog file has been added to CHANGELOG/unreleased/kong or adding skip-changelog label on PR if unnecessary. README.md (Please ping @vm-001 if you need help)
  • (no) There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • increased precision of the request (kong) span to nanoseconds

Issue reference

KAG-2336
Fix #11294 (secondary issue reported in the comments)

@samugi samugi marked this pull request as draft August 30, 2023 12:59
Base automatically changed from fix/tracing-parent-span-id to master September 5, 2023 07:28
@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 5, 2023
@pull-request-size pull-request-size bot added size/M and removed size/L labels Sep 5, 2023
@samugi samugi marked this pull request as ready for review September 5, 2023 07:37
@StarlightIbuki
Copy link
Contributor

Rerunning all the tests as it seems the artificials are broken.

Copy link
Contributor

@StarlightIbuki StarlightIbuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this being merged.

CHANGELOG/unreleased/kong/11484.yaml Show resolved Hide resolved
kong/init.lua Show resolved Hide resolved
samugi and others added 2 commits September 12, 2023 14:04
Ensure the span lifetime is consistent with the hierarchy
by using the same time source for the root span's end time as the
balancer span.

Before this fix, an approximation (causing a precision error) could
result in the root span to end before its children.
Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
@samugi samugi merged commit 37a17eb into master Sep 12, 2023
29 checks passed
@samugi samugi deleted the fix/tracing-span-precision branch September 12, 2023 15:19
team-gateway-bot pushed a commit that referenced this pull request Sep 12, 2023
* fix(tracing): span start/end time precision

Ensure the span lifetime is consistent with the hierarchy
by using the same time source for the root span's end time as the
balancer span.

Before this fix, an approximation (causing a precision error) could
result in the root span to end before its children.

* docs(changelog): add issue

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>

---------

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
(cherry picked from commit 37a17eb)
samugi added a commit that referenced this pull request Sep 13, 2023
* fix(tracing): span start/end time precision

Ensure the span lifetime is consistent with the hierarchy
by using the same time source for the root span's end time as the
balancer span.

Before this fix, an approximation (causing a precision error) could
result in the root span to end before its children.

* docs(changelog): add issue

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>

---------

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
(cherry picked from commit 37a17eb)

Co-authored-by: Samuele <samuele@konghq.com>
@kikito
Copy link
Member

kikito commented Sep 25, 2023

@samugi is there a reason for not backporting this further (e.g 3.3)

@team-gateway-bot
Copy link
Collaborator

The backport to release/3.3.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.3.x release/3.3.x
# Navigate to the new working tree
cd .worktrees/backport-release/3.3.x
# Create a new branch
git switch --create backport-11484-to-release/3.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 37a17eb491a8b85b2dd01f994bd48a3757ad216a
# Push it to GitHub
git push --set-upstream origin backport-11484-to-release/3.3.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.3.x

Then, create a pull request where the base branch is release/3.3.x and the compare/head branch is backport-11484-to-release/3.3.x.

kikito pushed a commit that referenced this pull request Sep 26, 2023
* fix(tracing): span start/end time precision

Ensure the span lifetime is consistent with the hierarchy
by using the same time source for the root span's end time as the
balancer span.

Before this fix, an approximation (causing a precision error) could
result in the root span to end before its children.

* docs(changelog): add issue

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>

---------

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
samugi added a commit that referenced this pull request Sep 27, 2023
* fix(tracing): span start/end time precision

Ensure the span lifetime is consistent with the hierarchy
by using the same time source for the root span's end time as the
balancer span.

Before this fix, an approximation (causing a precision error) could
result in the root span to end before its children.

* docs(changelog): add issue

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>

---------

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken trace trees with tracing_instrumentations=request
4 participants