Implement config validation for access logs, and implement use of descriptors#500
Implement config validation for access logs, and implement use of descriptors#500ZackButcher merged 6 commits intoistio:masterfrom
Conversation
|
Jenkins job mixer/presubmit passed |
2 similar comments
|
Jenkins job mixer/presubmit passed |
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
1 similar comment
|
Jenkins job istio/mixer-pr-master passed |
Codecov Report
@@ Coverage Diff @@
## master #500 +/- ##
=========================================
+ Coverage 88.32% 88.4% +0.08%
=========================================
Files 56 56
Lines 3049 3053 +4
=========================================
+ Hits 2693 2699 +6
+ Misses 312 310 -2
Partials 44 44
Continue to review full report at Codecov.
|
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
|
This PR also implements validation on log template param expressions and wires it up in both access and application logs. |
| logName: "access_log" | ||
| log: | ||
| logFormat: 1 # COMMON | ||
| descriptorName: "common" |
There was a problem hiding this comment.
we have used descriptor_name and descriptorName let's pick one.
| logName: "access_log" | ||
| log: | ||
| logFormat: 1 # COMMON | ||
| descriptorName: "common" |
There was a problem hiding this comment.
looking at the keys again, and how it plays out with UX, descriptor_name is really logType
There was a problem hiding this comment.
descriptor_name is consistent with all the other aspects (including application logs). I think it'd be pretty odd to make this one aspect different.
| expiration: | ||
| seconds: 1 | ||
| logs: | ||
| - name: common |
There was a problem hiding this comment.
Let's make the name accesslog.common and accesslog.combined
That we can retire the accessLog kind. Having descriptive names serves similar purpose.
|
PTAL |
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
| LogName: "combined_access_log", | ||
| Log: &aconfig.AccessLogsParams_AccessLog{ | ||
| LogFormat: aconfig.COMBINED, | ||
| DescriptorName: "common", |
There was a problem hiding this comment.
Since common log and combined log are known log formats, can we add a test that ensures that our packaged default descriptors actually produce the correct log entries?
We should also agree on a mechanism to provide default descriptors. I think mixer config manager with packaged default set of descriptors as yml files. (like we have in testdata/ is a reasonable start)
There was a problem hiding this comment.
I was chatting with Doug about this (and more generally how we've been going round and round on this) and we came to the same conclusion: we'll have to figure out some way to package an always-available istio-global-config with things like these descriptors, the common metric descriptors, and so on. I'm actually not opposed to it being static protos that we compile into the binary (speaking of going round-and-round).
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
|
PTAL. |
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
…t natural to remove the log_format enum from the access log config: it adds substantial special logic if we 'know' about certain descriptors automagically, so I've removed the special casing around apache common/combined access logs. As a result, once again, access logs and application logs are essentially the same.
…ly valid and that the attributes exist in the system to satisfy their expressions. Wire this into both application and access logs managers
… of the access log descriptors
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
| } | ||
| // validation ensures both that the descriptor exists and that its template is parsable by the template library. | ||
| desc := df.GetLog(cfg.Log.DescriptorName) | ||
| tmpl, _ := template.New("accessLogsTemplate").Parse(desc.LogTemplate) |
There was a problem hiding this comment.
worth commenting that this error will have been caught in validation?
There was a problem hiding this comment.
The comment above desc two lines up covers both.
There was a problem hiding this comment.
doh! reading comprehension fail.
| logName: access_log | ||
| log: | ||
| logFormat: 1 # COMMON | ||
| templateExpressions: |
There was a problem hiding this comment.
can we keep the labels? i still think we want the structured logs, if possible -- even if the config is ugly as sin.
There was a problem hiding this comment.
I'll add them back
There was a problem hiding this comment.
I see the descriptors now... do we need the labels section here too?
There was a problem hiding this comment.
It's there, the github diff doesn't render it cause it's unchanged from before. If you expand the file down you should see the labels.
There was a problem hiding this comment.
Oh and make sure you're looking at the latest pushed commit; if you click on the file name here it goes to the commit that you commented on, not the latest thing I pushed (tricked me at first too).
…ng error in the errors returned by common validation code in common.go
|
PTAL |
|
Jenkins job mixer/presubmit passed |
|
Jenkins job istio/mixer-pr-master passed |
douglas-reid
left a comment
There was a problem hiding this comment.
LGTM. My concerns have been addressed.
I think this highlights some issues with config as it exists currently, but this seems to preserve behavior while making things more explicit and configurable.
We implement config validation. At the same time we update the access log manager to use descriptors. This update makes it natural to remove the log_format enum from the access log config: it adds substantial special logic if we 'know' about certain descriptors automagically, so I've removed the special casing around apache common/combined access logs. As a result, once again, access logs and application logs are essentially the same.
This change is