Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Implement config validation for access logs, and implement use of descriptors#500

Merged
ZackButcher merged 6 commits intoistio:masterfrom
ZackButcher:accesslogs
Apr 6, 2017
Merged

Implement config validation for access logs, and implement use of descriptors#500
ZackButcher merged 6 commits intoistio:masterfrom
ZackButcher:accesslogs

Conversation

@ZackButcher
Copy link
Copy Markdown
Contributor

@ZackButcher ZackButcher commented Mar 31, 2017

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 Reviewable

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

2 similar comments
@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

1 similar comment
@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2017

Codecov Report

Merging #500 into master will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
pkg/aspect/applicationLogsManager.go 98.14% <100%> (+0.01%) ⬆️
pkg/aspect/common.go 100% <100%> (ø) ⬆️
pkg/aspect/accessLogsManager.go 100% <100%> (+6.15%) ⬆️
pkg/config/manager.go 97.05% <0%> (-2.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb04cef...01c75af. Read the comment docs.

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

@ZackButcher
Copy link
Copy Markdown
Contributor Author

This PR also implements validation on log template param expressions and wires it up in both access and application logs.

Comment thread testdata/serviceconfig.yml Outdated
logName: "access_log"
log:
logFormat: 1 # COMMON
descriptorName: "common"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have used descriptor_name and descriptorName let's pick one.

Comment thread testdata/serviceconfig.yml Outdated
logName: "access_log"
log:
logFormat: 1 # COMMON
descriptorName: "common"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the keys again, and how it plays out with UX, descriptor_name is really logType

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread testdata/globalconfig.yml Outdated
expiration:
seconds: 1
logs:
- name: common
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the name accesslog.common and accesslog.combined
That we can retire the accessLog kind. Having descriptive names serves similar purpose.

@ZackButcher
Copy link
Copy Markdown
Contributor Author

PTAL

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

LogName: "combined_access_log",
Log: &aconfig.AccessLogsParams_AccessLog{
LogFormat: aconfig.COMBINED,
DescriptorName: "common",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

@ZackButcher
Copy link
Copy Markdown
Contributor Author

PTAL.

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

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
@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth commenting that this error will have been caught in validation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above desc two lines up covers both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! reading comprehension fail.

logName: access_log
log:
logFormat: 1 # COMMON
templateExpressions:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep the labels? i still think we want the structured logs, if possible -- even if the config is ugly as sin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add them back

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the descriptors now... do we need the labels section here too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@ZackButcher
Copy link
Copy Markdown
Contributor Author

PTAL

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job mixer/presubmit passed

@istio-testing
Copy link
Copy Markdown
Contributor

Jenkins job istio/mixer-pr-master passed

Copy link
Copy Markdown
Contributor

@douglas-reid douglas-reid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ZackButcher ZackButcher merged commit 3eb624c into istio:master Apr 6, 2017
@ZackButcher ZackButcher deleted the accesslogs branch April 6, 2017 17:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants