Otel declarative configuration#883
Conversation
sdk_disabled flag from the old flat structure is converted to new format from configuraiton SIG. defaults are read where the configuration is read. this is so a component can know the difference between a configuration key being defined as empty and being undefined. before the default was set for the key when configuration was read, meaning components could not distinguish between if the configuration was empty, undefined or set to the default by the user.
ferd
left a comment
There was a problem hiding this comment.
Yeah looking at this, the approach seems to make sense. There's some mess around the mapping of old to new rules when things were not read consistently with the new format, but I don't know that you can get around that.
The only thing I can imagine making it make more sense is carefully flagging (via comments) which is stuff that can go away on incompatible deprecation vs. what needs to stay in until final deprecation.
| append_if_not_found([], Existing) -> | ||
| Existing; | ||
| append_if_not_found([C | Rest], Existing) -> | ||
| case lists:member(C, Existing) of | ||
| true -> | ||
| append_if_not_found(Rest, Existing); | ||
| false -> | ||
| append_if_not_found(Rest, Existing ++ [C]) | ||
| end. |
There was a problem hiding this comment.
if we don't expect dupes in C, then this can be Existing ++ (C -- Existing) and preserve ordering.
| attribute_limits => attribute_limits(), | ||
| propagator := propagators(), | ||
| tracer_provider => tracer_provider() | ||
| }. |
There was a problem hiding this comment.
I do like having this more explicit split of internal/external config.
| convert_propagator( | ||
| convert_resource( | ||
| convert_attribute_limits( | ||
| convert_disabled(OldConfig, Config), Config), Config), Config), Config). |
There was a problem hiding this comment.
looks like a cool case of
lists:foldl(fun(F, OldC) -> F(OldC, Config) end,
OldConfig,
[fun convert_disabled/2,
fun convert_attribute_limits/2,
fun convert_resource/2,
fun convert_propagator/2,
fun convert_tracer_provider/2]).
| {event_count_limit, event_count_limit}, | ||
| {link_count_limit, link_count_limit}, | ||
| {attribute_per_event_limit, event_attribute_count_limit}, | ||
| {attribute_per_link_limit, link_attribute_count_limit}])}. |
There was a problem hiding this comment.
This is a good and interesting format. Making it recursive (with fold) is also nice because it lets you do multiple deprecation cycles so long as they're in order (convert from 0.4 to 0.6 to 0.7, etc.) and support all of them in the order they happen.
| BatchConfig1 = update_processor_config(BatchConfig, [{scheduled_delay_ms, schedule_delay}, | ||
| {exporting_timeout_ms, export_timeout} | ||
| %% {max_queue_size, max_queue_size}, | ||
| %% {max_export_batch_size}, |
There was a problem hiding this comment.
are these fully gone? I guess they're Erlang-specific?
There was a problem hiding this comment.
Na, they remain, this just should have been deleted instead of commented I think. Pretty sure the point here is just that those don't have to be renamed...
There was a problem hiding this comment.
Yea, bsp_max_queue_size from the sys.config is already converted to max_queue_size.
| %% that detector is now a no-op and its parsing is done here. The old supported option for | ||
| %% adding static resource attributes is combined with the new. Anything under the key | ||
| %% `attributes' is expected to be of the form `#{name := binary(), value := binary()}' while | ||
| %% every other key/value pair is assumed to be an attribute |
There was a problem hiding this comment.
oh yeah okay this bit of inconsistency creates some mess then.
|
Aside from the fact this is our 3rd iteration on file configuration I should also boil down where the inconsistency between our solution and the spec are with some psuedo code: Here is what it looks like based on the spec and how ever other language (I think) implements this without an issue of backwards compatibility: Basically, they already have functions like We however have no There may be no reason to not pass in the Pids of the span processors instead of the config of the span processors, but either way, it breaks those calls to Uh, so yea, a sort of mismatch with how we start everything at the leaves of a supervision tree and everyone else starts things iteratively, passing the created object to the thing that consumes it (new Processor, pass new Processor to new TracerProvider, etc). |
I can't figure out a good way to do this change. This is a mess. The issue is we already have file configuration, and worse, it is used layers deep (as in, things like span processors are passed configuration that is passed to tracer provider).
In this PR I have changed those components like span processor to work on structure similar to those in the otel declarative configuration. This isn't required but I felt that structure was better so wanted to use it. This means anyone calling those directory would have broken code. I could, and may, change it to convert the new config to match the old layout instead.
Previous configs people have are meant to continue working as this change will convert those to the new format. The issue there is we have to make a choice between which config we are using. So what it does is check if a key from the new config, like
tracer_provideris found and then assumes new config and ignores the old config values.As I said, a mess.
I'm opening this less to merge and more to discuss strategy.