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

perf(tracing): avoid unnecessary creations and garbage-collections of spans (from timers) #12080

Merged
merged 1 commit into from Nov 23, 2023

Conversation

samugi
Copy link
Contributor

@samugi samugi commented Nov 21, 2023

Summary

Before this change timers would generate spans, which means DB and DNS spans in recurring timers would be continuously generated and garbage-collected.

This commit checks the exact ngx phase and runs it against a whitelist of allowed phases to ensure the timer phase does not generate spans.

Checklist

  • The Pull Request has tests
  • (no) A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • [Implement ...]

Issue reference

KAG-3169

@samugi samugi marked this pull request as draft November 21, 2023 17:12
@samugi samugi changed the title perf(tracing): do not create spans in timer phase perf(tracing): do not create spans from timers Nov 21, 2023
@samugi
Copy link
Contributor Author

samugi commented Nov 21, 2023

I'm open to suggestions in case there is a faster way to detect that we are in a timer context

@samugi samugi changed the title perf(tracing): do not create spans from timers perf(tracing): avoid unnecessary creations and garbage-collections of spans (from timers) Nov 21, 2023
@samugi samugi force-pushed the perf/tracing-timer-phase branch 4 times, most recently from 895af6c to d68b77e Compare November 21, 2023 20:40
@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 21, 2023
Before this change timers would generate spans, which means DB and DNS
spans in recurring timers would be continuously generated and
garbage-collected.

This commit checks the exact ngx phase and runs it against a whitelist
to ensure `timer` phase does not generate spans.
@kikito kikito requested a review from chobits November 22, 2023 09:21
@samugi samugi marked this pull request as ready for review November 22, 2023 10:06
@chobits chobits requested a review from ADD-SP November 23, 2023 08:14
Copy link
Member

@oowl oowl left a comment

Choose a reason for hiding this comment

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

LGTM

@samugi samugi merged commit aa7074f into master Nov 23, 2023
30 checks passed
@samugi samugi deleted the perf/tracing-timer-phase branch November 23, 2023 09:00
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.

None yet

3 participants