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: expose TraceId and ParentID to other plugins #61

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

dmehala
Copy link
Contributor

@dmehala dmehala commented May 23, 2024

Description

This commit adds two fields to kong.ctx.shared and ngx.var:

  • datadog_sdk_trace_id: TraceId of the current span.
  • datadog_sdk_span_id: SpanId of the current span.

Those fields can be consumed by other Kong plugins or in the underlying NGINX configuration for log correlation.

Resolves #25

This commit adds two fields to `kong.ctx.shared` and `ngx.var`:
  - `datadog_sdk_trace_id`: TraceId of the current span.
  - `datadog_sdk_span_id`: SpanId of the current span.

Those fields can be consumed by other Kong plugins or in the underlying
NGINX configuration for log correlation.
- Remove ngx.var
- config.service is not required anymore
@dmehala
Copy link
Contributor Author

dmehala commented May 30, 2024

Hey @pablomartinezbernardo

Since your last review, I added an example. Would you mind checking if it works for you? 🙇

examples/log_injection/README.md Outdated Show resolved Hide resolved
examples/log_injection/README.md Outdated Show resolved Hide resolved
Co-authored-by: pablomartinezbernardo <[email protected]>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.68%. Comparing base (15d7bd3) to head (ac21681).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #61   +/-   ##
=======================================
  Coverage   92.68%   92.68%           
=======================================
  Files           7        7           
  Lines         615      615           
=======================================
  Hits          570      570           
  Misses         45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmehala dmehala merged commit 39ccb24 into main Jun 4, 2024
3 checks passed
@dmehala dmehala deleted the dmehala/log-correlation branch June 4, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correlate Span ID and Trace ID to Kong logs.
3 participants