-
Notifications
You must be signed in to change notification settings - Fork 20
feat(dsm): Add support for automatic DSM context extraction inside the extension #1265
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
base: main
Are you sure you want to change the base?
Changes from all commits
798577f
f320471
579f6e6
03c926d
e6135ed
13043c4
947380a
7a69746
ca5b7da
9b923a5
c5dc415
7d710d7
c27c642
e8f72a2
9d7b2df
eb34dad
84efbfc
f99e4b3
aa65e38
6d5b41f
42bd8bd
aa7b01f
5b0a3ea
f7f8028
745c6f5
9112d74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ test_suites: | |
| - name: oom | ||
| - name: lmi-oom | ||
| - name: payload-size | ||
| - name: dsm | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,23 @@ pub struct LambdaConfig { | |
| /// without durable execution context enrichment. Defaults to 0 until the tracer-side | ||
| /// durable execution support is released; set to 50 to re-enable enrichment. | ||
| pub lambda_durable_function_log_buffer_size: usize, | ||
|
|
||
| // Data Streams Monitoring | ||
| /// Enable extension-side DSM consume checkpoints. Gated by the same | ||
| /// `DD_DATA_STREAMS_ENABLED` flag the tracer libraries use; the extension | ||
| /// and tracer never emit checkpoints for the same runtime, so sharing the | ||
| /// flag cannot double-count. | ||
|
jeastham1993 marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blocker. the no-double-count claim holds inside the extension via request_id dedup, but nothing in code stops the extension emitting alongside a self-instrumenting python/js wrapper. it relies on those runtimes not enabling extension dsm. can we confirm that assumption holds, or enforce it in code? otherwise dsm stats get double-counted for those runtimes. |
||
| /// Java/.NET/Go - Datadog Lambda supports calls to '/start-invocation', no tracer support for parsing Lambda payloads | ||
| /// Python - Wrapper script in datadog-lambda-python extracts context and DSM, but does not call `/start-invocation` | ||
| /// JS - Wrapper script in datadog-lambda-js extracts context and DSM, but does not call `/start-invocation` | ||
| pub dsm_consume_enabled: bool, | ||
| /// Fallback DSM `exchange` (event bus name) used for `EventBridge` consume | ||
| /// checkpoints when it cannot be derived from the event payload | ||
| /// (`DD_DSM_EXCHANGE_NAME`). | ||
| pub dsm_exchange_name: Option<String>, | ||
| /// Consumer group used for `MSK`/Kafka DSM consume checkpoints, which is not | ||
| /// present in the Lambda event payload (`DD_DSM_KAFKA_GROUP`). | ||
| pub dsm_kafka_group: Option<String>, | ||
| } | ||
|
|
||
| impl Default for LambdaConfig { | ||
|
|
@@ -106,6 +123,9 @@ impl Default for LambdaConfig { | |
| api_security_sample_delay: Duration::from_secs(30), | ||
| custom_metrics_exclude_tags: Vec::new(), | ||
| lambda_durable_function_log_buffer_size: 0, | ||
| dsm_consume_enabled: false, | ||
| dsm_exchange_name: None, | ||
| dsm_kafka_group: None, | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -182,6 +202,18 @@ pub struct LambdaConfigSource { | |
| /// 0 (hold mechanism disabled). | ||
| #[serde(deserialize_with = "deser_opt_lossless")] | ||
| pub lambda_durable_function_log_buffer_size: Option<usize>, | ||
|
|
||
| /// `DD_DATA_STREAMS_ENABLED` — enable extension-side DSM consume | ||
| /// checkpoints. Shared with the tracer libraries; merges into the | ||
| /// `dsm_consume_enabled` config field. | ||
| #[serde(deserialize_with = "deser_opt_bool")] | ||
| pub data_streams_enabled: Option<bool>, | ||
| /// `DD_DSM_EXCHANGE_NAME` — fallback exchange name for `EventBridge` DSM checkpoints. | ||
| #[serde(deserialize_with = "deser_opt_str")] | ||
| pub dsm_exchange_name: Option<String>, | ||
| /// `DD_DSM_KAFKA_GROUP` — consumer group for MSK/Kafka DSM consume checkpoints. | ||
| #[serde(deserialize_with = "deser_opt_str")] | ||
| pub dsm_kafka_group: Option<String>, | ||
| } | ||
|
|
||
| impl DatadogConfigExtension for LambdaConfig { | ||
|
|
@@ -207,7 +239,16 @@ impl DatadogConfigExtension for LambdaConfig { | |
| api_security_sample_delay, | ||
| lambda_durable_function_log_buffer_size, | ||
| ], | ||
| option: [span_dedup_timeout, api_key_secret_reload_interval, appsec_rules], | ||
| option: [span_dedup_timeout, api_key_secret_reload_interval, appsec_rules, dsm_exchange_name, dsm_kafka_group], | ||
| ); | ||
|
|
||
| // data_streams_enabled (source / DD_DATA_STREAMS_ENABLED) → | ||
| // dsm_consume_enabled (config) | ||
| datadog_agent_config::merge_option_to_value!( | ||
| self, | ||
| dsm_consume_enabled, | ||
| source, | ||
| data_streams_enabled | ||
| ); | ||
|
|
||
| // OR-merge serverless_logs_enabled with the logs_enabled alias. Either | ||
|
|
@@ -503,6 +544,21 @@ mod lambda_config_tests { | |
| assert!(!config.ext.lambda_extension_compute_stats); | ||
| } | ||
|
|
||
| #[test] | ||
| fn dsm_consume_enabled_from_data_streams_env() { | ||
| let config = load(|jail| { | ||
| jail.set_env("DD_DATA_STREAMS_ENABLED", "true"); | ||
| Ok(()) | ||
| }); | ||
| assert!(config.ext.dsm_consume_enabled); | ||
| } | ||
|
|
||
| #[test] | ||
| fn dsm_consume_enabled_defaults_false() { | ||
| let config = load(|_| Ok(())); | ||
| assert!(!config.ext.dsm_consume_enabled); | ||
| } | ||
|
|
||
| // ---- Duration fields ---- | ||
|
|
||
| #[test] | ||
|
|
||
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.
nit, not a blocker. we lowercase the dsm service here. worth confirming this matches the tracer service normalization, otherwise the same service could show up twice in dsm (MyService vs myservice).