-
Notifications
You must be signed in to change notification settings - Fork 8k
Add mixer adapter for Fluentd #2423
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
Conversation
Hi @jeffmendoza. Thanks for your PR. I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This is cool!! Thanks for the contribution.. |
Very nice contribution....thanks! |
Codecov Report
@@ Coverage Diff @@
## master #2423 +/- ##
=========================================
Coverage ? 76.35%
=========================================
Files ? 218
Lines ? 19453
Branches ? 0
=========================================
Hits ? 14853
Misses ? 3786
Partials ? 814
Continue to review full report at Codecov.
|
952a501
to
2a7194b
Compare
/assign @douglas-reid |
@jeffmendoza PR needs rebase |
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.
Looks pretty good. Thanks for tackling. Left a few nits, mostly around comments.
option (gogoproto.equal_all) = false; | ||
option (gogoproto.gostring_all) = false; | ||
|
||
message Params { |
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.
Nit: Let's add some comments here on what the fluentd adapter is for and how one might use it. Currently, this is the source of generated website documentation (a la: https://istio.io/docs/reference/config/mixer/adapters/kubernetes.html). It'd be nice to have some verbose presentation of this adapter in the Reference section.
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
mixer/adapter/inventory.yaml
Outdated
@@ -10,3 +10,4 @@ servicecontrol: "istio.io/istio/mixer/adapter/servicecontrol" | |||
stackdriver: "istio.io/istio/mixer/adapter/stackdriver" | |||
statsd: "istio.io/istio/mixer/adapter/statsd" | |||
stdio: "istio.io/istio/mixer/adapter/stdio" | |||
fluentd: "istio.io/istio/mixer/adapter/fluentd" |
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.
question: what do you think about maintaining alphabetical ordering of this inventory?
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 it. Done
mixer/adapter/fluentd/fluentd.go
Outdated
|
||
//go:generate $GOPATH/src/istio.io/istio/bin/mixer_codegen.sh -f mixer/adapter/fluentd/config/config.proto | ||
|
||
package fluentd |
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.
nit: similar to above, can you add a Package-level comment here explaining the role of the adapter, how it is used, and what templates it implements?
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
mixer/adapter/fluentd/fluentd.go
Outdated
delete(i.Variables, "tag") | ||
} | ||
|
||
err := h.logger.PostWithTime(tag.(string), i.Timestamp, i.Variables) |
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.
nit: collapse the following line, via something like:
if err := h.logger.PostWithTime(...); err != nil {
return err
}
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
mixer/adapter/fluentd/fluentd.go
Outdated
}, | ||
NewBuilder: func() adapter.HandlerBuilder { return &builder{} }, | ||
DefaultConfig: &config.Params{ | ||
Address: "localhost:24224", |
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.
should we move this up into a const and make it more obvious as to the default 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.
Done
|
||
message Params { | ||
// Address that fluentd is listening, ex: 1.2.3.4:24224 | ||
string address = 1; |
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.
please add a comment about the default value assumed by code.
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
} | ||
|
||
for i, c := range cases { | ||
t.Run(strconv.Itoa(i), func(t *testing.T) { |
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.
why not just name the tests for the Address being provided? then, upon failure, I know what the input was precisely.
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.
Sounds good, let me figure this 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.
Done
} | ||
|
||
for i, c := range cases { | ||
t.Run(strconv.Itoa(i), func(t *testing.T) { |
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.
as above, let's give these things reasonable names. the cases are complex enough that a readable name for each case would help others debug a bit.
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
mixer/testdata/config/fluentd.yaml
Outdated
spec: | ||
match: "true" # match for all requests | ||
actions: | ||
- handler: fdhandler.fluentd |
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.
at some point, we considered a convention of just 'handler.*' for handlers (in the case where there would only be one). not sure on the current state of that, but it may be worth considering.
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
mixer/testdata/config/fluentd.yaml
Outdated
name: fdhandler | ||
namespace: istio-system | ||
spec: | ||
address: "localhost:24224" |
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 is the default address, right?
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.
Yes, I'd like to have is here in the test configs incase someone wants to copy it
5b40ef9
to
115896d
Compare
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 is awesome! Can't wait to try it out.
/lgtm |
/lgtm cancel //PR changed after LGTM, removing LGTM. @douglas-reid @jeffmendoza |
/retest |
@jeffmendoza: you can't request testing unless you are a istio member. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
/lgtm cancel //PR changed after LGTM, removing LGTM. @douglas-reid @jeffmendoza |
3d4d7a7
to
fc1c1e1
Compare
Rebased again, keep getting merge conflicts as HEAD gets Gopkg.lock changes. |
Supports logentry types. Connects to a listening fluentd daemon. Only config is the address of fluentd. Uses the "Name" of the logentry as the fluentd "tag", unless the logentry has a variable "tag". Adds a dependency on the "github.com/fluent/fluent-logger-golang/fluent" library.
fc1c1e1
to
4bb4cc7
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: douglas-reid The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Supports logentry types and forwards on to a listening Fluentd daemon. Uses the forward input plugin on Fluentd. Uses the
github.com/fluent/fluent-logger-golang/fluent
client.Screenshot of viewing logs in Kibana via Elasticsearch:
