dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

ddtrace: tracer: support for meta_struct field in span

Open eliottness opened this issue 1 year ago • 2 comments

What does this PR do?

This PR adds the ability to send metadata in spans via the field meta_struct (added 2 years ago) to the tracer following the v0.4 protocol.

Motivation

Some of appsec tags in span are hitting size limits because they are formatted in json in the meta field that was not made to welcome such data in the first place. Using meta_struct as an alternative to send structured data to Datadog's backend will make us able to provide more context for our customers in their use of the different features of ASM.

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 Datadog employees:

  • [ ] If this PR touches code that handles credentials of any kind, such as Datadog API keys, I've requested a review from @DataDog/security-design-and-guidance.
  • [ ] This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

eliottness avatar Feb 16 '24 13:02 eliottness

Benchmarks

Benchmark execution time: 2024-03-29 10:17:39

Comparing candidate commit c5cfd5feedf6c01d536b8572b29ff1a04da2caef in PR branch eliott.bouhana/meta-struct with baseline commit aaf8af5710fd94c17f3c5d78930b0dcd927d0557 in branch main.

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

scenario:BenchmarkHttpServeTrace-24

  • 🟩 allocated_mem [-997 bytes; -973 bytes] or [-10.534%; -10.279%]
  • 🟩 execution_time [-453.445ns; -347.155ns] or [-2.717%; -2.080%]

scenario:BenchmarkPartialFlushing/Disabled-24

  • 🟥 allocations [+95272; +98573] or [+3.001%; +3.105%]
  • 🟥 execution_time [+5.691ms; +9.060ms] or [+2.049%; +3.261%]

scenario:BenchmarkPartialFlushing/Enabled-24

  • 🟥 allocations [+98746; +98758] or [+3.102%; +3.102%]

pr-commenter[bot] avatar Feb 16 '24 14:02 pr-commenter[bot]

Sent back to draft because we need to check if we have to support a fallback in case meta_struct is not supported by the agent (<7.35.0)

eliottness avatar Feb 27 '24 08:02 eliottness

This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Mar 19 '24 01:03 github-actions[bot]