Skip to content

Datadog Baggage API#3069

Merged
mtoffl01 merged 10 commits into
mainfrom
rachel.yang/baggage-api-context
Jan 16, 2025
Merged

Datadog Baggage API#3069
mtoffl01 merged 10 commits into
mainfrom
rachel.yang/baggage-api-context

Conversation

@rachelyangdog

Copy link
Copy Markdown
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

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

Copy link
Copy Markdown

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

pr-commenter Bot commented Jan 8, 2025

Copy link
Copy Markdown

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

@mtoffl01 mtoffl01 left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread ddtrace/tracer/baggage.go Outdated
Comment thread ddtrace/tracer/baggage.go Outdated
Comment thread ddtrace/tracer/baggage.go Outdated
Comment thread ddtrace/tracer/baggage.go Outdated

@mtoffl01 mtoffl01 left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread ddtrace/tracer/baggage.go Outdated
Comment thread ddtrace/tracer/baggage_test.go Outdated
Comment thread ddtrace/tracer/baggage_test.go
Comment thread ddtrace/tracer/baggage_test.go
Comment thread ddtrace/tracer/baggage.go Outdated
Comment thread ddtrace/tracer/baggage.go Outdated
@rachelyangdog
rachelyangdog marked this pull request as ready for review January 13, 2025 20:08
Comment thread ddtrace/baggage/baggage.go Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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]>
@bm1549 bm1549 changed the title WIP: Datadog Baggage API Datadog Baggage API Jul 18, 2025
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