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

Telemetry log: Add stack_trace field when given an exception #3863

Merged
merged 7 commits into from
Aug 29, 2024

Conversation

TonyCTHsu
Copy link
Contributor

@TonyCTHsu TonyCTHsu commented Aug 23, 2024

What does this PR do?

Providing a class name of the exception is not very useful. Sending stack_trace help us identified the location is helpful

  1. Add stack_trace field with reporting an exception
  2. Obfuscate backtrace
  3. Remove redundant debug level (The enriched data for debugging can be a risk and high data cardinality)

@TonyCTHsu TonyCTHsu requested a review from a team as a code owner August 23, 2024 11:07
@TonyCTHsu TonyCTHsu added the dev/internal Other internal work that does not need to be included in the changelog label Aug 23, 2024
@github-actions github-actions bot added the core Involves Datadog core libraries label Aug 23, 2024
@pr-commenter
Copy link

pr-commenter bot commented Aug 23, 2024

Benchmarks

Benchmark execution time: 2024-08-29 18:37:05

Comparing candidate commit e76043d in PR branch tonycthsu/telemetry_log_stacktrace with baseline commit 451d390 in branch master.

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

Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

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

This is cool! Left a few notes

Comment on lines 145 to 152
expect(result).to eq(
[
'/lib/datadog/core/telemetry/logging.rb:1 in `report`',
'REDACTED',
'REDACTED',
'REDACTED'
].join(',')
)
Copy link
Member

Choose a reason for hiding this comment

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

Just to doublecheck, does this format comply with the format that the other libraries are using?

We've had a few troubles with telemetry having mismatched formats between libs recently, so I think it's worth being extra careful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does this format comply with the format that the other libraries are using?

There is no specification about the format, but it is behaving as how DotNet is sending.

lib/datadog/core/telemetry/logging.rb Outdated Show resolved Hide resolved
lib/datadog/core/telemetry/event.rb Outdated Show resolved Hide resolved
module Logging
extend self

# Extract datadog stack trace from the exception
module DatadogStackTrace
Copy link
Member

Choose a reason for hiding this comment

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

I possibly not for this PR, but it would be cool to perhaps leave stack entries from:

  • The Ruby standard library -- paths starting with RbConfig::CONFIG.fetch("rubylibdir") (The profiler uses this to categorize Ruby code automatically as being from the standard library!)
  • dogstatsd-ruby -- by perhaps asking rubygems where dogstatsd-ruby is, when available

Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

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

Left a recommendation for improving the test (I think the current one is too "mocky"), but otherwise it LGTM 👍

spec/datadog/core/telemetry/logging_spec.rb Outdated Show resolved Hide resolved
lib/datadog/core/telemetry/event.rb Outdated Show resolved Hide resolved
@TonyCTHsu TonyCTHsu force-pushed the tonycthsu/telemetry_log_stacktrace branch from 89e6ed0 to 0459cfb Compare August 29, 2024 06:26
@TonyCTHsu TonyCTHsu force-pushed the tonycthsu/telemetry_log_stacktrace branch from 2bab52d to e76043d Compare August 29, 2024 17:59
@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (451d390) to head (044a9b1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3863      +/-   ##
==========================================
+ Coverage   97.85%   97.86%   +0.01%     
==========================================
  Files        1277     1277              
  Lines       76364    76394      +30     
  Branches     3740     3744       +4     
==========================================
+ Hits        74723    74761      +38     
+ Misses       1641     1633       -8     

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

@TonyCTHsu TonyCTHsu merged commit 18dafe3 into master Aug 29, 2024
49 of 50 checks passed
@TonyCTHsu TonyCTHsu deleted the tonycthsu/telemetry_log_stacktrace branch August 29, 2024 19:03
@github-actions github-actions bot added this to the 2.4.0 milestone Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries dev/internal Other internal work that does not need to be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants