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

Send telemetry logs for Profiling #3858

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

TonyCTHsu
Copy link
Contributor

What does this PR do?

Report internal error via telemetry logs for Profiling

@TonyCTHsu TonyCTHsu requested review from a team as code owners August 21, 2024 14:02
@TonyCTHsu TonyCTHsu added the dev/internal Other internal work that does not need to be included in the changelog label Aug 21, 2024
@github-actions github-actions bot added core Involves Datadog core libraries profiling Involves Datadog profiling labels Aug 21, 2024
Comment on lines 61 to 71
"Failed to report profiling data (#{config_without_api_key}): " \
"server returned unexpected HTTP #{result} status code"
)
Datadog::Core::Telemetry::Logging.error("Failed to report profiling data: unexpected HTTP #{result} status code")
false
end
else
Datadog.logger.error("Failed to report profiling data (#{config_without_api_key}): #{result}")
Datadog::Core::Telemetry::Logging.error("Failed to report profiling data")
false
end
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a lot of duplication: We're now reporting errors twice, to two different dd-trace-rb subsystems... And this will happen everywhere we have an error, and in the future a warning.

Would it be possible for Telemetry::Logging to also call the logger with the reported message?

This would mean that calls to Datadog.logger would be replaced with Telemetry::Logging.error, rather than copy-pasted.

Copy link
Contributor Author

@TonyCTHsu TonyCTHsu Aug 21, 2024

Choose a reason for hiding this comment

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

I am aware of the verbosity of those curated description. Currently it work around the constraints/risks for using telemetry logs:

  1. Must not transfer PII
  2. Reduce the cardinality in order to hash and batch

Combining the logger and telemetry logs in a single API is risky. Perhaps we can revisit the design in the future with more patterns and concrete examples.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. I wasn't aware of the requirement to reduce cardinality. I see how omitting details in these strings will have that effect.

Is this perhaps worth documenting in the telemetry logging class? E.g. So that if/when this question comes up again, other members of the team will have somewhere to reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do that in the followup PR.

@pr-commenter
Copy link

pr-commenter bot commented Aug 21, 2024

Benchmarks

Benchmark execution time: 2024-08-21 14:37:33

Comparing candidate commit 0501d6d in PR branch tonycthsu/sending-profiling-telemetry-logs with baseline commit e7a6609 in branch master.

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

scenario:profiler - Major GC runs (profiling enabled)

  • 🟩 throughput [+2.297op/s; +2.688op/s] or [+2.055%; +2.404%]

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.

👍 LGTM

Comment on lines 61 to 71
"Failed to report profiling data (#{config_without_api_key}): " \
"server returned unexpected HTTP #{result} status code"
)
Datadog::Core::Telemetry::Logging.error("Failed to report profiling data: unexpected HTTP #{result} status code")
false
end
else
Datadog.logger.error("Failed to report profiling data (#{config_without_api_key}): #{result}")
Datadog::Core::Telemetry::Logging.error("Failed to report profiling data")
false
end
Copy link
Member

Choose a reason for hiding this comment

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

Ah. I wasn't aware of the requirement to reduce cardinality. I see how omitting details in these strings will have that effect.

Is this perhaps worth documenting in the telemetry logging class? E.g. So that if/when this question comes up again, other members of the team will have somewhere to reference.

@TonyCTHsu TonyCTHsu merged commit 3c6dfd1 into master Aug 23, 2024
156 of 163 checks passed
@TonyCTHsu TonyCTHsu deleted the tonycthsu/sending-profiling-telemetry-logs branch August 23, 2024 10:06
@github-actions github-actions bot added this to the 2.4.0 milestone Aug 23, 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 profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants