-
Notifications
You must be signed in to change notification settings - Fork 665
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
Add envoy-json-logging-custom-fields-design doc #3042
Add envoy-json-logging-custom-fields-design doc #3042
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3042 +/- ##
==========================================
- Coverage 73.35% 73.22% -0.14%
==========================================
Files 95 95
Lines 6046 6057 +11
==========================================
Hits 4435 4435
- Misses 1510 1521 +11
Partials 101 101
|
- This is related to [#2523](https://github.com/projectcontour/contour/issues/2523) | ||
* Is one of the alternative approaches preferable? | ||
- [User-defined Translation Table](#user-defined-translation-table) seems easier to implement because it was partially implemented in #3033 and because the configuration is more structured and easier to work with as there no need for additional string parsing. | ||
- [Map Syntax](#map-syntax) is not backward-compatible, but does avoid string parsing. |
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.
Map syntax seems clean, but we would need to introduce it in a new config field, then deprecate the old field after a number of releases. Would still need to define what happens to the built-in field mappings.
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.
Yea, since the map syntax would require deprecating the prior configuration field anyway, the new field would not have to support the built-in field mappings. In our example in this doc, we assumed that empty values would imply that the key should be looked up in the built-in field mappings, but I'm not sure whether that's desirable or not.
In favor of a built-in translation table:
- Users of Contour only have to read Contour's docs (vs. also referencing Envoy's config syntax).
- Users get reasonable, standardized field names because that's what's setup by the field mappings.
In favor of writing all key-value pairs out:
- Users of Contour can read the Envoy docs to decide what config to write. They don't need to know Contour's specific translation of special keys.
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 ease of use of having the translation table, personally. I think that having the two types seems like an okay tradeoff for that ease of use (for now at least).
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.
This looks good to me. I'll give other maintainers a chance to review before I merge though.
- In the current implementation, `method` becomes `"method": "%REQ(:METHOD)%"`. | ||
- When the new implementation adds a way to achieve the JSON config `"response_duration": "%RESPONSE_DURATION%"`, should the user write: | ||
* `response_duration`, or | ||
* `response_durationn=%RESPONSE_DURATION%` |
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.
The built-in mappings still need to be supported. I would not want to force people using the existing field mappings to manually remake their configuration.
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.
We agree that built-in mappings need to be supported. The question here is whether fields that could be added to those mappings should be.
method
will still work.- should
response_duration
work?
If response_duration
works, then the interface is consistent, but the implication is that the translation table will be used forever (despite users having a way to write response_duration
without the translation table).
If response_duration=%RESPONSE_DURATION%
is the only option for users, then there is inconsistency between the original set that are in the translations and the new ones that require more spelling out.
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.
The original intent was that we add simple translations as required to the translation table; we figured that people could just request anything they needed added. With that in mind, I'm okay with adding whatever simple translations to the translation table (like response_duration
, where it's a straight mapping between field name and Envoy template string), as part of this implementation.
Obviously, this will be frozen at this point in time, but perhaps a comment saying that adding things to the standard translations is fine would make it clearer that we're open to adding more?
|
||
#### Unknown field name in old format | ||
|
||
If the field name is not defined in the default fields transition map and the user doesn't specify the Envoy field format, then Contour will raise a validation error. |
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.
See #3023 for config file validation.
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.
This proposal LGTM, I think it's a good balance between adding extra functionality and backward compatibility. Thanks for writing it up @mike1808 and @astrieanna!
921cec7
to
43602ae
Compare
Co-authored-by: Leah Hanson <lhanson@pivotal.io> Co-authored-by: Mikael Manukyan <mmanukyan@vmware.com> Signed-off-by: Mikael Manukyan <mmanukyan@vmware.com>
Co-authored-by: Leah Hanson <lhanson@pivotal.io> Signed-off-by: Mikael Manukyan <mmanukyan@vmware.com>
43602ae
to
1b6c9ec
Compare
|
||
#### Field name is repeated | ||
|
||
If the field name is repeated the last entry in the configuration takes precedes and overwrites the previous value. |
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.
Wonder if this should raise a validation error instead of overwriting?
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.
A validation error could be OK if a field name is repeated in a single json-fields
array. My original intention with suggesting overwriting was that operators should be able to use this mechanism to change the definition of builtin log fields (ie. overwriting the builtin field mapping).
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!
Last call for comments. |
@@ -0,0 +1,144 @@ | |||
# Allow Envoy to output arbitrary fields for JSON logs | |||
|
|||
Status: Draft |
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.
If there are no further comments, @mike1808, could you change this to 'Accepted' before we merge?
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.
Done @youngnick
Co-authored-by: Mikael Manukyan <mmanukyan@vmware.com>
Okay, I'm calling this one done. Thanks @mike1808 and @astrieanna! |
Co-authored-by: Leah Hanson lhanson@pivotal.io
In continuation of #3032 we're making a design doc to discuss possible solutions for our problem.