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(opentelemetry): sampling rate configuration option #12054

Merged
merged 2 commits into from Dec 22, 2023

Conversation

samugi
Copy link
Contributor

@samugi samugi commented Nov 17, 2023

Summary

Sampling rate can now be configured by plugin (OTel) instead of it just being a global setting
If not configured, the global setting still applies.

This also fixes a small bug where, in the edge case of opentelemetry being used for propagation only (instrumentations disabled), the sampled flag was incorrectly set to true although no span was sampled for that request.

Includes tests to cover more configuration scenarios (esp. different sampling rates) and verify propagation is done correctly.

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
  • (no) There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • new configuration field for Opentelemetry: config.sampling_rate that allows setting sampling_rate "by plugin" instead of globally.

Issue reference

KAG-3126

@samugi samugi marked this pull request as draft November 17, 2023 17:10
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch from 5a274fa to dd86fae Compare November 17, 2023 18:00
@samugi samugi changed the title feat(tracing): sampling rate by plugin feat(tracing): sampling rate in plugin config Nov 17, 2023
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch 3 times, most recently from bbe9d37 to d9a8f15 Compare November 20, 2023 16:07
@samugi samugi changed the base branch from master to refactor/tracing-context November 20, 2023 16:08
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch 6 times, most recently from 2ca76af to ee064c8 Compare November 22, 2023 11:11
@samugi samugi changed the title feat(tracing): sampling rate in plugin config feat(tracing): Opentelemetry sampling rate configuration option Nov 22, 2023
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch from ee064c8 to 312cbc8 Compare November 22, 2023 12:07
@samugi samugi marked this pull request as ready for review November 22, 2023 13:25
@samugi samugi changed the title feat(tracing): Opentelemetry sampling rate configuration option feat(opentelemetry): sampling rate configuration option Nov 22, 2023
@samugi samugi marked this pull request as draft November 22, 2023 14:06
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch from 312cbc8 to 45242fa Compare November 22, 2023 14:57
@samugi samugi marked this pull request as ready for review November 22, 2023 16:46
@samugi samugi marked this pull request as draft November 22, 2023 16:46
@samugi samugi force-pushed the refactor/tracing-context branch 2 times, most recently from f103f9a to 708200b Compare November 24, 2023 16:24
Base automatically changed from refactor/tracing-context to master November 28, 2023 11:01
@samugi samugi force-pushed the feat/sampling-rate-by-plugin branch from 45242fa to 32f754c Compare November 28, 2023 11:12
@samugi samugi marked this pull request as ready for review November 28, 2023 11:14
@locao locao requested a review from brentos December 19, 2023 18:12
Sampling rate can now be set via the Opentelemetry plugin instead of
it just being a global setting for the gateway.

It also fixes a small bug where, in the edge case of opentelemetry being
used for propagation only (instrumentations disabled), the `sampled`
flag was incorrectly set to `true` although no span was sampled for that
request.

Includes tests to cover more configuration scenarios (esp. different
sampling rates) and verify propagation is done correctly.
@RobSerafini
Copy link
Contributor

@chobits @brentos - please proved some feedback.

kong/pdk/tracing.lua Outdated Show resolved Hide resolved
@samugi samugi merged commit 6fe6813 into master Dec 22, 2023
27 checks passed
@samugi samugi deleted the feat/sampling-rate-by-plugin branch December 22, 2023 08:15
chobits pushed a commit to chobits/kong that referenced this pull request Dec 22, 2023
Sampling rate can now be set via the Opentelemetry plugin instead of
it just being a global setting for the gateway.

It also fixes a small bug where, in the edge case of opentelemetry being
used for propagation only (instrumentations disabled), the `sampled`
flag was incorrectly set to `true` although no span was sampled for that
request.

Includes tests to cover more configuration scenarios (esp. different
sampling rates) and verify propagation is done correctly.
chobits pushed a commit to chobits/kong that referenced this pull request Dec 22, 2023
Sampling rate can now be set via the Opentelemetry plugin instead of
it just being a global setting for the gateway.

It also fixes a small bug where, in the edge case of opentelemetry being
used for propagation only (instrumentations disabled), the `sampled`
flag was incorrectly set to `true` although no span was sampled for that
request.

Includes tests to cover more configuration scenarios (esp. different
sampling rates) and verify propagation is done correctly.
@samugi samugi added this to the 3.6.0 milestone Dec 22, 2023
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

5 participants