|
28 | 28 | %% required configuration |
29 | 29 | %% using a map instead of a record because there can be more values |
30 | 30 | -type t() :: #{log_level := atom(), |
31 | | - register_loaded_applications := boolean(), |
| 31 | + register_loaded_applications := boolean() | undefined, |
| 32 | + create_application_tracers := boolean() | undefined, |
32 | 33 | id_generator := module(), |
33 | 34 | deny_list := [atom()], |
34 | 35 | resource_detectors => [module()], |
|
51 | 52 | -spec new() -> t(). |
52 | 53 | new() -> |
53 | 54 | #{log_level => info, |
54 | | - register_loaded_applications => true, |
| 55 | + register_loaded_applications => undefined, |
| 56 | + create_application_tracers => undefined, |
55 | 57 | id_generator => otel_id_generator, |
56 | 58 | deny_list => [], |
57 | 59 | resource_detectors => [otel_resource_env_var, |
@@ -93,7 +95,26 @@ span_limits(AppEnv, ConfigMap) -> |
93 | 95 |
|
94 | 96 | -spec general(list(), t()) -> t(). |
95 | 97 | general(AppEnv, ConfigMap) -> |
96 | | - merge_list_with_environment(config_mappings(general_sdk), AppEnv, ConfigMap). |
| 98 | + Config = merge_list_with_environment(config_mappings(general_sdk), AppEnv, ConfigMap), |
| 99 | + |
| 100 | + %% merge the old `register_loaded_applications' with the new config key |
| 101 | + %% `create_application_tracers' that has replaced it |
| 102 | + Config1 = maps:update_with(create_application_tracers, |
| 103 | + fun(undefined) -> |
| 104 | + %% `create_application_tracers' isn't set so update |
| 105 | + %% with the `register_loaded_applications' value |
| 106 | + %% or `true' if it too isn't set |
| 107 | + case maps:get(register_loaded_applications, Config) of |
| 108 | + undefined -> |
| 109 | + true; |
| 110 | + Bool -> |
| 111 | + Bool |
| 112 | + end; |
| 113 | + (Bool) -> |
| 114 | + Bool |
| 115 | + end, Config), |
| 116 | + |
| 117 | + Config1. |
97 | 118 |
|
98 | 119 | -spec sweeper(list(), t()) -> t(). |
99 | 120 | sweeper(AppEnv, ConfigMap=#{sweeper := DefaultSweeperConfig}) -> |
@@ -231,13 +252,17 @@ report_cb(#{source := transform, |
231 | 252 |
|
232 | 253 | config_mappings(general_sdk) -> |
233 | 254 | [{"OTEL_LOG_LEVEL", log_level, existing_atom}, |
| 255 | + |
| 256 | + %% `register_loaded_applications' is kept for backwards compatibility |
234 | 257 | {"OTEL_REGISTER_LOADED_APPLICATIONS", register_loaded_applications, boolean}, |
| 258 | + {"OTEL_CREATE_APPLICATION_TRACERS", create_application_tracers, boolean}, |
| 259 | + |
235 | 260 | {"OTEL_ID_GENERATOR", id_generator, existing_atom}, |
236 | | - {"OTEL_DENY_LIST", deny_list, list}, |
| 261 | + {"OTEL_DENY_LIST", deny_list, existing_atom_list}, |
237 | 262 | {"OTEL_PROPAGATORS", text_map_propagators, propagators}, |
238 | 263 | {"OTEL_TRACES_EXPORTER", traces_exporter, exporter}, |
239 | 264 | {"OTEL_METRICS_EXPORTER", metrics_exporter, exporter}, |
240 | | - {"OTEL_RESOURCE_DETECTORS", resource_detectors, kvlist_value}, |
| 265 | + {"OTEL_RESOURCE_DETECTORS", resource_detectors, existing_atom_list}, |
241 | 266 | {"OTEL_RESOURCE_DETECTOR_TIMEOUT", resource_detector_timeout, integer}]; |
242 | 267 | config_mappings(otel_batch_processor) -> |
243 | 268 | [{"OTEL_BSP_SCHEDULE_DELAY_MILLIS", scheduled_delay_ms, integer}, |
@@ -269,6 +294,19 @@ config_mappings(_) -> |
269 | 294 |
|
270 | 295 | transform(_, undefined) -> |
271 | 296 | undefined; |
| 297 | +transform(existing_atom_list, [A | _]=List) when is_atom(A) -> |
| 298 | + List; |
| 299 | +transform(existing_atom_list, String) when is_list(String) -> |
| 300 | + List = string:split(String, ",", all), |
| 301 | + lists:filtermap(fun(A) -> |
| 302 | + try transform(existing_atom, string:trim(A)) of |
| 303 | + Value -> |
| 304 | + {true, Value} |
| 305 | + catch |
| 306 | + _:_ -> |
| 307 | + false |
| 308 | + end |
| 309 | + end, List); |
272 | 310 | transform(exporter, "otlp") -> |
273 | 311 | {opentelemetry_exporter, #{}}; |
274 | 312 | transform(exporter, "jaeger") -> |
@@ -333,7 +371,7 @@ transform(sampler, {"parentbased_traceidratio", Probability}) -> |
333 | 371 | transform(sampler, Value) -> |
334 | 372 | Value; |
335 | 373 | transform(key_value_list, Value) when is_list(Value) -> |
336 | | - case io_lib:printable_list(Value) of |
| 374 | + case io_lib:printable_unicode_list(Value) of |
337 | 375 | true -> |
338 | 376 | Pairs = string:split(Value, ",", all), |
339 | 377 | lists:filtermap(fun(Pair) -> |
|
0 commit comments