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

feat(tracing): new headers propagation module for tracing plugins #12670

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

samugi
Copy link
Member

@samugi samugi commented Feb 29, 2024

Summary

The new propagation module replaces the propagation.lua file, providing a more flexible and extensible way to handle tracing headers propagation from plugins (at the moment OpenTelemetry and Zipkin). It allows configuring the priority of tracing context extraction and what headers to extract and inject the tracing context from/to. It also allows clearing headers from the request after extraction to gain full control on what is propagated to the upstream.

New configuration options:

propagation.extract: Header formats used to extract tracing context from incoming requests.
propagation.inject: Header formats used to inject tracing context.
propagation.clear: Header names to clear after context extraction.

Each header format is now defined in its own extractor and injector files so that individual logic for extracting and injecting the tracing context is isolated. This is meant to improve maintainability/testability and facilitate extending support to new header formats.

Checklist

  • The Pull Request has tests
  • 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 (TBD)

Issue reference

KAG-1886 / KAG-1887

kong/plugins/zipkin/schema.lua Show resolved Hide resolved
kong/tracing/propagation/schema.lua Show resolved Hide resolved
kong/tracing/propagation/schema.lua Outdated Show resolved Hide resolved
kong/plugins/opentelemetry/handler.lua Show resolved Hide resolved
@samugi samugi force-pushed the feat/tracing-headers-propagation-module-rework branch 3 times, most recently from 78378ce to ca3b40a Compare March 13, 2024 11:41
@samugi samugi requested review from StarlightIbuki and ADD-SP March 14, 2024 08:29
kong/tracing/propagation/extractors/_base.lua Show resolved Hide resolved
kong/tracing/propagation/extractors/aws.lua Show resolved Hide resolved
kong/tracing/propagation/extractors/aws.lua Show resolved Hide resolved
kong/tracing/propagation/extractors/aws.lua Show resolved Hide resolved
kong/tracing/propagation/extractors/aws.lua Show resolved Hide resolved
kong/tracing/propagation/injectors/w3c.lua Show resolved Hide resolved
kong/tracing/propagation/injectors/w3c.lua Outdated Show resolved Hide resolved
kong/tracing/propagation/utils.lua Show resolved Hide resolved
kong/plugins/opentelemetry/handler.lua Outdated Show resolved Hide resolved
kong/plugins/zipkin/handler.lua Outdated Show resolved Hide resolved
kong/tracing/propagation/init.lua Outdated Show resolved Hide resolved
kong/plugins/opentelemetry/handler.lua Outdated Show resolved Hide resolved
kong/tracing/propagation/injectors/_base.lua Outdated Show resolved Hide resolved
kong/tracing/propagation/schema.lua Show resolved Hide resolved
@github-actions github-actions bot added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Mar 15, 2024
@samugi samugi force-pushed the feat/tracing-headers-propagation-module-rework branch 2 times, most recently from 8e7c6ad to c4aa1a3 Compare March 15, 2024 14:48
@StarlightIbuki StarlightIbuki requested a review from ADD-SP March 18, 2024 07:03
@samugi samugi requested a review from StarlightIbuki March 19, 2024 08:53
Copy link
Contributor

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

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

Only two comments:

  • We changed the schema, how to educate customers about this feature? Changelog is not a good place. Shall we create a PR for docs.konghq.com?
  • We should inform the UI team about the schema changes.

@samugi
Copy link
Member Author

samugi commented Mar 20, 2024

Only two comments:

  • We changed the schema, how to educate customers about this feature? Changelog is not a good place. Shall we create a PR for docs.konghq.com?
  • We should inform the UI team about the schema changes.

thank you @ADD-SP, as those items are going to be separate from this PR I'm creating dedicated tasks - KAG-4104, KAG-4105

@samugi samugi requested a review from ADD-SP March 20, 2024 09:48
Copy link
Contributor

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

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

Please also inform the Koko team.

@sumimakito
Copy link
Member

sumimakito commented Mar 21, 2024

Verified with @kong-ui-public/[email protected] - The UI components in Kong Manager and Gateway Manager should consume these schema changes in this PR without further actions as of now.

The new propagation module replaces the propagation.lua file, providing
a more flexible and extensible way to handle tracing headers propagation
from plugins (at the moment OpenTelemetry and Zipkin). It allows
configuring the priority of tracing context extraction and what headers
to extract and inject the tracing context from/to. It also allows
clearing headers from the request after extraction to gain full control
on what is propagated to the upstream.

New configuration options:

propagation.extract: Header formats used to extract tracing context from
incoming requests.
propagation.inject: Header formats used to inject tracing context.
propagation.clear: Header names to clear after context extraction.

Each header format is now defined in its own extractor and injector
files so that individual logic for extracting and injecting the tracing
context is isolated. This is meant to improve
maintainability/testability and facilitate extending support to new
header formats.

apply PR suggestions (squash me)

Co-authored-by: Qi <[email protected]>
@samugi samugi force-pushed the feat/tracing-headers-propagation-module-rework branch from 79c8af5 to b791241 Compare March 21, 2024 09:41
@samugi samugi removed the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Mar 21, 2024
@samugi samugi merged commit 9793768 into master Mar 21, 2024
29 checks passed
@samugi samugi deleted the feat/tracing-headers-propagation-module-rework branch March 21, 2024 11:13
@samugi samugi linked an issue Mar 25, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment