@@ -21,7 +21,7 @@ use crate::config::service_mapping::deserialize_service_mapping;
2121
2222/// `FallbackConfig` is a struct that represents fields that are not supported in the extension yet.
2323///
24- /// `extension_version` is expected to be set to "next" to enable the optimized extension.
24+ /// If `extension_version` is set to "legacy", the Go extension will be launched .
2525#[ derive( Debug , PartialEq , Deserialize , Clone , Default ) ]
2626#[ serde( default ) ]
2727#[ allow( clippy:: module_name_repetitions) ]
@@ -142,17 +142,15 @@ fn fallback(figment: &Figment) -> Result<(), ConfigError> {
142142 }
143143 } ;
144144
145- let opted_in = match fallback_config. extension_version . as_deref ( ) {
146- Some ( "next" ) => true ,
147- // Only log when the field is present but its not "next"
148- Some ( _) => {
149- log_fallback_reason ( "extension_version" ) ;
150- false
151- }
145+ // Customer explicitly opted out of the Next Gen extension
146+ let opted_out = match fallback_config. extension_version . as_deref ( ) {
147+ Some ( "legacy" ) => true ,
148+ // We want customers using the `next` to not be affected
152149 _ => false ,
153150 } ;
154151
155- if !opted_in {
152+ if opted_out {
153+ log_fallback_reason ( "extension_version" ) ;
156154 return Err ( ConfigError :: UnsupportedField (
157155 "extension_version" . to_string ( ) ,
158156 ) ) ;
@@ -260,9 +258,10 @@ pub mod tests {
260258 use crate :: config:: processing_rule;
261259
262260 #[ test]
263- fn test_reject_without_opt_in ( ) {
261+ fn test_reject_on_opted_out ( ) {
264262 figment:: Jail :: expect_with ( |jail| {
265263 jail. clear_env ( ) ;
264+ jail. set_env ( "DD_EXTENSION_VERSION" , "legacy" ) ;
266265 let config = get_config ( Path :: new ( "" ) ) . expect_err ( "should reject unknown fields" ) ;
267266 assert_eq ! (
268267 config,
@@ -276,7 +275,6 @@ pub mod tests {
276275 fn test_fallback_on_otel ( ) {
277276 figment:: Jail :: expect_with ( |jail| {
278277 jail. clear_env ( ) ;
279- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
280278 jail. set_env (
281279 "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT" ,
282280 "localhost:4138" ,
@@ -292,7 +290,6 @@ pub mod tests {
292290 fn test_allowed_but_disabled ( ) {
293291 figment:: Jail :: expect_with ( |jail| {
294292 jail. clear_env ( ) ;
295- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
296293 jail. set_env ( "DD_SERVERLESS_APPSEC_ENABLED" , "true" ) ;
297294
298295 let config = get_config ( Path :: new ( "" ) ) . expect_err ( "should reject unknown fields" ) ;
@@ -312,7 +309,6 @@ pub mod tests {
312309 "datadog.yaml" ,
313310 r"
314311 site: datadoghq.eu,
315- extension_version: next
316312 " ,
317313 ) ?;
318314 jail. set_env ( "DD_SITE" , "datad0g.com" ) ;
@@ -343,7 +339,6 @@ pub mod tests {
343339 figment:: Jail :: expect_with ( |jail| {
344340 jail. clear_env ( ) ;
345341 jail. set_env ( "DD_SITE" , "datadoghq.eu" ) ;
346- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
347342 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
348343 assert_eq ! ( config. site, "datadoghq.eu" ) ;
349344 Ok ( ( ) )
@@ -355,7 +350,6 @@ pub mod tests {
355350 figment:: Jail :: expect_with ( |jail| {
356351 jail. clear_env ( ) ;
357352 jail. set_env ( "DD_LOG_LEVEL" , "TRACE" ) ;
358- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
359353 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
360354 assert_eq ! ( config. log_level, LogLevel :: Trace ) ;
361355 Ok ( ( ) )
@@ -366,7 +360,6 @@ pub mod tests {
366360 fn test_parse_default ( ) {
367361 figment:: Jail :: expect_with ( |jail| {
368362 jail. clear_env ( ) ;
369- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
370363 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
371364 assert_eq ! (
372365 config,
@@ -388,7 +381,6 @@ pub mod tests {
388381 figment:: Jail :: expect_with ( |jail| {
389382 jail. clear_env ( ) ;
390383 jail. set_env ( "DD_SERVERLESS_FLUSH_STRATEGY" , "end" ) ;
391- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
392384 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
393385 assert_eq ! ( config. serverless_flush_strategy, FlushStrategy :: End ) ;
394386 Ok ( ( ) )
@@ -400,7 +392,6 @@ pub mod tests {
400392 figment:: Jail :: expect_with ( |jail| {
401393 jail. clear_env ( ) ;
402394 jail. set_env ( "DD_SERVERLESS_FLUSH_STRATEGY" , "periodically,100000" ) ;
403- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
404395 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
405396 assert_eq ! (
406397 config. serverless_flush_strategy,
@@ -415,7 +406,6 @@ pub mod tests {
415406 figment:: Jail :: expect_with ( |jail| {
416407 jail. clear_env ( ) ;
417408 jail. set_env ( "DD_SERVERLESS_FLUSH_STRATEGY" , "invalid_strategy" ) ;
418- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
419409 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
420410 assert_eq ! ( config. serverless_flush_strategy, FlushStrategy :: Default ) ;
421411 Ok ( ( ) )
@@ -430,7 +420,6 @@ pub mod tests {
430420 "DD_SERVERLESS_FLUSH_STRATEGY" ,
431421 "periodically,invalid_interval" ,
432422 ) ;
433- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
434423 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
435424 assert_eq ! ( config. serverless_flush_strategy, FlushStrategy :: Default ) ;
436425 Ok ( ( ) )
@@ -456,7 +445,6 @@ pub mod tests {
456445 pattern: exclude-me-yaml
457446 " ,
458447 ) ?;
459- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
460448 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
461449 assert_eq ! (
462450 config. logs_config_processing_rules,
@@ -478,7 +466,6 @@ pub mod tests {
478466 jail. create_file (
479467 "datadog.yaml" ,
480468 r"
481- extension_version: next
482469 site: datadoghq.com
483470 logs_config:
484471 processing_rules:
@@ -529,7 +516,6 @@ pub mod tests {
529516 figment:: Jail :: expect_with ( |jail| {
530517 jail. clear_env ( ) ;
531518 jail. set_env ( "DD_TRACE_PROPAGATION_STYLE_EXTRACT" , "datadog" ) ;
532- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
533519 let config = get_config ( Path :: new ( "" ) ) . expect ( "should parse config" ) ;
534520
535521 assert_eq ! (
@@ -555,7 +541,6 @@ pub mod tests {
555541 "DD_APM_REPLACE_TAGS" ,
556542 r#"[{"name":"resource.name","pattern":"(.*)/(foo[:%].+)","repl":"$1/{foo}"}]"# ,
557543 ) ;
558- jail. set_env ( "DD_EXTENSION_VERSION" , "next" ) ;
559544 let config = get_config ( Path :: new ( "" ) ) ;
560545 assert ! ( config. is_ok( ) ) ;
561546 Ok ( ( ) )
0 commit comments