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

Serialize span events via a dedicated field #4279

Merged
merged 11 commits into from
Feb 10, 2025
Merged

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Jan 10, 2025

What does this PR do?
Before this PR, tracing span events were serialized as a JSON string in the span tag events. This causes issues with size limit, as tags can only be 5000 characters. This limit is problematic when reporting multiple span events, or when reporting large data in a span events, like a stack trace.

This PR uses a new top-level span field, span_events, which supports the full span event representation, without sizing limitation or artificial stringification that was required in the JSON serialization from before.

Because users can already use span events through the events tag, and agent support for the top-level field is scheduled for a future agent version, this change check with the agent before sending span events it in the new format.

The serialization logic is already merged in #4218

Change log entry
Remove tracing Span Events serialization limitations.

How to test the change?
There are system-tests, as well as unit tests for this change.

Copy link

github-actions bot commented Jan 10, 2025

👋 Hey @marcotc, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2025-01-23 21:25:08 UTC

@github-actions github-actions bot added core Involves Datadog core libraries tracing labels Jan 10, 2025
@datadog-datadog-prod-us1
Copy link
Contributor

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

Datadog Report

Branch report: span-events-writer
Commit report: 148f1b0
Test service: dd-trace-rb

✅ 0 Failed, 22228 Passed, 1477 Skipped, 7m 5.72s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 10, 2025

Benchmarks

Benchmark execution time: 2025-02-06 00:45:14

Comparing candidate commit b6c3435 in PR branch span-events-writer with baseline commit a444023 in branch master.

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

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.74%. Comparing base (a444023) to head (b6c3435).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #4279    +/-   ##
========================================
  Coverage   97.73%   97.74%            
========================================
  Files        1368     1369     +1     
  Lines       83014    83133   +119     
  Branches     4221     4227     +6     
========================================
+ Hits        81134    81256   +122     
+ Misses       1880     1877     -3     

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

@marcotc marcotc changed the base branch from master to steep-2 January 14, 2025 23:09
@marcotc marcotc force-pushed the span-events-writer branch from 1d5510f to 33a7fc9 Compare January 14, 2025 23:44
@marcotc marcotc changed the title WIP: Better span events serialization when supported Serialize span events via a dedicated field Jan 14, 2025
@marcotc marcotc marked this pull request as ready for review January 14, 2025 23:51
@marcotc marcotc requested review from a team as code owners January 14, 2025 23:51
@marcotc marcotc force-pushed the span-events-writer branch from 33a7fc9 to 148f1b0 Compare January 14, 2025 23:51
Base automatically changed from steep-2 to master January 15, 2025 16:58
@zarirhamza zarirhamza requested a review from a team as a code owner January 15, 2025 16:58
Copy link
Member

@p-datadog p-datadog left a comment

Choose a reason for hiding this comment

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

I read the diff but couldn't find where the new serialization is actually implemented, could you maybe merge/rebase on master?

Steepfile Outdated Show resolved Hide resolved
@marcotc
Copy link
Member Author

marcotc commented Jan 23, 2025

@p-datadog I implemented the serialization in a previous PR: #4218

I should have mentioned that in this PR description, let me update it!

@datadog-datadog-prod-us1
Copy link
Contributor

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

Datadog Report

Branch report: span-events-writer
Commit report: b6c3435
Test service: dd-trace-rb

✅ 0 Failed, 22112 Passed, 1479 Skipped, 5m 36.15s Total Time

@marcotc marcotc requested a review from p-datadog January 23, 2025 21:48
@marcotc
Copy link
Member Author

marcotc commented Jan 27, 2025

The system-tests issues happens because of the way test "skips" and force-tests-list interact: DataDog/system-tests#3904

spec/datadog/tracing/span_spec.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@TonyCTHsu TonyCTHsu left a comment

Choose a reason for hiding this comment

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

Can we refactor the method signature for native_events_supported ?

Prefer keyword argument to positional argument.

Copy link
Member

@Strech Strech left a comment

Choose a reason for hiding this comment

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

Awesome PR, I have just 1 minor thing

lib/datadog/tracing/transport/traces.rb Outdated Show resolved Hide resolved
@marcotc marcotc enabled auto-merge (squash) February 6, 2025 00:12
@marcotc marcotc merged commit 971040f into master Feb 10, 2025
279 checks passed
@marcotc marcotc deleted the span-events-writer branch February 10, 2025 20:37
@github-actions github-actions bot added this to the 2.11.0 milestone Feb 10, 2025
p-datadog pushed a commit that referenced this pull request Feb 10, 2025
* di-worker-2:
  DEBUG-3457 start DI probe notifier worker on every event submission
  DEBUG-3472 send snapshot and status events together (#4360)
  Serialize span events via a dedicated field (#4279)
  Keep everything to sucker_punch test file.
  Remove unnecessary sucker_punch mutexes.
  Create separate method to get spans_count.
  Separate out spans' call to fetch_spans.
  Isolate sucker_punch fetch_spans calls.
  Add mutex to tracer_helpers.
  Run flaky test over and over and over...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants