-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate datadog-serverless-trace-mini-agent from libdatadog to serverless-components as datadog-serverless-compat #9
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
Merged
duncanpharvey
merged 42 commits into
main
from
duncan-harvey/datadog-serverless-trace-mini-agent
Apr 21, 2025
Merged
Migrate datadog-serverless-trace-mini-agent from libdatadog to serverless-components as datadog-serverless-compat #9
duncanpharvey
merged 42 commits into
main
from
duncan-harvey/datadog-serverless-trace-mini-agent
Apr 21, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Only setting the timeout to 0 ms is not enough, and there was a race in the test between the dns lookup and the timeout that intermittently failed the test (most likely on Windows).
…e-mini-agent to 0.5.0 (#528)
…or Azure Functions, Google Cloud Functions, and Azure Spring Apps (#548) * add _dd.mini_agent_version to spans in all environments * apply formatting
* use dogstatsd in serverless * convert env var value to lowercase and nest dogstatsd logic * refactor to move loop outside of conditional dogstatsd block * add environment variables for hardcoded values and refactor start_dogstatsd * fix unit test * add env var for default dogstatsd port
* feat: Support DD_HTTP_PROXY and DD_HTTPS_PROXY * fix: fmt * feat: honor dd_proxy
* feat: upstream dogstatsd from datadog lambda extension * add: stand alone dogstatsd binary as example * fix: imports * fix: make test utils public * fix: more test utils public * fix: make entry public * fix: clippy * fix: make test config public * Revert "fix: make test config public" This reverts commit 7dc979979d85c665767906030f91253725850f30. * fix: make fields public for tests and assertions * refactor: remove unused error * refactor: do one step parsing * fix: duplicate dependencies from conflicts * refactor: use type for sorted tags and ustr * fix: statsd parsing and tests * format: format and clippy test: fix test format with # for tags. It also changed the byte wise test expected result * fix: use only minimum regexp * fix: increase to 10k context size, lost in refactors/moving * refactor: update license * fix: remove custom toolchain * style: fix comment too long not picked up by rustfmt * fix: restore previous cargo.lock * fix: missing error dep * fix: use empty tags * fix: update license * fix: nightly rustc 1.83 format * fix: clippy * fix: do not use a map, support duplicate tag values --------- Co-authored-by: Taegyun Kim <taegyun.kim@datadoghq.com>
* feat: support HTTPS_PROXY for traces * fix: https_proxy only. * fix: maybe native-tls works in lambda? * feat: try rust-tls * fix: rusttls oops * fix: reee it's rustls why * fix: default-features must be false * WIP: debug log, will revert * fix: reqwest honors system proxies, hyper doesn't seem to. Only proxy https traffic * fix: revert hyper-proxy, just use system proxy * fix: revert proxy, use system * fix: revert hyper-proxy, use system proxy * fix: revert senddata proxy change from tests * Revert "fix: revert senddata proxy change from tests" This reverts commit 105000853f86dd46c39914434907452d9ca05b60. * Revert "fix: revert hyper-proxy, use system proxy" This reverts commit d9ebdc7e3cd68f046a4e8d981ac0564b34458983. * Revert "fix: revert proxy, use system" This reverts commit e4a8e18c14b56f8b889aec23b40cf3ccaf511639. * Revert "fix: revert hyper-proxy, just use system proxy" This reverts commit f8ed3005f75bdb3a4a4fb35dc52f499206b8d2b9. * fix: re-commit tests * fix: fmt * feat: license * feat: Wrap proxy in feature flag * fix: fmt * fix: not sure why the arg is needed in create_send_data * fix: no api changes for public interfaces * fix: None * fix: allow unused * fix: None for update_send_results_example * fix: remove unused error import
* feat: Prefer DD_PROXY_HTTPS over HTTPS_PROXY * fix: no proxy on ints * fix: clippy thx
* show dogstatsd logs in serverless mini agent * increase buffer size to 8192 bytes * update metric pattern to exclude service checks and to account for container ids * exclude events from being parsed * add comment for 8KB max buffer size matching default value in Go Agent * lazily initialize static regex for dogstatsd metrics * minor refactors * add unit tests * remove explicit drops
* add fixed timeout to verify behavior * add number of series and distro to flush * tmp: add info on trace retries * add more tmp debug log * fix debug log * Revert "fix debug log" This reverts commit 4b44bb37ec4cc658d37fbeea820d399a4e924788. * Revert "add more tmp debug log" This reverts commit 536917b8c2f990365058c90a580937ee5e5f1894. * Revert "tmp: add info on trace retries" This reverts commit 5e4790794decea0f3f7e1ab523a9ab36e39820db. * add timeout for client * add todo * fmt * add constant for timeout duration --------- Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
* add _dd.serverless_compat_version span tag * remove _dd.mini_agent_version tag from spans
* add `aggregator.rs` adds an aggregator which gives batches limited by intake payload size * update `TraceFlusher` to use the `TraceAggregator` * make `MiniAgent` use `TraceAggregator` on `TraceFlusher` * fmt + clippy * add license
Add clippy warnings and allows for panic macros to most crates Add an extension crate for mutex in ddcommon to isolate the unwrap to one location in code to avoid the allow annotations. We aren't going to stop unwrapping mutexes anytime soon. Replace use of lazy_static with OnceLock for ddcommon, ddtelemetry, live-debugger, tools, sidecar
(serverless) feature: Push retry strategy to libdatadog to avoid re-compressing
* remove serverless specific dogstatsd server implementation * remove dogstatsd version from dependency
* add origin tag to metrics emitted from mini agent * add dd.origin tag to metrics emitted from mini agent
…hash or serverless-components path
17720e2 to
b889a4f
Compare
duncanista
reviewed
Apr 21, 2025
| @@ -0,0 +1,21 @@ | |||
| [package] | |||
| name = "datadog-serverless-compat" | |||
| version = "0.1.0" | |||
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A description of what is this would be nice tho
Collaborator
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| description = "Binary to run trace-agent and dogstatsd servers in Serverless environments" |
duncanista
approved these changes
Apr 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Migrate
datadog-serverless-trace-mini-agentcrate from libdatadog to this repo.Motivation
Develop binary crates used solely by Serverless independently from libdatadog.
https://datadoghq.atlassian.net/browse/SVLS-6543
Additional Notes
datadog-serverless-trace-mini-agenttoserverless-compatdatadog-serverless-compatto make it clear when the process is running that it is a Datadog processdogstatsdandtrace-agentand libdatadog commit hashes for dependencies in libdatadogCommands to migrate crate along with commit history from libdatadog.
Describe how to test/QA your changes
For testing Azure Functions I built the
datadog-serverless-compatbinaries from this repo, deployed them to Azure, and confirmed both custom and runtime metrics are sent to Datadog successfully.Also confirmed that binary size is roughly the same between build in libdatadog vs. build in serverless-components.