Skip to content

Commit

Permalink
Move the Version module to SignalFx::Version
Browse files Browse the repository at this point in the history
While convenient for referencing elsewhere in the code, the
non-namespaced Version collides with generated Thrift code in the rbhive
gem.  While both of these gems could be fixed, this version module being
scoped under a namespace felt more correct than fixing generated code.

The conflicting code can be found here: https://github.com/forward3d/rbhive/blob/master/lib/thrift/hive_metastore_types.rb#L29

This should be a simple enough fix though
  • Loading branch information
Grier Johnson committed Aug 15, 2018
1 parent 9ef90e0 commit 6dcff76
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
signalfx (2.0.4)
signalfx (2.0.5)
protobuf (>= 3.5.1)
rest-client (~> 2.0)
websocket-client-simple (~> 0.3.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/signalfx/signal_fx_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def post(data_to_send, url, suffix, &block)

headers = {HEADER_CONTENT_TYPE => header_content_type,
HEADER_API_TOKEN_KEY => @api_token,
HEADER_USER_AGENT_KEY => Version::NAME + '/' + Version::VERSION + http_user_agents}
HEADER_USER_AGENT_KEY => SignalFx::Version::NAME + '/' + SignalFx::Version::VERSION + http_user_agents}

RestClient::Request.execute(
method: :post,
Expand Down
10 changes: 6 additions & 4 deletions lib/signalfx/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (C) 2015-2016 SignalFx, Inc. All rights reserved.

module Version
VERSION = '2.0.4'
NAME = 'signalfx-ruby-client'
end
module SignalFx
module Version
VERSION = '2.0.5'
NAME = 'signalfx-ruby-client'
end
end
2 changes: 1 addition & 1 deletion signalfx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require_relative 'lib/signalfx/version'

Gem::Specification.new do |spec|
spec.name = "signalfx"
spec.version = Version::VERSION
spec.version = SignalFx::Version::VERSION
spec.authors = ["SignalFx, Inc"]
spec.email = ["[email protected]"]

Expand Down
34 changes: 17 additions & 17 deletions spec/signalfx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

stub_request(:post, "https://custom-ingest.endpoint/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":1,\"dimensions\":{}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":2,\"dimensions\":{}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -95,7 +95,7 @@

stub_request(:post, "https://custom-ingest.endpoint/v2/event").
with(:body => "[{\"category\":\"USER_DEFINED\",\"eventType\":\"deployments\",\"dimensions\":{\"host\":\"myhost\",\"service\":\"myservice\",\"instance\":\"myinstance\"},\"properties\":{\"version\":\"12345\"},\"timestamp\":1234567890}]",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -112,7 +112,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":1,\"dimensions\":{}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":2,\"dimensions\":{}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -125,7 +125,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":1.1,\"dimensions\":{}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":2.2,\"dimensions\":{}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -138,7 +138,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":\"111\",\"dimensions\":{}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":\"222\",\"dimensions\":{}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -151,7 +151,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":1,\"timestamp\":1234567890,\"dimensions\":{}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":2,\"timestamp\":1234567890,\"dimensions\":{}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -164,7 +164,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => "{\"gauge\":[{\"metric\":\"test.cpu\",\"value\":1,\"dimensions\":{\"host\":\"server1\",\"host_ip\":\"1.2.3.4\"}}],\"counter\":[{\"metric\":\"cpu_cnt\",\"value\":2,\"dimensions\":{\"host\":\"server1\",\"host_ip\":\"1.2.3.4\"}}]}",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -183,7 +183,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/event").
with(:body => "[{\"category\":\"USER_DEFINED\",\"eventType\":\"deployments\",\"dimensions\":{\"host\":\"myhost\",\"service\":\"myservice\",\"instance\":\"myinstance\"},\"properties\":{\"version\":\"12345\"},\"timestamp\":1234567890}]",
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/json', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand Down Expand Up @@ -213,7 +213,7 @@

stub_request(:post, "https://custom-ingest.endpoint/v2/datapoint").
with(:body => StringIO.new("\n\x10\x12\btest.cpu\"\x02\x18\x01(\x00\n\x0F\x12\acpu_cnt\"\x02\x18\x02(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -232,7 +232,7 @@

stub_request(:post, "https://custom-ingest.endpoint/v2/datapoint").
with(:body => StringIO.new("\n\x10\x12\btest.cpu\"\x02\x18\x01(\x00\n\x0F\x12\acpu_cnt\"\x02\x18\x02(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -258,7 +258,7 @@

stub_request(:post, "https://custom-ingest.endpoint/v2/event").
with(:body => StringIO.new("\ni\n\vdeployments\x12\x0E\n\x04host\x12\x06myhost\x12\x14\n\aservice\x12\tmyservice\x12\x16\n\binstance\x12\nmyinstance\x1A\x12\n\aversion\x12\a\n\x0512345 \xC0\x84=(\xD2\x85\xD8\xCC\x04").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + ', ua_1, ua_2', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -271,7 +271,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => StringIO.new("\n\x10\x12\btest.cpu\"\x02\x18\x01(\x00\n\x0F\x12\acpu_cnt\"\x02\x18\x02(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -284,7 +284,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => StringIO.new("\n\x17\x12\btest.cpu\"\t\x11\x9A\x99\x99\x99\x99\x99\xF1?(\x00\n\x16\x12\acpu_cnt\"\t\x11\x9A\x99\x99\x99\x99\x99\x01@(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type'=>'application/x-protobuf', 'User-Agent'=>'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token'=>TOKEN,
:headers => {'Content-Type'=>'application/x-protobuf', 'User-Agent'=>'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token'=>TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK")

Expand All @@ -297,7 +297,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => StringIO.new("\n\x13\x12\btest.cpu\"\x05\n\x03111(\x00\n\x12\x12\acpu_cnt\"\x05\n\x03111(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -310,7 +310,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => StringIO.new("\n\x16\x12\btest.cpu\x18\xD2\x85\xD8\xCC\x04\"\x02\x18\x01(\x00\n\x15\x12\acpu_cnt\x18\xD2\x85\xD8\xCC\x04\"\x02\x18\x02(\x01").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -323,7 +323,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/datapoint").
with(:body => StringIO.new("\n5\x12\btest.cpu\"\x02\x18\x01(\x002\x0F\n\x04host\x12\aserver12\x12\n\ahost_ip\x12\a1.2.3.4\n4\x12\acpu_cnt\"\x02\x18\x02(\x012\x0F\n\x04host\x12\aserver12\x12\n\ahost_ip\x12\a1.2.3.4").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand All @@ -342,7 +342,7 @@

stub_request(:post, "https://ingest.signalfx.com/v2/event").
with(:body => StringIO.new("\ni\n\vdeployments\x12\x0E\n\x04host\x12\x06myhost\x12\x14\n\aservice\x12\tmyservice\x12\x16\n\binstance\x12\nmyinstance\x1A\x12\n\aversion\x12\a\n\x0512345 \xC0\x84=(\xD2\x85\xD8\xCC\x04").set_encoding('ascii-8bit').string,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + Version::VERSION + '', 'X-Sf-Token' => TOKEN,
:headers => {'Content-Type' => 'application/x-protobuf', 'User-Agent' => 'signalfx-ruby-client/' + SignalFx::Version::VERSION + '', 'X-Sf-Token' => TOKEN,
'Accept' => /.*/, 'Accept-Encoding' => /.*/, 'Content-Length' => /\d+/}).
to_return(:status => 200, :body => "OK", :headers => {})

Expand Down

0 comments on commit 6dcff76

Please sign in to comment.