Skip to content
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

Move Clamp away from Agent, Remove Subcommands and Clean CLI #3872

Closed
wants to merge 1 commit into from

Conversation

jsvd
Copy link
Member

@jsvd jsvd commented Sep 4, 2015

  • move all cli parsing to Runner, freeing Agent to solely manage pipelines
  • remove all subcommands, focusing on the "agent" behaviour
  • ensure logging goes through Cabin as much as possible
  • log fatal messages to terminal even --log is enabled
  • Agent now starts empty, and 1 pipeline is added and started afterwards
  • for now it Agent only supports 1 pipeline, but will easily support more than 1
  • remove doc generation subcommand from bin/logstash
  • adds "-i irb/pry" flag for interactive shell

Depends on jordansissel/ruby-cabin#37

@guyboertje
Copy link
Contributor

This breaks my PR on agent for default filter_workers :-)

:attribute_name => :log_file

# Old support for the '-v' flag'
option "-v", :flag,
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this still? we can remove this since we support --debug. Than we can get rid of -V and call it -v for version like all other systems do. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm open to that, though it may be surprising to users. If anything, I'd prefer that -v went away and did not change to report the version - mostly to avoid surprising users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Historically -v has been used to increase log verbosity, so its mostly an advanced user functionality. I would argue that replacing it with version output wouldn't surprise them. Maybe they have already migrated to --debug. All in all -v is a no-side-affect action, and folks wouldn't have used this in scripts so its less dangerous :)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for -v to return version

@jsvd
Copy link
Member Author

jsvd commented Sep 4, 2015

@guyboertje I'll likely lose the race on master, so I'll adapt this, don't worry :D

@@ -30,95 +85,245 @@ def main(args)
# Print a warning to STDERR for bad java versions
LogStash::Util::JavaVersion.warn_on_bad_java_version

Stud::untrap("INT", @startup_interruption_trap)
if version?
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be awesome if this function was broken up into smaller ones

show_version
configure
return start_shell(@ruby_shell, binding) if @ruby_shell
check_config_present
...

etc. would be a nice small way to clean this up. Not sure if you're the original author here or not. If it's just copy/paste don't worry about it.

@andrewvc
Copy link
Contributor

andrewvc commented Nov 9, 2015

On the whole this looks very good. Thanks for the work @jsvd

I would have preferred that we not deprecate commands unless strictly necessary, but then again, times change.

LGTM.

@jsvd
Copy link
Member Author

jsvd commented Nov 12, 2015

@andrewvc I have updated this to ensure bwc with the bin/logstash [irb/pry]

@andrewvc
Copy link
Contributor

@jsvd awesome :) I think our users will appreciate it! 👍

fail(I18n.t("logstash.agent.configuration.plugin_path_missing", :path => path)) unless File.directory?(path)
LogStash::Environment.add_plugin_path(path)
end
def shutdown_pipelines
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have two shutdown methods? (shutdown and shutdown_pipelines)

The shutdown method and the hook was added to fix an issue with the test see
#4024

@ph
Copy link
Contributor

ph commented Nov 13, 2015

LGTM! really minor comments.

@andrewvc andrewvc mentioned this pull request Nov 16, 2015
@andrewvc andrewvc mentioned this pull request Nov 24, 2015
@andrewvc
Copy link
Contributor

@jsvd what do we need to do to move this into master? I'd love to merge #4194 in as well as follow up with my work on #4254

@jsvd
Copy link
Member Author

jsvd commented Nov 25, 2015

@andrewvc just rebasing against master/2.x, will do this today

[edit] actually only against master unless there's a good reason to do it also for 2.x, thoughts @andrewvc ?

@jsvd jsvd force-pushed the refactor_agent branch 2 times, most recently from d9368ca to 7093d5e Compare November 25, 2015 11:58
* move cli argument handling from agent to runner
* add a short-help message
* add interactive shell option
* log fatal messages to terminal when logging to file
* change docs:generate task to use bundle exec
@elasticsearch-bot
Copy link

João Duarte merged this into the following branches!

Branch Commits
master 00a99c1

@jsvd jsvd closed this in 00a99c1 Nov 25, 2015
@jsvd jsvd deleted the refactor_agent branch November 25, 2015 12:24
colinsurprenant pushed a commit to colinsurprenant/logstash that referenced this pull request Dec 10, 2015
* move cli argument handling from agent to runner
* add a short-help message
* add interactive shell option
* log fatal messages to terminal when logging to file
* change docs:generate task to use bundle exec

Fixes elastic#3872
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.

7 participants