Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Native only #1

Merged
merged 1 commit into from
Sep 9, 2015
Merged

Native only #1

merged 1 commit into from
Sep 9, 2015

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Aug 3, 2015

Removal of HTTP stuff

@jordansissel
Copy link
Contributor

Meta question - is spec.unit a directory pattern we want to use going forward?

@andrewvc
Copy link
Contributor Author

andrewvc commented Aug 3, 2015

@jordansissel that is a mistake, no idea how I put that in there, will back out that change.

@andrewvc
Copy link
Contributor Author

andrewvc commented Aug 3, 2015

@jordansissel removed the dir. Thanks for catching that

@andrewvc andrewvc assigned andrewvc and talevy and unassigned andrewvc Aug 4, 2015
when "transport", "node"; "9300-9305"
end
end
@port ||= "9300-9305"
Copy link
Contributor

Choose a reason for hiding this comment

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

now that we have no conditions on this default, we can move this to the top

config :port, :default => "9300-9305"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good call!

@andrewvc
Copy link
Contributor Author

@talevy would either of you mind taking a look at this change set? I just backported the latest stuff around upserting.

@@ -11,146 +11,143 @@
let(:max_retries) { 3 }

def mock_actions_with_response(*resp)
LogStash::Outputs::Elasticsearch::Protocols::HTTPClient
LogStash::Outputs::Elasticsearch::Protocols::TransportClient
Copy link
Contributor

Choose a reason for hiding this comment

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

2 things.

  1. I don't fully understand why, but mocking both Node and Transport Clients caused problems to me in the past. Since Transport client is of type NodeClient, mocking the NodeClient sufficed.
  2. we might as well update to the newer convention in rspec for any_instance mocking like so:
allow_any_instance_of(LogStash::Outputs::Elasticsearch::Protocols::NodeClient).to receive(:bulk).and_return(*resp)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, fixed!

On Thu, Aug 20, 2015 at 2:36 PM, Tal Levy notifications@github.com wrote:

In spec/integration/outputs/retry_spec.rb
#1 (comment)
:

@@ -11,146 +11,143 @@
let(:max_retries) { 3 }

def mock_actions_with_response(*resp)

  • LogStash::Outputs::Elasticsearch::Protocols::HTTPClient
  • LogStash::Outputs::Elasticsearch::Protocols::TransportClient

2 things.

I don't fully understand why, but mocking both Node and Transport
Clients caused problems to me in the past. Since Transport client is of
type NodeClient, mocking the NodeClient sufficed.
2.

we might as well update to the newer convention in rspec for
any_instance mocking like so:

allow_any_instance_of(LogStash::Outputs::Elasticsearch::Protocols::NodeClient).to receive(:bulk).and_return(*resp)


Reply to this email directly or view it on GitHub
https://github.com/logstash-plugins/logstash-output-elasticsearch_native/pull/1/files#r37571763
.

@andrewvc
Copy link
Contributor Author

This also pulls elastic/logstash#3735 (jar dependencies) via cherry pick

@andrewvc
Copy link
Contributor Author

This is currently broken pending mkristian/jar-dependencies#26 (figure out how to get the jar deps working)

@andrewvc andrewvc mentioned this pull request Sep 1, 2015

# execute the request and get the response, if it fails, we'll get an exception.
request.get
raise "Could not index template!" unless response.isAcknowledged
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still investigating whether this is appropriate for error handling

@jordansissel
Copy link
Contributor

Should there be all those .jar files checked into git? Seems like a recipe for fast git repo size growth. Thoughts?

# which uses HTTP instead. This output is, in-fact, sometimes slower, and never faster than that one.
# Additionally, upgrading your Elasticsearch cluster may require you to simultaneously update this
# plugin for any protocol level changes. The HTTP client has far fewer of these issues and is
# generally just easier to work with.
Copy link
Contributor

Choose a reason for hiding this comment

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

"is generally just easier"

Maybe rephrase "may be easier to work with due to wider familiarity with http" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea. Added!

@jordansissel
Copy link
Contributor

Finished reviewing the code, but didn't review the specs yet. Left a few comments.

I'll run the tests soon and report back. :)

# All protocols will use bulk requests when talking to Elasticsearch.
#
# The default `protocol` setting under java/jruby is "node". The default
# `protocol` on non-java rubies is "http"
config :protocol, :validate => [ "node", "transport", "http" ]
config :protocol, :validate => [ "node", "transport"], :default => "node"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, maybe this should default to transport?

Copy link
Contributor

Choose a reason for hiding this comment

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

@andrewvc I am leaning towards default to transport too. node requires setting network_host. Maybe this will really deter folks from using node

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 default to transport. We require (basically) hosts anyway and further that the main benefit of node for logstash (by intention, anyway) was multicast discovery which is disabled in 2.0

@suyograo
Copy link
Contributor

suyograo commented Sep 8, 2015

@andrewvc is network_host required for both protocols? I tried beta3 with transport and it worked with only hosts setting. I was running ES and LS on localhost though :)

@andrewvc
Copy link
Contributor Author

andrewvc commented Sep 8, 2015

@suyograo this must be an ES2.0 change, because it just won't join the cluster without that set.

We could do some detection by attempting to get the hostname (which usually works for AWS), but it's probably best to just make it explicit.

@suyograo
Copy link
Contributor

suyograo commented Sep 8, 2015

@andrewvc lets make it explicit for now.

@suyograo
Copy link
Contributor

suyograo commented Sep 8, 2015

i tested this PR and it works for both transport and node

# The name/address of the host to bind to for Elasticsearch clustering. Equivalent to the Elasticsearch option 'network.host'
# option.
# This MUST be set for either protocol to work (node or transport)! The internal Elasticsearch node
# will bind to this ip. This ip MUST be reachable by all nodes in the Elasticsearch cluster
Copy link
Contributor

Choose a reason for hiding this comment

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

This ip MUST be reachable by all nodes in the Elasticsearch cluster

Only if protocol => node, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in ES2.0! (surprisingly)

andrewvc added a commit that referenced this pull request Sep 9, 2015
@andrewvc andrewvc merged commit 281815f into logstash-plugins:master Sep 9, 2015
@andrewvc andrewvc deleted the native_only branch September 9, 2015 16:58
@jordansissel
Copy link
Contributor

LGTM :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants