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

Add meta_struct and stack trace collection #4269

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

vpellan
Copy link
Contributor

@vpellan vpellan commented Jan 9, 2025

What does this PR do?

This PR adds meta_struct and stack trace collection support

Motivation:

Stack trace collection is required for exploit prevention. meta_struct is required for stack trace collection

Change log entry

None.

Additional Notes:

How to test the change?

@github-actions github-actions bot added integrations Involves tracing integrations appsec Application Security monitoring product tracing labels Jan 9, 2025
@datadog-datadog-prod-us1
Copy link
Contributor

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

Datadog Report

Branch report: vpellan/stack-trace-collection
Commit report: 77e9969
Test service: dd-trace-rb

❌ 5 Failed (0 Known Flaky), 22064 Passed, 1476 Skipped, 5m 23.46s Total Time

❌ Failed Tests (5)

  • Datadog::Tracing::Span#to_hash is expected to eq {:error=>0, :meta=>{}, :metrics=>{}, :name=>"my.span", :parent_id=>0, :resource=>"my.span", :service=>nil, :span_id=>34, :span_links=>[], :trace_id=>12, :type=>nil} - rspec - Details

    Expand for error
     expected: {:error=>0, :meta=>{}, :metrics=>{}, :name=>"my.span", :parent_id=>0, :resource=>"my.span", :service=>nil, :span_id=>34, :span_links=>[], :trace_id=>12, :type=>nil}
          got: {:error=>0, :meta=>{}, :meta_struct=>{}, :metrics=>{}, :name=>"my.span", :parent_id=>0, :resource=>"my.span", :service=>nil, :span_id=>34, :span_links=>[], :trace_id=>12, :type=>nil}
     
     (compared using ==)
     
     Diff:
     @@ -1,5 +1,6 @@
      :error => 0,
      :meta => {},
     +:meta_struct => {},
     ...
    
  • Datadog::Tracing::Span#to_hash is expected to eq {:error => 0, :meta => {}, :metrics => {}, :name => "my.span", :parent_id => 0, :resource => "my.span", :service => nil, :span_id => 34, :span_links => [], :trace_id => 12, :type => nil} - rspec

  • Datadog::Tracing::Transport::SerializableTrace#to_msgpack behaves like serialize all fields contains all fields - rspec - Details

    Expand for error
     expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
     actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
     the extra elements were:        ["meta_struct"]
     
     Failure/Error: expect(span.keys).to match_array(expected)
     
       expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
       actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
       the extra elements were:        ["meta_struct"]
     Shared Example Group: "serialize all fields" called from ./spec/datadog/tracing/transport/serializable_trace_spec.rb:223
     ...
    
  • Datadog::Tracing::Transport::SerializableTrace#to_msgpack when given span events behaves like serialize all fields contains all fields - rspec - Details

    Expand for error
     expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
     actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
     the extra elements were:        ["meta_struct"]
     
     Failure/Error: expect(span.keys).to match_array(expected)
     
       expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
       actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_id", "span_links", "trace_id", "type"]
       the extra elements were:        ["meta_struct"]
     Shared Example Group: "serialize all fields" called from ./spec/datadog/tracing/transport/serializable_trace_spec.rb:191
     ...
    
  • Datadog::Tracing::Transport::SerializableTrace#to_msgpack when given span events when native events are supported behaves like serialize all fields contains all fields - rspec - Details

    Expand for error
     expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_events", "span_id", "span_links", "trace_id", "type"]
     actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_events", "span_id", "span_links", "trace_id", "type"]
     the extra elements were:        ["meta_struct"]
     
     Failure/Error: expect(span.keys).to match_array(expected)
     
       expected collection contained:  ["error", "meta", "metrics", "name", "parent_id", "resource", "service", "span_events", "span_id", "span_links", "trace_id", "type"]
       actual collection contained:    ["error", "meta", "meta_struct", "metrics", "name", "parent_id", "resource", "service", "span_events", "span_id", "span_links", "trace_id", "type"]
       the extra elements were:        ["meta_struct"]
     Shared Example Group: "serialize all fields" called from ./spec/datadog/tracing/transport/serializable_trace_spec.rb:219
     ...
    

@pr-commenter
Copy link

pr-commenter bot commented Jan 9, 2025

Benchmarks

Benchmark execution time: 2025-01-14 16:02:55

Comparing candidate commit 77e9969 in PR branch vpellan/stack-trace-collection with baseline commit 5235204 in branch master.

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

@vpellan vpellan force-pushed the vpellan/stack-trace-collection branch from f79044e to 77e9969 Compare January 14, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appsec Application Security monitoring product integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant