-
Notifications
You must be signed in to change notification settings - Fork 42
Remove '$' from field syntax #364
Remove '$' from field syntax #364
Conversation
Codecov Report
|
@jsirianni, @pmm-sumo, @rockb1017, please take a look. Any reservations on this approach? |
@dmitryax please have a look. Will our helm chart be affected by this change? |
The change looks good to me. The syntax becomes clearer. I do not see any downsides to this change, are there any? |
This is a large set of changes, I agree it improves the syntax actually. I asked @pmalek-sumo for another look as well (he was commenting on the issue) |
I don't see any downsides either. |
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.
I like the idea of making it more explicit and easier to reason about.
🚀 some nits in .md
tables
It will be affected, but we can adopt for this change. I like the proposal. The syntax seems cleaner now |
8429bc4
to
d5013f8
Compare
Also allow for deprecated '$body' and '$' syntax
d5013f8
to
3f42492
Compare
The contrib test failures are expected due to them using fields that are implicitly body fields. |
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.
LGTM, but shouldn't we throw deprecation warnings in logs?
Unfortunately, there's not a great way to complain about the deprecated usage because it is processed during unmarshaling, where we don't have a handle to a logger. We could add a flag to the Another option is to fully remove support, but to detect the old syntax and return a clear error. This forces migration immediately, but at least would not be ambiguous at all. |
Maybe we can drop the old interface support here but do all the necessary translation from the deprecated format in the collector-contrib? There we can throw all the warnings during the translation. |
Unfortunately, I don't think unmarshaling in collector-contrib gives us a better opportunity to do this. |
@dmitryax, can you clarify whether you see the lack of deprecation warning as a blocker? I do not see a good way to log warnings here or at the collector level, so I would prefer to either error or quietly support the old syntax. |
What if we return an error of a |
I liked this idea and gave it a shot, but unfortunately, the |
I see, if it's not possible to show a warning, I don't think silently support both versions is useful. Changing the interface right away seems to be a better option then. |
* Remove '$' from field syntax * Enforce rule that body fields must start with 'body'
This is a possible resolution to #164. This would be a major breaking change, so if accepted, the timing of a merge should be considered carefully.
This library has a construct called 'field', which has the
purpose of providing a concise way to refer to values in a
log record. The special symbol
$
has been used in keywords that refer to top level fields in the log record.
i.e.
$body
,$attributes
,$resource
Additionally, some shorthand notion was supported. Notably,
$.foo
and.foo
were equivalent to$body.foo
.This change proposes to remove the usage of
$
in field syntax.The main idea here is that all usages of field syntax MUST
begin with a key word i.e.
body
,attributes
,resource
.With this requirement built in, there is no need to differentiate
between top level fields and arbitrary keys. The distinction is
implicit because the first word is always a top level field and
the remainder are arbitrary nested keys.