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

WIP: Datadog Baggage API #3069

Merged
merged 10 commits into from
Jan 16, 2025
Merged

WIP: Datadog Baggage API #3069

merged 10 commits into from
Jan 16, 2025

Conversation

rachelyangdog
Copy link
Contributor

What does this PR do?

Adding baggage API. This is the first PR to add baggage functionality to dd-trace-go and only adds the public API methods.

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@rachelyangdog rachelyangdog requested a review from a team as a code owner January 8, 2025 18:51
@rachelyangdog rachelyangdog marked this pull request as draft January 8, 2025 18:51
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 8, 2025

Datadog Report

Branch report: rachel.yang/baggage-api-context
Commit report: 92b6779
Test service: dd-trace-go

✅ 0 Failed, 5181 Passed, 71 Skipped, 2m 33.22s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 8, 2025

Benchmarks

Benchmark execution time: 2025-01-15 19:18:11

Comparing candidate commit 2cfb7b3 in PR branch rachel.yang/baggage-api-context with baseline commit 5a8a82c in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 0 unstable metrics.

@mtoffl01 mtoffl01 requested review from darccio and mtoffl01 January 10, 2025 18:08
@mtoffl01 mtoffl01 self-assigned this Jan 10, 2025
Copy link
Contributor

@mtoffl01 mtoffl01 left a comment

Choose a reason for hiding this comment

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

Did a light review with some comments - go ahead and address those and then I can take a second pass!

ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mtoffl01 mtoffl01 left a comment

Choose a reason for hiding this comment

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

Nice work! Just be sure to check why TestWrapConsumerGroupHandler is failing and update it if necessary.

ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
ddtrace/tracer/baggage.go Outdated Show resolved Hide resolved
@rachelyangdog rachelyangdog marked this pull request as ready for review January 13, 2025 20:08
Comment on lines 67 to 68
// GetAll returns a **copy** of all baggage items in the context,
func GetAll(ctx context.Context) map[string]string {
Copy link
Member

Choose a reason for hiding this comment

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

Feel free to ignore the following: although GetAll is clear enough, I feel a more idiomatic naming would be All - like in slices.All - or Items/Entries - for which I don't have any example in the stdlib but it could be aligned with Values present in multiple stdlib packages.

Anyway, I'm approving this as is.

@mtoffl01 WDYT about the current API?

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be confusing because the function lives on a package called tracer; if we moved baggage into its own package, then we could do baggage.All.
Actually GetAll is still ambiguous on the tracer package; what about renaming it to AllBaggage? Either that, or move all this code into a package called baggage, and then rename the function to All

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code has been moved to a separate package called baggage! Now lives under ddtrace and not tracer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still seeing package tracer at the top; should be package baggage, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah! just saw it and updated it

@mtoffl01 mtoffl01 merged commit b49d213 into main Jan 16, 2025
160 checks passed
@mtoffl01 mtoffl01 deleted the rachel.yang/baggage-api-context branch January 16, 2025 19:52
rachelyangdog added a commit that referenced this pull request Jan 21, 2025
Co-authored-by: Mikayla Toffler <[email protected]>
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.

3 participants