Skip to content

Proposal: unix-sockets support in Fluentd logging driver#26088

Merged
thaJeztah merged 1 commit intomoby:masterfrom
akirakoyasu:patch-fluent-unixsocket
Nov 9, 2016
Merged

Proposal: unix-sockets support in Fluentd logging driver#26088
thaJeztah merged 1 commit intomoby:masterfrom
akirakoyasu:patch-fluent-unixsocket

Conversation

@akirakoyasu
Copy link
Copy Markdown
Contributor

- What I did
add unix-sockets support in Fluentd logging driver

- How I did it
add handling scheme in parsing address

- How to verify it
cases below OK

  • fluentd-address=somehost:port
  • fluentd-address=tcp://somehost:port
  • fluentd-address=unix:///path/to/somesocket.sock

- Description for the changelog
Fluentd logging driver supports unix sockets

- A picture of a cute animal (not mandatory but encouraged)
31356338_624

@akirakoyasu akirakoyasu changed the title unix-sockets support in Fluentd logging driver Proposal: unix-sockets support in Fluentd logging driver Sep 6, 2016
@akirakoyasu
Copy link
Copy Markdown
Contributor Author

@justincormack
Could you tell me what I have to do next?
Just waiting??

@thaJeztah
Copy link
Copy Markdown
Member

ping @justincormack @tagomoris ptal

@tagomoris
Copy link
Copy Markdown
Contributor

The feature looks good to me.
But variable name network for "tcp", "udp" or "unix" looks very curious for me. IMO there are some better options, e.g., schema, transport or protocol.

@thaJeztah
Copy link
Copy Markdown
Member

design LGTM, so moving to code review. I agree with @tagomoris that the variable name should be renamed

@thaJeztah
Copy link
Copy Markdown
Member

ping @akirakoyasu can you update the PR to rename that variable? Let me know if you need suggestions

@akirakoyasu akirakoyasu force-pushed the patch-fluent-unixsocket branch from 6cb90f8 to bef5e1f Compare October 23, 2016 13:23
@akirakoyasu
Copy link
Copy Markdown
Contributor Author

akirakoyasu commented Oct 23, 2016

@thaJeztah yes, I renamed the variable; network -> protocol (in bef5e1f)
and rebased to the latest master because my base is 2 months old.

@thaJeztah
Copy link
Copy Markdown
Member

Test failures are not related, looks like Docker Hub search has/had issues

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we should do a refactor of this function at some point, because it's now getting too many output variables. Probably a lot cleaner to return a type

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 24, 2016
@akirakoyasu akirakoyasu force-pushed the patch-fluent-unixsocket branch from 1a1a05d to 5ccd091 Compare October 24, 2016 15:29
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 24, 2016
@akirakoyasu
Copy link
Copy Markdown
Contributor Author

akirakoyasu commented Oct 24, 2016

@thaJeztah
defined a new type location. How do you think?

@akirakoyasu
Copy link
Copy Markdown
Contributor Author

@GordonTheTurtle I'm sorry, missing sign. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be helpful to use errors.Wrapf instead of fmt.Errorf here.

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.

thanks for comment. using it.

@cpuguy83
Copy link
Copy Markdown
Member

Minor comment, otherwise LGTM.

@thaJeztah
Copy link
Copy Markdown
Member

also, @akirakoyasu can you squash your commits, so that there's a single commit in the PR?

Signed-off-by: Akira Koyasu <mail@akirakoyasu.net>

- add scheme to fluentd-address
- define a new type `location`
- use `errors.Wrapf`
@akirakoyasu akirakoyasu force-pushed the patch-fluent-unixsocket branch from 5ccd091 to cb176c8 Compare October 25, 2016 18:48
@akirakoyasu
Copy link
Copy Markdown
Contributor Author

@thaJeztah yes, squash done.

@thaJeztah thaJeztah added this to the 1.13.0 milestone Oct 26, 2016
@MHBauer
Copy link
Copy Markdown
Contributor

MHBauer commented Oct 31, 2016

code looks good. Do we need a followup change to https://github.com/docker/docker.github.io/blob/master/engine/admin/logging/fluentd.md ? Existing doc doesn't really discuss the host format or any restrictions.
Different repo. Not sure what the new policy is.

@akirakoyasu
Copy link
Copy Markdown
Contributor Author

akirakoyasu commented Nov 2, 2016

@MHBauer
May I open an issue in the repo for discuss it?


host, port, err := net.SplitHostPort(address)
if err != nil {
if !strings.Contains(err.Error(), "missing port in address") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How come we are checking the string on this error?
Worst case we can check for AddrError, but even so any error here would be an invalid address would it not?

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.

This code is for the default port.

I don't like this such as string check too, but an effort for parsing address by ourselves is not so suitable, I think.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But why would it only be checking for missing port in address vs the whole thing being messed up?
To me, if we get an error here, shouldn't that always be returned?

return nil, errors.Wrapf(err, "invalid fluentd-address %s", givenAddress)
}
return host, portnum, nil
return &location{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this new type?
Return proto, host, port, err.
If proto == unix, then host == socket path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggested to change, because the initial implementation was having 5 output variables #26088 (comment), but perhaps we can reduce that some other ways, agreed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@akirakoyasu can you update with @cpuguy83's suggestion? Sorry for going back and forth

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can deal with the extra type.

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

this will also need documentation changes to mention the supported options in https://docs.docker.com/engine/admin/logging/fluentd/#/fluentd-address

@akirakoyasu can you open a pull request in the vnext-engine branch in the documentation repository? The file for that part of the documentation can be found here; https://github.com/docker/docker.github.io/blob/vnext-engine/engine/admin/logging/fluentd.md

@akirakoyasu
Copy link
Copy Markdown
Contributor Author

@thaJeztah
yes, I opened docker/docs#558

@akirakoyasu akirakoyasu deleted the patch-fluent-unixsocket branch November 12, 2016 17:27
@vdemeester
Copy link
Copy Markdown
Member

Removing docs/revisit as docker/docs#558 is merged 👼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants