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

feat(hermes): add datadog profiling #1035

Merged
merged 1 commit into from
Sep 1, 2023
Merged

feat(hermes): add datadog profiling #1035

merged 1 commit into from
Sep 1, 2023

Conversation

Reisen
Copy link
Contributor

@Reisen Reisen commented Aug 30, 2023

This adds DataDog profiling to the Go portion of Hermes. Datadog provides two API's, APM tracing and full profiling. APM tracing allows defining meaningful spans over the code to measure, wheras profiling exposes all runtime metrics for the profiling mode specified.

We only have one small hot path in the message handling so the application is relatively simple, initially I opted for APM but tracing seems better.

There is a second option, which is to add ddprof to the Rust portion but I'm opting against this for now because while it will provide tracing for both the Rust and Go portion, the tracing will not be Go aware and be much more brittle. Ideally it would be nice to enable both, and prevent ddprof from analyzing past the Go boundary, but this seems difficult to achieve and I'm not sure the Rust portion will really benefit from tracing yet.

This also renames GO_LOG_ALL to GO_LOG which now takes a log level, so can be configured similar to RUST_LOG with GO_LOG=info

@Reisen Reisen requested review from thmzlt and ali-bahjati August 30, 2023 08:32
@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Visit Preview Sep 1, 2023 10:51am
xc-admin-frontend ⬜️ Ignored (Inspect) Visit Preview Sep 1, 2023 10:51am

@Reisen Reisen force-pushed the push-uuvuqrytuuop branch from 84d9612 to d492a38 Compare August 30, 2023 10:42
ctx := context.Background()
// Start the datadog profiler. Only starts if an environment is
// specified and a datadog API key is provided.
if os.Getenv("DD_PROFILING_ENV") != "" && os.Getenv("DD_API_KEY") != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

wouldn't it be better if we pass them by cli arguments (which supports env variable as well)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I'll change it, I added them with changes to the GO_LOG which I intended to behave similar to RUST_LOG (no arg), this would be better.

@ali-bahjati ali-bahjati marked this pull request as ready for review September 1, 2023 10:51
@Reisen Reisen merged commit 0559b45 into main Sep 1, 2023
4 checks passed
@Reisen Reisen deleted the push-uuvuqrytuuop branch September 1, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants